Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
4.8 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. attrlist.hxx
  5. Abstract:
  6. inline implementation of all of ATTRLIST 's functions
  7. The out-of-line routines are in attrnode.cxx
  8. Notes:
  9. this is designed to be included before nodeskl.hxx.
  10. It is suggested that allnodes.hxx be used to achieve this...
  11. History:
  12. ----------------------------------------------------------------------------*/
  13. #ifndef __ATTRLIST_HXX__
  14. #define __ATTRLIST_HXX__
  15. #include "midlnode.hxx"
  16. #include "errors.hxx"
  17. /************************* attribute base class ************************/
  18. class node_base_attr
  19. {
  20. private:
  21. ATTR_T AttrID;
  22. node_base_attr * pNext;
  23. friend class ATTRLIST;
  24. public:
  25. node_base_attr( ATTR_T ID )
  26. {
  27. AttrID = ID;
  28. pNext = NULL;
  29. }
  30. ~node_base_attr() { };
  31. node_base_attr * GetNext()
  32. {
  33. return pNext;
  34. }
  35. ATTR_T GetAttrID()
  36. {
  37. return AttrID;
  38. };
  39. virtual
  40. BOOL IsBitAttr()
  41. {
  42. return FALSE;
  43. }
  44. #ifdef scheck
  45. virtual
  46. node_state AcfSCheck();
  47. #endif // scheck
  48. virtual
  49. class expr_node * GetExpr()
  50. {
  51. return NULL;
  52. }
  53. char * GetNodeNameString();
  54. #ifdef scheck
  55. virtual
  56. node_state SCheck();
  57. #endif // scheck
  58. virtual
  59. class node_base_attr * Clone()
  60. {
  61. return new node_base_attr(AttrID);
  62. }
  63. virtual
  64. BOOL IsAcfAttr()
  65. {
  66. return FALSE;
  67. }
  68. /*
  69. virtual
  70. STATUS_T MopCodeGen(
  71. MopStream * pStream,
  72. node_skl * pParent,
  73. BOOL fMemory );
  74. virtual
  75. unsigned short MopGetAttrOffset(
  76. node_skl * pParent,
  77. BOOL fMemory );
  78. */
  79. void * operator new (size_t size )
  80. {
  81. return AllocateOnceNew( size );
  82. }
  83. void operator delete( void * ptr)
  84. {
  85. AllocateOnceDelete( ptr );
  86. }
  87. };
  88. /********************************** bit attributes ************************/
  89. // bit attributes
  90. class battr : public node_base_attr
  91. {
  92. public:
  93. battr( ATTR_T At ) : node_base_attr( At )
  94. {
  95. }
  96. battr(battr * pOld) : node_base_attr( pOld->GetAttrID() )
  97. {
  98. *this = *pOld;
  99. }
  100. virtual
  101. class node_base_attr * Clone()
  102. {
  103. battr *pNew = new battr(this);
  104. return pNew;
  105. }
  106. virtual
  107. BOOL IsBitAttr()
  108. {
  109. return TRUE;
  110. }
  111. };
  112. /********************************** attribute lists ************************/
  113. // ATTRLIST is a plain linear list of attribute nodes linked by a next field
  114. //
  115. // all additions are done to the head of the list. These lists may have
  116. // shared suffixes
  117. //
  118. class node_base_attr;
  119. class type_node_list;
  120. class STREAM;
  121. class ISTREAM;
  122. class ATTRLIST
  123. {
  124. node_base_attr * pHead;
  125. public:
  126. void MakeAttrList()
  127. {
  128. pHead = NULL;
  129. };
  130. void MakeAttrList( node_base_attr * pAttrNode )
  131. {
  132. if ( pAttrNode )
  133. {
  134. pHead = pAttrNode;
  135. pAttrNode->pNext = NULL;
  136. }
  137. }
  138. void MakeAttrList( ATTR_T bit )
  139. {
  140. pHead = new battr( bit );
  141. pHead->pNext = NULL;
  142. }
  143. void SetPeer( ATTR_T bit )
  144. {
  145. battr * pNewAttr = new battr( bit );
  146. pNewAttr->pNext = pHead;
  147. pHead = pNewAttr;
  148. }
  149. void SetPeer( node_base_attr * pNewAttr )
  150. {
  151. pNewAttr->pNext = pHead;
  152. pHead = pNewAttr;
  153. };
  154. void Add ( ATTR_T bit )
  155. {
  156. SetPeer( bit );
  157. };
  158. void Add (node_base_attr * pNewAttr )
  159. {
  160. SetPeer( pNewAttr );
  161. };
  162. void Remove( ATTR_T flag );
  163. void Merge( ATTRLIST & MoreAttrs );
  164. node_base_attr * GetAttribute( ATTR_T flag );
  165. ATTRLIST Clone();
  166. STATUS_T GetAttributeList( type_node_list * pTNList );
  167. void Reverse();
  168. BOOL FInSummary( ATTR_T flag );
  169. BOOL FMATTRInSummary( MATTR_T flag );
  170. BOOL FTATTRInSummary( TATTR_T flag );
  171. operator node_base_attr*()
  172. {
  173. return pHead;
  174. };
  175. BOOL NonNull()
  176. {
  177. return (pHead != NULL);
  178. };
  179. node_base_attr * GetFirst()
  180. {
  181. return pHead;
  182. }
  183. void Dump( ISTREAM *);
  184. };
  185. #endif // __ATTRLIST_HXX__