Windows NT 4.0 source code leak
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.

247 lines
4.2 KiB

4 years ago
  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989 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() { };
  32. node_base_attr * GetNext()
  33. {
  34. return pNext;
  35. }
  36. ATTR_T GetAttrID()
  37. {
  38. return AttrID;
  39. };
  40. virtual
  41. BOOL IsBitAttr();
  42. #ifdef scheck
  43. virtual
  44. node_state AcfSCheck();
  45. #endif // scheck
  46. virtual
  47. class expr_node * GetExpr();
  48. char * GetNodeNameString();
  49. #ifdef scheck
  50. virtual
  51. node_state SCheck();
  52. #endif // scheck
  53. virtual
  54. class node_base_attr * Clone()
  55. {
  56. node_base_attr * pNew = new node_base_attr();
  57. *pNew = *this;
  58. pNew->pNext = NULL;
  59. return pNew;
  60. }
  61. virtual
  62. BOOL IsAcfAttr()
  63. {
  64. return FALSE;
  65. }
  66. /*
  67. virtual
  68. STATUS_T MopCodeGen(
  69. MopStream * pStream,
  70. node_skl * pParent,
  71. BOOL fMemory );
  72. virtual
  73. unsigned short MopGetAttrOffset(
  74. node_skl * pParent,
  75. BOOL fMemory );
  76. */
  77. void * operator new (size_t size )
  78. {
  79. return AllocateOnceNew( size );
  80. }
  81. void operator delete( void * ptr)
  82. {
  83. AllocateOnceDelete( ptr );
  84. }
  85. };
  86. /********************************** bit attributes ************************/
  87. // bit attributes
  88. class battr : public node_base_attr
  89. {
  90. public:
  91. battr( ATTR_T At ) : node_base_attr( At )
  92. {
  93. }
  94. battr(battr * pOld)
  95. {
  96. *this = *pOld;
  97. }
  98. virtual
  99. class node_base_attr * Clone()
  100. {
  101. battr * pNew = new battr(this);
  102. return pNew;
  103. }
  104. virtual
  105. BOOL IsBitAttr();
  106. };
  107. /********************************** attribute lists ************************/
  108. // ATTRLIST is a plain linear list of attribute nodes linked by a next field
  109. //
  110. // all additions are done to the head of the list. These lists may have
  111. // shared suffixes
  112. //
  113. class node_base_attr;
  114. class type_node_list;
  115. class STREAM;
  116. class ISTREAM;
  117. class ATTRLIST
  118. {
  119. node_base_attr * pHead;
  120. public:
  121. void MakeAttrList()
  122. {
  123. pHead = NULL;
  124. };
  125. void MakeAttrList( node_base_attr * pAttrNode )
  126. {
  127. if ( pAttrNode )
  128. {
  129. pHead = pAttrNode;
  130. pAttrNode->pNext = NULL;
  131. }
  132. }
  133. void MakeAttrList( ATTR_T bit )
  134. {
  135. pHead = new battr( bit );
  136. pHead->pNext = NULL;
  137. }
  138. void SetPeer( ATTR_T bit )
  139. {
  140. battr * pNewAttr = new battr( bit );
  141. pNewAttr->pNext = pHead;
  142. pHead = pNewAttr;
  143. }
  144. void SetPeer( node_base_attr * pNewAttr )
  145. {
  146. pNewAttr->pNext = pHead;
  147. pHead = pNewAttr;
  148. };
  149. void Add ( ATTR_T bit )
  150. {
  151. SetPeer( bit );
  152. };
  153. void Add (node_base_attr * pNewAttr )
  154. {
  155. SetPeer( pNewAttr );
  156. };
  157. void Merge( ATTRLIST & MoreAttrs );
  158. node_base_attr * GetAttribute( ATTR_T flag );
  159. ATTRLIST Clone();
  160. STATUS_T GetAttributeList( type_node_list * pTNList );
  161. void Reverse();
  162. BOOL FInSummary( ATTR_T flag );
  163. BOOL FMATTRInSummary( MATTR_T flag );
  164. BOOL FTATTRInSummary( TATTR_T flag );
  165. operator node_base_attr*()
  166. {
  167. return pHead;
  168. };
  169. BOOL NonNull()
  170. {
  171. return (pHead != NULL);
  172. };
  173. node_base_attr * GetFirst()
  174. {
  175. return pHead;
  176. }
  177. void Dump( ISTREAM *);
  178. };
  179. #endif // __ATTRLIST_HXX__