Source code of Windows XP (NT5)
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.

123 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. //
  13. //--------------------------------------------------------------------------
  14. #pragma once
  15. #ifdef DISPLAY_INCLUDES
  16. #pragma message( "#include <" __FILE__ ">..." )
  17. #endif
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Class: CStateSet
  21. //
  22. // Purpose: Represents a set of states.
  23. //
  24. // History: 20-Jan-92 KyleP Created
  25. //
  26. //--------------------------------------------------------------------------
  27. //
  28. // Assume most state sets are small.
  29. //
  30. UINT const CStateSet_cFirst = 10;
  31. class CStateSet
  32. {
  33. public:
  34. inline CStateSet();
  35. inline ~CStateSet();
  36. void Clear();
  37. void Add( UINT state );
  38. inline UINT Count() const;
  39. UINT State( UINT iState ) const;
  40. BOOL IsMember( UINT state );
  41. private:
  42. UINT _cStates;
  43. UINT _auiFirst[ CStateSet_cFirst ];
  44. UINT *_puiRest;
  45. UINT _cuiRest;
  46. UINT _cRest;
  47. #if (CIDBG == 1)
  48. public:
  49. //
  50. // Debug methods
  51. //
  52. void Display();
  53. #endif // (CIDBG == 1)
  54. };
  55. //+-------------------------------------------------------------------------
  56. //
  57. // Member: CStateSet::CStateSet, public
  58. //
  59. // Synopsis: Initialize a state set.
  60. //
  61. // History: 20-Jan-92 KyleP Created
  62. //
  63. //--------------------------------------------------------------------------
  64. inline CStateSet::CStateSet()
  65. : _puiRest( 0 )
  66. {
  67. Clear();
  68. }
  69. //+-------------------------------------------------------------------------
  70. //
  71. // Member: CStateSet::~CStateSet, public
  72. //
  73. // Synopsis: Destroy a state set.
  74. //
  75. // History: 20-Jan-92 KyleP Created
  76. //
  77. //--------------------------------------------------------------------------
  78. inline CStateSet::~CStateSet()
  79. {
  80. delete _puiRest;
  81. }
  82. //+-------------------------------------------------------------------------
  83. //
  84. // Member: CStateSet::Count, public
  85. //
  86. // Returns: The number of states in the state set.
  87. //
  88. // History: 20-Jan-92 KyleP Created
  89. //
  90. //--------------------------------------------------------------------------
  91. inline UINT CStateSet::Count() const
  92. {
  93. return( _cStates );
  94. }