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.

271 lines
5.4 KiB

  1. /*
  2. * NOTES:
  3. *
  4. * REVISIONS:
  5. * pcy30Mar95: Initial revision
  6. * pav11Jul95: Merged in Windows 16 bit needs
  7. * djs12Sep95: Port to Unix
  8. * ntf03Jan96: Added operator<< functionality so that datetime.cxx would compile
  9. * ajr14Feb96: SINIX merge
  10. */
  11. #ifndef _DATETIME_H
  12. #define _DATETIME_H
  13. #include "apc.h"
  14. #include "_defs.h"
  15. _CLASSDEF(DateTimeObj)
  16. _CLASSDEF(DateObj)
  17. _CLASSDEF(TimeObj)
  18. _CLASSDEF(WeekObj)
  19. #ifdef APCDEBUG
  20. class ostream;
  21. #endif
  22. #include "err.h"
  23. #include "apcobj.h"
  24. #if (C_OS & C_UNIX)
  25. #if (!(C_OS & C_SINIX))
  26. #include <iostream.h>
  27. #endif
  28. #endif
  29. #if (C_OS & C_WIN311)
  30. class TimeObj : public Obj
  31. {
  32. private:
  33. INT theHours;
  34. INT theMinutes;
  35. INT theSeconds;
  36. protected:
  37. #ifdef APCDEBUG
  38. virtual ostream& printMeOut(ostream& os);
  39. #endif
  40. public:
  41. #ifdef APCDEBUG
  42. friend ostream& operator<< (ostream& os, TimeObj &);
  43. #endif
  44. TimeObj();
  45. TimeObj(PCHAR);
  46. TimeObj(INT aHours, INT aMinutes, INT aSeconds);
  47. virtual INT GetHour() const;
  48. virtual INT GetMinutes() const;
  49. virtual INT GetSeconds() const;
  50. VOID SetHour(INT hour);
  51. VOID SetMinutes(INT minutes);
  52. VOID SetSeconds(INT seconds);
  53. INT Equal(PTimeObj atime);
  54. virtual INT operator < (const RTimeObj cmp) const;
  55. };
  56. class WeekObj : public Obj
  57. {
  58. private:
  59. INT theWeekDay;
  60. public:
  61. WeekObj();
  62. WeekObj(PCHAR);
  63. WeekObj(INT Day);
  64. INT GetWeekDay();
  65. };
  66. class DateObj : public Obj
  67. {
  68. private:
  69. INT theMonth;
  70. INT theDay;
  71. INT theYear;
  72. protected:
  73. #ifdef APCDEBUG
  74. virtual ostream& printMeOut(ostream& os);
  75. #endif
  76. public:
  77. #ifdef APCDEBUG
  78. friend ostream& operator<< (ostream& os, DateObj &);
  79. #endif
  80. DateObj();
  81. DateObj(INT aMonth,INT aDay,INT aYear);
  82. virtual INT GetMonth() const;
  83. virtual INT GetDay() const;
  84. virtual INT GetYear() const;
  85. virtual INT GetDaysInMonth() const;
  86. virtual INT GetDaysInMonth (const INT, const INT aYear = 1) const;
  87. virtual INT operator == (const RDateObj cmp) const;
  88. virtual INT operator < (const RDateObj cmp) const;
  89. virtual LONG operator - (const RDateObj cmp) const;
  90. VOID SetMonth(INT month);
  91. VOID SetDay(INT day);
  92. VOID SetYear(INT year);
  93. };
  94. // The constructor takes the following arguements.
  95. // Month - 1-12
  96. // Day - 1-31 , Depending upon the month.
  97. // Year -- YY , Example 92
  98. // Hour -- HH , Military time. ( 24 Hour Clock)
  99. // Minutes -- MM ,0-59
  100. // Seconds -- SS, 0-59
  101. class DateTimeObj : public Obj
  102. {
  103. private:
  104. PDateObj theDate;
  105. PTimeObj theTime;
  106. protected:
  107. #ifdef APCDEBUG
  108. virtual ostream& printMeOut(ostream& os);
  109. #endif
  110. public:
  111. #ifdef APCDEBUG
  112. friend ostream& operator<< (ostream& os, DateTimeObj &);
  113. #endif
  114. DateTimeObj();
  115. DateTimeObj(INT aMonth,INT aDay, INT aYear,INT anHour, INT aMinutes,
  116. INT aSeconds);
  117. DateTimeObj (const RDateTimeObj aDate);
  118. virtual ~DateTimeObj();
  119. PDateObj GetDate() const;
  120. PTimeObj GetTime() const;
  121. virtual INT operator < (const RDateTimeObj cmp) const;
  122. virtual LONG GetMilliseconds();
  123. virtual LONG GetSeconds();
  124. };
  125. #else
  126. class TimeObj : public Obj
  127. {
  128. private:
  129. ULONG theHours;
  130. ULONG theMinutes;
  131. ULONG theSeconds;
  132. protected:
  133. #ifdef APCDEBUG
  134. virtual ostream& printMeOut(ostream& os);
  135. #endif
  136. public:
  137. #ifdef APCDEBUG
  138. friend ostream& operator<< (ostream& os, TimeObj &);
  139. #endif
  140. TimeObj();
  141. TimeObj(PCHAR);
  142. TimeObj(ULONG aHours, ULONG aMinutes, ULONG aSeconds);
  143. virtual ULONG GetHour() const;
  144. virtual ULONG GetMinutes() const;
  145. virtual ULONG GetSeconds() const;
  146. VOID SetHour(ULONG hour);
  147. VOID SetMinutes(ULONG minutes);
  148. VOID SetSeconds(ULONG seconds);
  149. INT Equal(PTimeObj atime);
  150. virtual INT operator < (RTimeObj cmp) const;
  151. };
  152. class WeekObj : public Obj
  153. {
  154. private:
  155. ULONG theWeekDay;
  156. public:
  157. WeekObj();
  158. WeekObj(PCHAR);
  159. WeekObj(ULONG Day);
  160. ULONG GetWeekDay();
  161. };
  162. class DateObj : public Obj
  163. {
  164. private:
  165. ULONG theMonth;
  166. ULONG theDay;
  167. ULONG theYear;
  168. protected:
  169. #ifdef APCDEBUG
  170. virtual ostream& printMeOut(ostream& os);
  171. #endif
  172. public:
  173. #ifdef APCDEBUG
  174. friend ostream& operator<< (ostream& os, DateObj &);
  175. #endif
  176. DateObj();
  177. DateObj(ULONG aMonth,ULONG aDay,ULONG aYear);
  178. virtual ULONG GetMonth() const;
  179. virtual ULONG GetDay() const;
  180. virtual ULONG GetYear() const;
  181. virtual ULONG GetDaysInMonth() const;
  182. virtual ULONG GetDaysInMonth (const ULONG, const ULONG aYear = 1) const;
  183. virtual INT operator == (RDateObj cmp) const;
  184. virtual INT operator < (RDateObj cmp) const;
  185. virtual LONG operator - (RDateObj cmp) const;
  186. VOID SetMonth(ULONG month);
  187. VOID SetDay(ULONG day);
  188. VOID SetYear(ULONG year);
  189. };
  190. // The constructor takes the following arguements.
  191. // Month - 1-12
  192. // Day - 1-31 , Depending upon the month.
  193. // Year -- YY , Example 92
  194. // Hour -- HH , Military time. ( 24 Hour Clock)
  195. // Minutes -- MM ,0-59
  196. // Seconds -- SS, 0-59
  197. class DateTimeObj : public Obj
  198. {
  199. private:
  200. PDateObj theDate;
  201. PTimeObj theTime;
  202. protected:
  203. #ifdef APCDEBUG
  204. virtual ostream& printMeOut(ostream& os);
  205. #endif
  206. public:
  207. #ifdef APCDEBUG
  208. friend ostream& operator<< (ostream& os, DateTimeObj &);
  209. #endif
  210. DateTimeObj();
  211. DateTimeObj(ULONG aMonth,ULONG aDay,ULONG aYear,ULONG anHour,ULONG aMinutes,
  212. ULONG aSeconds);
  213. DateTimeObj (RDateTimeObj aDate);
  214. virtual ~DateTimeObj();
  215. PDateObj GetDate() const;
  216. PTimeObj GetTime() const;
  217. virtual INT operator < (RDateTimeObj cmp) const;
  218. virtual LONG GetMilliseconds();
  219. virtual LONG GetSeconds();
  220. };
  221. #endif
  222. #endif