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.

112 lines
2.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1991, Microsoft Corporation.
  4. //
  5. // File: StateSet.hxx
  6. //
  7. // Contents:
  8. //
  9. // Classes:
  10. //
  11. // History: 01-20-92 KyleP Created
  12. // 03-11-97 arunk Modified for regex lib
  13. //--------------------------------------------------------------------------
  14. #ifndef __STATESET_HXX__
  15. #define __STATESET_HXX__
  16. #include <windows.h>
  17. //+-------------------------------------------------------------------------
  18. //
  19. // Class: CStateSet
  20. //
  21. // Purpose: Represents a set of states.
  22. //
  23. // History: 20-Jan-92 KyleP Created
  24. //
  25. //--------------------------------------------------------------------------
  26. //
  27. // Assume most state sets are small.
  28. //
  29. UINT const CStateSet_cFirst = 10;
  30. class CStateSet
  31. {
  32. public:
  33. inline CStateSet();
  34. inline ~CStateSet();
  35. void Clear();
  36. void Add( UINT state );
  37. inline UINT Count() const;
  38. UINT State( UINT iState ) const;
  39. BOOL IsMember( UINT state );
  40. private:
  41. UINT _cStates;
  42. UINT _auiFirst[ CStateSet_cFirst ];
  43. UINT *_puiRest;
  44. UINT _cuiRest;
  45. UINT _cRest;
  46. };
  47. //+-------------------------------------------------------------------------
  48. //
  49. // Member: CStateSet::CStateSet, public
  50. //
  51. // Synopsis: Initialize a state set.
  52. //
  53. // History: 20-Jan-92 KyleP Created
  54. //
  55. //--------------------------------------------------------------------------
  56. inline CStateSet::CStateSet()
  57. : _puiRest( 0 )
  58. {
  59. Clear();
  60. }
  61. //+-------------------------------------------------------------------------
  62. //
  63. // Member: CStateSet::~CStateSet, public
  64. //
  65. // Synopsis: Destroy a state set.
  66. //
  67. // History: 20-Jan-92 KyleP Created
  68. //
  69. //--------------------------------------------------------------------------
  70. inline CStateSet::~CStateSet()
  71. {
  72. delete _puiRest;
  73. }
  74. //+-------------------------------------------------------------------------
  75. //
  76. // Member: CStateSet::Count, public
  77. //
  78. // Returns: The number of states in the state set.
  79. //
  80. // History: 20-Jan-92 KyleP Created
  81. //
  82. //--------------------------------------------------------------------------
  83. inline UINT CStateSet::Count() const
  84. {
  85. return( _cStates );
  86. }
  87. #endif // __STATESET_HXX__