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.

158 lines
3.1 KiB

  1. /*++
  2. Copyright (C) 1999 Microsoft Corporation
  3. --*/
  4. /******************************************************************/
  5. #ifndef __WBEM_TIME__DATEP__H_
  6. #define __WBEM_TIME__DATEP__H_
  7. #include <ql.h>
  8. #define SETMIN ((__int64)0x0000000000000001)
  9. #define SETMAX ((__int64)0x8000000000000000)
  10. #define SETEMPTY ((__int64)0x0000000000000000)
  11. #define SETFULL ((__int64)0xFFFFFFFFFFFFFFFF)
  12. struct COrderedUniqueSet64
  13. {
  14. ULONGLONG
  15. m_BitField; // m_BitField MUST be an unsigned type
  16. COrderedUniqueSet64(void);
  17. COrderedUniqueSet64
  18. Set(ULONGLONG n),
  19. Add(ULONGLONG n),
  20. Remove(ULONGLONG n),
  21. Union(COrderedUniqueSet64 n),
  22. Intersection(COrderedUniqueSet64 n),
  23. UpperBound(ULONGLONG n),
  24. LowerBound(ULONGLONG n),
  25. Rotate(int n);
  26. int
  27. Member(ULONGLONG n);
  28. unsigned
  29. Next(ULONGLONG n),
  30. Prev(ULONGLONG n);
  31. };
  32. /******************************************************************/
  33. struct CPattern
  34. {
  35. enum
  36. {
  37. UPPERBOUND = 0x00000001,
  38. LOWERBOUND = 0x00000002,
  39. MODULUS = 0x00000004,
  40. EQUALTO = 0x00000008,
  41. NOTEQUALTO = 0x00000010
  42. };
  43. unsigned
  44. m_FieldsUsed,
  45. m_UpperBound,
  46. m_LowerBound,
  47. m_Modulus,
  48. m_EqualTo,
  49. m_CountNotEqualTo,
  50. m_NotEqualTo[64];
  51. CPattern(void)
  52. { m_FieldsUsed = 0x0; m_CountNotEqualTo = 0x0; }
  53. unsigned
  54. GetNextValue(unsigned x);
  55. };
  56. /******************************************************************/
  57. struct CDatePattern
  58. {
  59. enum
  60. {
  61. INDX_Year = 0,
  62. INDX_Month,
  63. INDX_Day,
  64. INDX_DayOfWeek,
  65. INDX_WeekInMonth,
  66. INDX_Quarter,
  67. INDX_Hour,
  68. INDX_Minute,
  69. INDX_Second,
  70. INDX_MAX
  71. };
  72. COrderedUniqueSet64
  73. m_Set[CDatePattern::INDX_MAX + 1]; // use extra set as buffer in
  74. // GetDayInMonth()
  75. CPattern
  76. m_Pattern[CDatePattern::INDX_MAX];
  77. SYSTEMTIME
  78. m_CurrentTime;
  79. int
  80. FieldIndx(const wchar_t *suName);
  81. ULONGLONG
  82. GetNextTime(SYSTEMTIME *pSystemTime = NULL),
  83. SetStartTime(SYSTEMTIME StartTime);
  84. HRESULT
  85. AugmentPattern(QL_LEVEL_1_TOKEN *pExp),
  86. BuildSetsFromPatterns(void),
  87. MapPatternToSet(CPattern *pPattern, COrderedUniqueSet64 *pSet),
  88. GetDaysInMonth(WORD iYear, WORD iMonth);
  89. };
  90. /******************************************************************/
  91. struct WQLDateTime
  92. {
  93. struct _DatePattern
  94. {
  95. CDatePattern
  96. *m_Datum;
  97. ULONGLONG
  98. m_Index;
  99. _DatePattern
  100. *m_Next;
  101. _DatePattern(void)
  102. { m_Datum = NULL; m_Next = NULL; m_Index = 0; }
  103. ~_DatePattern(void)
  104. { if(NULL != m_Datum) delete m_Datum; }
  105. }
  106. *m_ParseTreeLeaves,
  107. *m_ListHead;
  108. int
  109. m_NLeaves;
  110. WQLDateTime(void)
  111. { m_ParseTreeLeaves = m_ListHead = NULL; m_NLeaves = 0; }
  112. ~WQLDateTime(void)
  113. { if(NULL != m_ParseTreeLeaves) delete [] m_ParseTreeLeaves; }
  114. HRESULT
  115. Init(QL_LEVEL_1_RPN_EXPRESSION *pExp = NULL);
  116. ULONGLONG
  117. SetStartTime(SYSTEMTIME *StartTime),
  118. GetNextTime(SYSTEMTIME *NextTime = NULL);
  119. void
  120. InsertOrdered(_DatePattern *pNode);
  121. };
  122. #endif