Time.h 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. #ifndef Zeit_H
  2. #define Zeit_H
  3. #include <time.h>
  4. #include "OperatingSystem.h"
  5. #include "ReferenceCounter.h"
  6. namespace Framework
  7. {
  8. class Text; //! Text.h
  9. class Uhrzeit; //! From this file
  10. class Datum; //! From this file
  11. class Zeit; //! From this file
  12. class ZeitMesser; //! From this file
  13. //! This class stores a time of day in the form of hours, minutes and
  14. //! seconds
  15. class Uhrzeit : public virtual ReferenceCounter
  16. {
  17. private:
  18. __int64 stunde, minute, sekunde;
  19. int update();
  20. public:
  21. //! Creates a new Uhrzeit object with the default values 00:00:00
  22. DLLEXPORT Uhrzeit();
  23. //! Sets the time by copying.
  24. //! \param zeit The values for hour, minute and second are
  25. //! copied from this object.
  26. DLLEXPORT int setUhrzeit(Uhrzeit* zeit);
  27. //! Sets the time.
  28. //! \param stunde The hour of the new time.
  29. //! \param minute The minute of the new time.
  30. //! \param sekunde The second of the new time.
  31. //! \return The number of remaining days.
  32. //! Example: setUhrzeit( 30, 30, 30 ); return: 1, stored: 6:30:30
  33. DLLEXPORT int setUhrzeit(int stunde, int minute, int sekunde);
  34. //! Sets the time.
  35. //! \param format A string that determines the format of the
  36. //! time in (zeit). h=hour, i=minute, s=second. \param
  37. //! zeit A string containing the new time. \return The
  38. //! number of remaining days. Example: setUhrzeit( "h:i:s", "05:30:00" );
  39. //! Example: setUhrzeit( "h:i:s", "30:30:00" ); return: 1, stored:
  40. //! 6:30:00
  41. DLLEXPORT int setUhrzeit(const char* format, const char* zeit);
  42. //! Sets the time.
  43. //! \param format A string that determines the format of the
  44. //! time in (zeit). h=hour, i=minute, s=second. \param
  45. //! zeit A Text object containing the new time. \return The
  46. //! number of remaining days. Example: setUhrzeit( "h:i:s", new Text(
  47. //! "05:30:00" ) ); Example: setUhrzeit( "h:i:s", new Text( "30:30:00"
  48. //! ) ); return: 1, stored: 6:30:00
  49. DLLEXPORT int setUhrzeit(const char* format, Text* zeit);
  50. //! Sets the hour.
  51. //! \param stunde The hour to be stored.
  52. //! \return The number of remaining days.
  53. //! Example: setStunde( 30 ); return: 1 day, stored hours: 6
  54. DLLEXPORT int setStunde(int stunde);
  55. //! Sets the minute.
  56. //! \param minute The minute to be stored.
  57. //! \return The number of remaining days.
  58. //! Example: Old time: 23:50:10, setMinute( 80 ); return: 1,
  59. //! stored time: 01:10:10
  60. DLLEXPORT int setMinute(int minute);
  61. //! Sets the second.
  62. //! \param minute The second to be stored.
  63. //! \return The number of remaining days.
  64. //! Example: Old time: 23:59:10, setSekunde( 80 ); return: 1,
  65. //! stored time: 00:00:30
  66. DLLEXPORT int setSekunde(int sekunde);
  67. //! Calculates the sum of this and another time and stores the result.
  68. //! \param zeit The time whose values are to be added.
  69. //! \return The number of remaining days.
  70. //! Example: Old time: 19:40:18, plusUhrzeit( (10:05:30) ); return 1,
  71. //! stored time: 05:45:48
  72. DLLEXPORT int plusUhrzeit(Uhrzeit* zeit);
  73. //! Calculates the sum of this and another time and stores the result.
  74. //! \param stunde The hours to be added.
  75. //! \param minute The minutes to be added.
  76. //! \param sekunde The seconds to be added.
  77. //! \return The number of remaining days.
  78. //! Example: Old time: 19:40:18, plusUhrzeit( 10, 5, 30 ); return 1,
  79. //! stored time: 05:45:48
  80. DLLEXPORT int plusUhrzeit(int stunde, int minute, int sekunde);
  81. //! Calculates the sum of this and another time and stores the result.
  82. //! \param format A string that determines the format of the
  83. //! time in (zeit). h=hour, i=minute, s=second.
  84. //! \param zeit A string containing the time to add.
  85. //! \return The number of remaining days.
  86. //! Example: Old time: 19:40:18, plusUhrzeit( "h:i:s", "10:05:30" );
  87. //! return 1, stored time: 05:45:48
  88. DLLEXPORT int plusUhrzeit(const char* format, const char* zeit);
  89. //! Calculates the sum of this and another time and stores the result.
  90. //! \param format A string that determines the format of the
  91. //! time in (zeit). h=hour, i=minute, s=second.
  92. //! \param zeit A Text object containing the time to add.
  93. //! \return The number of remaining days.
  94. //! Example: Old time: 19:40:18, plusUhrzeit( "h:i:s", new Text(
  95. //! "10:05:30" ) ); return 1, stored time: 05:45:48
  96. DLLEXPORT int plusUhrzeit(const char* format, Text* zeit);
  97. //! Calculates the sum of this and another time and stores the result.
  98. //! \param stunde The hours to add.
  99. //! \return The number of remaining days.
  100. //! Example: Old time: 20:50:30, plusStunde( 10 ); return 1,
  101. //! stored time: 6:50:30
  102. DLLEXPORT int plusStunde(__int64 stunde);
  103. //! Calculates the sum of this and another time and stores the result.
  104. //! \param minute The minutes to add.
  105. //! \return The number of remaining days.
  106. //! Example: Old time: 23:50:30, plusMinute( 11 ); return 1,
  107. //! stored time: 00:01:30
  108. DLLEXPORT int plusMinute(__int64 minute);
  109. //! Calculates the sum of this and another time and stores the result.
  110. //! \param sekunde The seconds to add.
  111. //! \return The number of remaining days.
  112. //! Example: Old time: 23:59:30, plusSekunde( 40 ); return 1,
  113. //! stored time: 00:00:10
  114. DLLEXPORT int plusSekunde(__int64 sekunde);
  115. //! Subtracts a given time from this one and stores the result.
  116. //! \param zeit The time to subtract.
  117. //! \return The number of remaining days.
  118. //! Example: Old time: 10:40:18, minusUhrzeit( (19:05:30) ); return -1,
  119. //! stored time: 15:34:48
  120. DLLEXPORT int minusUhrzeit(Uhrzeit* zeit);
  121. //! Subtracts a given time from this one and stores the result.
  122. //! \param stunde The hours to subtract.
  123. //! \param minute The minutes to subtract.
  124. //! \param sekunde The seconds to subtract.
  125. //! \return The number of remaining days.
  126. //! Example: Old time: 10:40:18, minusUhrzeit( 19, 05, 30 );
  127. //! return -1, stored time: 15:34:48
  128. DLLEXPORT int minusUhrzeit(int stunde, int minute, int sekunde);
  129. //! Subtracts a given time from this one and stores the result.
  130. //! \param format A string that determines the format of the
  131. //! time in (zeit). h=hour, i=minute, s=second.
  132. //! \param zeit A string containing the time to subtract.
  133. //! \return The number of remaining days.
  134. //! Example: Old time: 10:40:18, minusUhrzeit( "h:i:s", "19:05:30" );
  135. //! return -1, stored time: 15:34:48
  136. DLLEXPORT int minusUhrzeit(const char* format, const char* zeit);
  137. //! Subtracts a given time from this one and stores the result.
  138. //! \param format A string that determines the format of the
  139. //! time in (zeit). h=hour, i=minute, s=second.
  140. //! \param zeit A Text object containing the time to subtract.
  141. //! \return The number of remaining days.
  142. //! Example: Old time: 10:40:18, minusUhrzeit( "h:i:s", new Text(
  143. //! "19:05:30" ) ); return -1, stored time: 15:34:48
  144. DLLEXPORT int minusUhrzeit(const char* format, Text* zeit);
  145. //! Subtracts a given time from this one and stores the result.
  146. //! \param stunde The hours to subtract.
  147. //! \return The number of remaining days.
  148. //! Example: Old time: 10:40:18, minusStunde( 19 ); return -1,
  149. //! stored time: 15:40:18
  150. DLLEXPORT int minusStunde(__int64 stunde);
  151. //! Subtracts a given time from this one and stores the result.
  152. //! \param minute The minutes to subtract.
  153. //! \return The number of remaining days.
  154. //! Example: Old time: 00:40:18, minusMinute( 50 ); return -1,
  155. //! stored time: 23:50:18
  156. DLLEXPORT int minusMinute(__int64 minute);
  157. //! Subtracts a given time from this one and stores the result.
  158. //! \param sekunde The seconds to subtract.
  159. //! \return The number of remaining days.
  160. //! Example: Old time: 00:00:20, minusSekunde( 50 ); return -1,
  161. //! stored time: 23:59:30
  162. DLLEXPORT int minusSekunde(__int64 sekunde);
  163. //! Returns the hour.
  164. DLLEXPORT int getStunde() const;
  165. //! Returns the minute.
  166. DLLEXPORT int getMinute() const;
  167. //! Returns the second.
  168. DLLEXPORT int getSekunde() const;
  169. //! Returns the time formatted as text.
  170. //! \param format A string that determines the format of the
  171. //! returned time. h=hour, i=minute, s=second.
  172. //! Example: Time: 5:40:39, getUhrzeit( "h:i:s" ); return: "5:40:39"
  173. DLLEXPORT Text* getUhrzeit(const char* format) const;
  174. //! Checks if the time equals zeit.
  175. //! \param zeit The time to compare with.
  176. //! \return (true) if both times are equal. (false) if they
  177. //! are not equal.
  178. DLLEXPORT bool istGleich(Uhrzeit* zeit) const;
  179. //! Checks if the time equals zeit.
  180. //! \param format A string that determines the format of the
  181. //! time in (zeit). h=hour, i=minute, s=second. \param
  182. //! zeit A string containing the other time. \return
  183. //! (true) if both times are equal. (false) if they
  184. //! are not equal.
  185. DLLEXPORT bool istGleich(const char* format, const char* zeit) const;
  186. //! Checks if the time equals zeit.
  187. //! \param format A string that determines the format of the
  188. //! time in (zeit). h=hour, i=minute, s=second. \param
  189. //! zeit A Text object containing the other time.
  190. //! \return (true) if both times are equal. (false) if they
  191. //! are not equal.
  192. DLLEXPORT bool istGleich(const char* format, Text* zeit) const;
  193. //! Checks if the time equals the given time. Does not validate
  194. //! whether the given time is a valid time of day.
  195. //! \param stunde The hours of the time to check.
  196. //! \param minute The minutes of the time to check.
  197. //! \param sekunde The seconds of the time to check.
  198. //! \return (true) if both times are equal. (false) if they
  199. //! are not equal.
  200. DLLEXPORT bool istGleich(int stunde, int minute, int sekunde) const;
  201. //! Checks if the hour equals the given hour.
  202. //! \param stunde The hour to check.
  203. //! \return (true) if the hours are equal. (false) if they
  204. //! are not equal.
  205. DLLEXPORT bool stundeGleich(int stunde) const;
  206. //! Checks if the minute equals the given minute.
  207. //! \param minute The minute to check.
  208. //! \return (true) if the minutes are equal. (false) if they
  209. //! are not equal.
  210. DLLEXPORT bool minuteGleich(int minute) const;
  211. //! Checks if the second equals the given second.
  212. //! \param sekunde The second to check.
  213. //! \return (true) if the seconds are equal. (false) if they
  214. //! are not equal.
  215. DLLEXPORT bool sekundeGleich(int sekunde) const;
  216. //! Checks if the time is less than zeit.
  217. //! \param zeit The time to check against.
  218. //! \return (true) if the stored time is less than the given
  219. //! time. (false) otherwise.
  220. //! Example: (5:30:00).istKleiner( (10:40:29) ); return true
  221. DLLEXPORT bool istKleiner(Uhrzeit* zeit) const;
  222. //! Checks if the time is less than the given time.
  223. //! \param stunde The hours of the time to check.
  224. //! \param minute The minutes of the time to check.
  225. //! \param sekunde The seconds of the time to check.
  226. //! \return (true) if the stored time is less than the given
  227. //! time. (false) otherwise.
  228. //! Example: (5:30:00).istKleiner( 10, 40, 29 ); return true
  229. DLLEXPORT bool istKleiner(int stunde, int minute, int sekunde) const;
  230. //! Checks if the time is less than the given time.
  231. //! \param format A string that determines the format of the
  232. //! time in (zeit). h=hour, i=minute, s=second. \param
  233. //! zeit A string containing the other time. \return
  234. //! (true) if the stored time is less than the given
  235. //! time. (false) otherwise.
  236. //! Example: (5:30:00).istKleiner( "h:i:s", "10:40:29" ); return true
  237. DLLEXPORT bool istKleiner(const char* format, const char* zeit) const;
  238. //! Checks if the time is less than the given time.
  239. //! \param format A string that determines the format of the
  240. //! time in (zeit). h=hour, i=minute, s=second. \param
  241. //! zeit A Text object containing the other time.
  242. //! \return (true) if the stored time is less than the given
  243. //! time. (false) otherwise.
  244. DLLEXPORT bool istKleiner(const char* format, Text* zeit) const;
  245. //! Checks if the time is greater than zeit.
  246. //! \param zeit The time to check against.
  247. //! \return (true) if the stored time is greater than the given
  248. //! time. (false) otherwise.
  249. //! Example: (5:30:00).istLater( (10:40:29) ); return false
  250. DLLEXPORT bool istLater(Uhrzeit* zeit) const;
  251. //! Checks if the time is greater than the given time.
  252. //! \param stunde The hours of the time to check.
  253. //! \param minute The minutes of the time to check.
  254. //! \param sekunde The seconds of the time to check.
  255. //! \return (true) if the stored time is greater than the given
  256. //! time. (false) otherwise.
  257. //! Example: (5:30:00).istLater( 10, 40, 29 ); return false
  258. DLLEXPORT bool istLater(int stunde, int minute, int sekunde) const;
  259. //! Checks if the time is greater than the given time.
  260. //! \param format A string that determines the format of the
  261. //! time in (zeit). h=hour, i=minute, s=second. \param
  262. //! zeit A string containing the other time. \return
  263. //! (true) if the stored time is greater than the given
  264. //! time. (false) otherwise.
  265. //! Example: (5:30:00).istLater( "h:i:s", "10:40:29" ); return false
  266. DLLEXPORT bool istLater(const char* format, const char* zeit) const;
  267. //! Checks if the time is greater than the given time.
  268. //! \param format A string that determines the format of the
  269. //! time in (zeit). h=hour, i=minute, s=second. \param
  270. //! zeit A Text object containing the other time.
  271. //! \return (true) if the stored time is greater than the given
  272. //! time. (false) otherwise.
  273. //! Example: (5:30:00).istLater( "h:i:s", "10:40:29" ); return false
  274. DLLEXPORT bool istLater(const char* format, Text* zeit) const;
  275. };
  276. //! This class stores a date in the form of year, month and day
  277. class Datum : public virtual ReferenceCounter
  278. {
  279. private:
  280. int jahr, monat, tag;
  281. int* maxTage;
  282. void update();
  283. public:
  284. //! Creates a new Datum object with the default values 0.0.0.
  285. DLLEXPORT Datum();
  286. //! Deletes the date.
  287. DLLEXPORT ~Datum();
  288. //! Sets the date by copying.
  289. //! \param datum The date to store.
  290. DLLEXPORT void setDatum(Datum* datum);
  291. //! Sets the date to the given values.
  292. //! \param jahr The year of the new date.
  293. //! \param monat The month of the new date.
  294. //! \param tag The day of the new date.
  295. DLLEXPORT void setDatum(int jahr, int monat, int tag);
  296. //! Sets the date to the given value.
  297. //! \param format A string specifying the format of the
  298. //! date in (datum). y=year, m=month, d=day. \param datum
  299. //! A string containing the new date.
  300. //! Example: setDatum( "y-m-d", "2016-01-25" );
  301. DLLEXPORT void setDatum(const char* format, const char* datum);
  302. //! Sets the date to the given value.
  303. //! \param format A string specifying the format of the
  304. //! date in (datum). y=year, m=month, d=day. \param datum
  305. //! A Text object containing the new date.
  306. //! Example: setDatum( "y-m-d", new Text( "2016-01-25" ) );
  307. DLLEXPORT void setDatum(const char* format, Text* datum);
  308. //! Changes the year of the date.
  309. //! \param jahr The new year.
  310. DLLEXPORT void setJahr(int jahr);
  311. //! Changes the month of the date.
  312. //! \param monat The new month.
  313. DLLEXPORT void setMonat(int monat);
  314. //! Changes the day of the date.
  315. //! \param tag The new day.
  316. DLLEXPORT void setTag(int tag);
  317. //! Adds the given date to the current date and stores the result.
  318. //! \param datum The date to add.
  319. //! Example: ( 1.11.1995 ).plusDatum( ( 5.2.7 ) ); new date: 6.1.2003
  320. DLLEXPORT void plusDatum(Datum* datum);
  321. //! Adds the given date to the current date and stores the result.
  322. //! \param jahr The year to add. \param monat The month to add.
  323. //! \param tag The day to add.
  324. //! Example: ( 1.11.1995 ).plusDatum( 7, 2, 5 ); new date: 6.1.2003
  325. DLLEXPORT void plusDatum(int jahr, int monat, int tag);
  326. //! Adds the given date to the current date and stores the result.
  327. //! \param format A string specifying the format of the
  328. //! date in (datum). y=year, m=month, d=day.
  329. //! \param datum A string containing the date to add.
  330. //! Example: ( 1.11.1995 ).plusDatum( "d.m.y", "5.2.7" );
  331. //! new date: 6.1.2003
  332. DLLEXPORT void plusDatum(const char* format, const char* datum);
  333. //! Adds the given date to the current date and stores the result.
  334. //! \param format A string specifying the format of the
  335. //! date in (datum). y=year, m=month, d=day.
  336. //! \param datum A Text object containing the date to add.
  337. //! Example: ( 1.11.1995 ).plusDatum( "d.m.y", new Text(
  338. //! "5.2.7" ) ); new date: 6.1.2003
  339. DLLEXPORT void plusDatum(const char* format, Text* datum);
  340. //! Adds the given year to the current date and stores the result.
  341. //! \param jahr The year to add.
  342. //! Example: ( 1.11.1995 ).plusJahr( 21 ); new date: 1.11.2016
  343. DLLEXPORT void plusJahr(int jahr);
  344. //! Adds the given month to the current date and stores the result.
  345. //! \param monat The month to add.
  346. //! Example: ( 1.11.1995 ).plusMonat( 13 ); new date: 1.12.1996
  347. DLLEXPORT void plusMonat(int monat);
  348. //! Adds the given day to the current date and stores the result.
  349. //! \param tag The day to add.
  350. //! Example: ( 1.1.2000 ).plusTag( 32 ); new date: 2.2.2000
  351. DLLEXPORT void plusTag(int tag);
  352. //! Subtracts the given date from the current date and stores the result.
  353. //! \param datum The date to subtract.
  354. //! Example: ( 2.12.1996 ).minusDatum( ( 1.1.1 ) ); new date: 1.11.1995
  355. DLLEXPORT void minusDatum(Datum* datum);
  356. //! Subtracts the given date from the current date and stores the result.
  357. //! \param jahr The year to subtract. \param monat The month to subtract.
  358. //! \param tag The day to subtract.
  359. //! Example: ( 2.12.1996 ).minusDatum( 1, 1, 1 ); new date: 1.11.1995
  360. DLLEXPORT void minusDatum(int jahr, int monat, int tag);
  361. //! Subtracts the given date from the current date and stores the result.
  362. //! \param format A string specifying the format of the
  363. //! date in (datum). y=year, m=month, d=day.
  364. //! \param datum A string containing the date to subtract.
  365. //! Example: ( 2.12.1996 ).minusDatum( "d.m.y", "1.1.1" );
  366. //! new date: 1.11.1995
  367. DLLEXPORT void minusDatum(const char* format, const char* datum);
  368. //! Subtracts the given date from the current date and stores the result.
  369. //! \param format A string specifying the format of the
  370. //! date in (datum). y=year, m=month, d=day.
  371. //! \param datum A Text object containing the date to subtract.
  372. //! Example: ( 2.12.1996 ).minusDatum( "d.m.y", new Text(
  373. //! "1.1.1" ) ); new date: 1.11.1995
  374. DLLEXPORT void minusDatum(const char* format, Text* datum);
  375. //! Subtracts the given year from the current date and stores the result.
  376. //! \param jahr The year to subtract.
  377. //! Example: ( 1.11.1996 ).minusJahr( 1 ); new date: 1.11.1995
  378. DLLEXPORT void minusJahr(int jahr);
  379. //! Subtracts the given month from the current date and stores the result.
  380. //! \param monat The month to subtract.
  381. //! Example: ( 1.12.1996 ).minusMonat( 13 ); new date: 1.11.1995
  382. DLLEXPORT void minusMonat(int monat);
  383. //! Subtracts the given day from the current date and stores the result.
  384. //! \param tag The day to subtract.
  385. //! Example: ( 5.2.2016 ).minusTag( 11 ); new date: 25.1.2016
  386. DLLEXPORT void minusTag(int tag);
  387. //! Returns the year.
  388. DLLEXPORT int getJahr() const;
  389. //! Returns the month.
  390. DLLEXPORT int getMonat() const;
  391. //! Returns the day.
  392. DLLEXPORT int getTag() const;
  393. //! Returns the date as a Text object.
  394. //! \param format A string specifying the format of the
  395. //! returned date. y=year, m=month, d=day.
  396. //! Example: ( 1.11.1995 ).getDatum( "y-m-d" ); return: "1995-11-1"
  397. DLLEXPORT Text* getDatum(const char* format) const;
  398. //! Checks if the date equals the given date.
  399. //! \param datum The date to check.
  400. //! \return (true) if the given date matches the stored one.
  401. //! (false) otherwise.
  402. DLLEXPORT bool istGleich(Datum* datum) const;
  403. //! Checks if the date equals the given date.
  404. //! \param format A string specifying the format of the
  405. //! date in (datum). y=year, m=month, d=day. \param datum
  406. //! A string containing the date to check. \return
  407. //! (true) if the given date matches the stored one.
  408. //! (false) otherwise.
  409. //! Example: ( 1.11.1995 ).istGleich( "y-m-d", "1995-11-1" ); return: true
  410. DLLEXPORT bool istGleich(const char* format, const char* datum) const;
  411. //! Checks if the date equals the given date.
  412. //! \param format A string specifying the format of the
  413. //! date in (datum). y=year, m=month, d=day. \param datum
  414. //! A Text object containing the date to check.
  415. //! \return (true) if the given date matches the stored one.
  416. //! (false) otherwise.
  417. //! Example: ( 1.11.1995 ).istGleich( "y-m-d", new Text( "1995-11-1" ) ); return: true
  418. DLLEXPORT bool istGleich(const char* format, Text* datum) const;
  419. //! Checks if the date equals the given date.
  420. //! \param jahr The year of the date to check.
  421. //! \param monat The month of the date to check.
  422. //! \param tag The day of the date to check.
  423. //! \return (true) if the given date matches the stored one.
  424. //! (false) otherwise.
  425. //! Example: ( 1.11.1995 ).istGleich( 1995, 11, 1 ); return: true
  426. DLLEXPORT bool istGleich(int jahr, int monat, int tag) const;
  427. //! Checks if the year equals the given year.
  428. //! \param jahr The year to check.
  429. //! \return (true) if the given year matches the stored one.
  430. //! (false) otherwise.
  431. DLLEXPORT bool jahrGleich(int jahr) const;
  432. //! Checks if the month equals the given month.
  433. //! \param monat The month to check.
  434. //! \return (true) if the given month matches the stored one.
  435. //! (false) otherwise.
  436. DLLEXPORT bool monatGleich(int monat) const;
  437. //! Checks if the day equals the given day.
  438. //! \param tag The day to check.
  439. //! \return (true) if the given day matches the stored one.
  440. //! (false) otherwise.
  441. DLLEXPORT bool tagGleich(int tag) const;
  442. //! Checks if the stored date is less than the given one.
  443. //! \param datum The date to check.
  444. //! \return (true) if the stored date is before the given one.
  445. //! (false) otherwise.
  446. //! Example: ( 1.11.1995 ).istKleiner( ( 23.1.2016 ) ); return true
  447. DLLEXPORT bool istKleiner(Datum* datum) const;
  448. //! Checks if the stored date is less than the given one.
  449. //! \param jahr The year of the date to check.
  450. //! \param monat The month of the date to check.
  451. //! \param tag The day of the date to check.
  452. //! \return (true) if the stored date is before the given one.
  453. //! (false) otherwise.
  454. //! Example: ( 1.11.1995 ).istKleiner( 2016, 1, 23 ); return true
  455. DLLEXPORT bool istKleiner(int jahr, int monat, int tag) const;
  456. //! Checks if the stored date is less than the given one.
  457. //! \param format A string specifying the format of the
  458. //! date in (datum). y=year, m=month, d=day. \param datum
  459. //! A string containing the date to check. \return
  460. //! (true) if the stored date is before the given one.
  461. //! (false) otherwise.
  462. //! Example: ( 1.11.1995 ).istKleiner( "y, m, d", "2016, 1, 23" ); return true
  463. DLLEXPORT bool istKleiner(const char* format, const char* datum) const;
  464. //! Checks if the stored date is less than the given one.
  465. //! \param format A string specifying the format of the
  466. //! date in (datum). y=year, m=month, d=day. \param datum
  467. //! A Text object containing the date to check.
  468. //! \return (true) if the stored date is before the given one.
  469. //! (false) otherwise.
  470. //! Example: ( 1.11.1995 ).istKleiner( "y, m, d", new Text( "2016, 1, 23" ) ); return true
  471. DLLEXPORT bool istKleiner(const char* format, Text* datum) const;
  472. //! Checks if the stored date is greater than the given one.
  473. //! \param datum The date to check.
  474. //! \return (true) if the stored date is after the given one.
  475. //! (false) otherwise.
  476. //! Example: ( 1.11.1995 ).istLater( ( 23.1.2016 ) ); return false
  477. DLLEXPORT bool istLater(Datum* datum) const;
  478. //! Checks if the stored date is greater than the given one.
  479. //! \param jahr The year of the date to check.
  480. //! \param monat The month of the date to check.
  481. //! \param tag The day of the date to check.
  482. //! \return (true) if the stored date is after the given one.
  483. //! (false) otherwise.
  484. //! Example: ( 1.11.1995 ).istLater( 2016, 1, 23 ); return false
  485. DLLEXPORT bool istLater(int jahr, int monat, int tag) const;
  486. //! Checks if the stored date is greater than the given one.
  487. //! \param format A string specifying the format of the
  488. //! date in (datum). y=year, m=month, d=day. \param datum
  489. //! A string containing the date to check. \return
  490. //! (true) if the stored date is after the given one.
  491. //! (false) otherwise.
  492. //! Example: ( 1.11.1995 ).istLater( "y, m, d", "2016, 1, 23" ); return false
  493. DLLEXPORT bool istLater(const char* format, const char* datum) const;
  494. //! Checks if the stored date is greater than the given one.
  495. //! \param format A string specifying the format of the
  496. //! date in (datum). y=year, m=month, d=day. \param datum
  497. //! A Text object containing the date to check.
  498. //! \return (true) if the stored date is after the given one.
  499. //! (false) otherwise.
  500. //! Example: ( 1.11.1995 ).istLater( "y, m, d", new Text( "2016, 1, 23" ) ); return true
  501. DLLEXPORT bool istLater(const char* format, Text* datum) const;
  502. };
  503. //! This class combines the Datum and Uhrzeit classes and thus stores
  504. //! a timestamp with year, month, day, hour, minute and second
  505. class Zeit : public virtual ReferenceCounter
  506. {
  507. private:
  508. Datum* datum;
  509. Uhrzeit* uhrzeit;
  510. public:
  511. //! Creates a new Zeit with the default values 0.0.0 0:0:0.
  512. DLLEXPORT Zeit();
  513. //! Creates a new Zeit with the elapsed seconds since 1970.
  514. DLLEXPORT Zeit(__int64 timestamp);
  515. //! Deletes the current object.
  516. DLLEXPORT ~Zeit();
  517. //! Changes the stored time by copying the values from (zeit).
  518. //! \param zeit The new time.
  519. DLLEXPORT void setZeit(Zeit* zeit);
  520. //! Changes the stored time.
  521. //! \param jahr The new year.
  522. //! \param monat The new month.
  523. //! \param tag The new day.
  524. //! \param stunde The new hour.
  525. //! \param minute The new minute.
  526. //! \param sekunde The new second.
  527. DLLEXPORT void setZeit(
  528. int jahr, int monat, int tag, int stunde, int minute, int sekunde);
  529. //! Changes the stored time.
  530. //! \param format A string specifying the format of the new
  531. //! time in (zeit). y=year, m=month, d=day, h=hour,
  532. //! i=minute, s=second. \param zeit A string containing the new
  533. //! time. Example: setZeit( "y-m-d h:i:s", "2016-1-25 21:59:30" );
  534. DLLEXPORT void setZeit(const char* format, const char* zeit);
  535. //! Changes the stored time.
  536. //! \param format A string specifying the format of the new
  537. //! time in (zeit). y=year, m=month, d=day, h=hour,
  538. //! i=minute, s=second. \param zeit A Text object containing the
  539. //! new time. Example: setZeit( "y-m-d h:i:s", new Text(
  540. //! "2016-1-25 21:59:30" ) );
  541. DLLEXPORT void setZeit(const char* format, Text* zeit);
  542. //! Changes the stored year.
  543. //! \param jahr The new year.
  544. DLLEXPORT void setJahr(int jahr);
  545. //! Changes the stored month.
  546. //! \param monat The new month.
  547. DLLEXPORT void setMonat(int monat);
  548. //! Changes the stored day.
  549. //! \param tag The new day.
  550. DLLEXPORT void setTag(int tag);
  551. //! Changes the stored hour.
  552. //! \param stunde The new hour.
  553. DLLEXPORT void setStunde(int stunde);
  554. //! Changes the stored minute.
  555. //! \param minute The new minute.
  556. DLLEXPORT void setMinute(int minute);
  557. //! Changes the stored second.
  558. //! \param sekunde The new second.
  559. DLLEXPORT void setSekunde(int sekunde);
  560. //! Adds the given time and stores the result.
  561. //! \param zeit The time to add.
  562. DLLEXPORT void plusZeit(Zeit* zeit);
  563. //! Adds the given time and stores the result.
  564. //! \param jahr The year to add.
  565. //! \param monat The month to add.
  566. //! \param tag The day to add.
  567. //! \param stunde The hour to add.
  568. //! \param minute The minute to add.
  569. //! \param sekunde The second to add.
  570. DLLEXPORT void plusZeit(
  571. int jahr, int monat, int tag, int stunde, int minute, int sekunde);
  572. //! Adds the given time and stores the result.
  573. //! \param format A string specifying the format of the
  574. //! time in (zeit). y=year, m=month, d=day, h=hour,
  575. //! i=minute, s=second. \param zeit A string containing the
  576. //! time to add.
  577. DLLEXPORT void plusZeit(const char* format, const char* zeit);
  578. //! Adds the given time and stores the result.
  579. //! \param format A string specifying the format of the
  580. //! time in (zeit). y=year, m=month, d=day, h=hour,
  581. //! i=minute, s=second. \param zeit A Text object containing the
  582. //! time to add.
  583. DLLEXPORT void plusZeit(const char* format, Text* zeit);
  584. //! Adds the given time and stores the result.
  585. //! \param jahr The year to add.
  586. DLLEXPORT void plusJahr(int jahr);
  587. //! Adds the given time and stores the result.
  588. //! \param monat The month to add.
  589. DLLEXPORT void plusMonat(int monat);
  590. //! Adds the given time and stores the result.
  591. //! \param tag The day to add.
  592. DLLEXPORT void plusTag(int tag);
  593. //! Adds the given time and stores the result.
  594. //! \param stunde The hour to add.
  595. DLLEXPORT void plusStunde(__int64 stunde);
  596. //! Adds the given time and stores the result.
  597. //! \param minute The minute to add.
  598. DLLEXPORT void plusMinute(__int64 minute);
  599. //! Adds the given time and stores the result.
  600. //! \param sekunde The second to add.
  601. DLLEXPORT void plusSekunde(__int64 sekunde);
  602. //! Subtracts the given time and stores the result.
  603. //! \param zeit The time to subtract.
  604. DLLEXPORT void minusZeit(Zeit* zeit);
  605. //! Subtracts the given time and stores the result.
  606. //! \param jahr The year to subtract.
  607. //! \param monat The month to subtract.
  608. //! \param tag The day to subtract.
  609. //! \param stunde The hour to subtract.
  610. //! \param minute The minute to subtract.
  611. //! \param sekunde The second to subtract.
  612. DLLEXPORT void minusZeit(
  613. int jahr, int monat, int tag, int stunde, int minute, int sekunde);
  614. //! Subtracts the given time and stores the result.
  615. //! \param format A string specifying the format of the
  616. //! time in (zeit). y=year, m=month, d=day, h=hour,
  617. //! i=minute, s=second. \param zeit A string containing the
  618. //! time to subtract.
  619. DLLEXPORT void minusZeit(const char* format, const char* zeit);
  620. //! Subtracts the given time and stores the result.
  621. //! \param format A string specifying the format of the
  622. //! time in (zeit). y=year, m=month, d=day, h=hour,
  623. //! i=minute, s=second. \param zeit A Text object containing the
  624. //! time to subtract.
  625. DLLEXPORT void minusZeit(const char* format, Text* zeit);
  626. //! Subtracts the given time and stores the result.
  627. //! \param jahr The year to subtract.
  628. DLLEXPORT void minusJahr(int jahr);
  629. //! Subtracts the given time and stores the result.
  630. //! \param monat The month to subtract.
  631. DLLEXPORT void minusMonat(int monat);
  632. //! Subtracts the given time and stores the result.
  633. //! \param tag The day to subtract.
  634. DLLEXPORT void minusTag(int tag);
  635. //! Subtracts the given time and stores the result.
  636. //! \param stunde The hour to subtract.
  637. DLLEXPORT void minusStunde(__int64 stunde);
  638. //! Subtracts the given time and stores the result.
  639. //! \param minute The minute to subtract.
  640. DLLEXPORT void minusMinute(__int64 minute);
  641. //! Subtracts the given time and stores the result.
  642. //! \param sekunde The second to subtract.
  643. DLLEXPORT void minusSekunde(__int64 sekunde);
  644. //! Returns the stored time as text.
  645. //! \param format A string specifying the format of the
  646. //! returned time. y=year, m=month, d=day, h=hour,
  647. //! i=minute, s=second.
  648. DLLEXPORT Text* getZeit(const char* format) const;
  649. //! Checks if the time equals the given time.
  650. //! \param zeit The time to check.
  651. //! \return (true) if the times are equal. (false) otherwise.
  652. DLLEXPORT bool istGleich(Zeit* zeit) const;
  653. //! Checks if the time equals the given time.
  654. //! \param format A string specifying the format of the
  655. //! time in (zeit). y=year, m=month, d=day, h=hour,
  656. //! i=minute, s=second. \param zeit A string containing the
  657. //! time to check. \return (true) if the times are equal.
  658. //! (false) otherwise.
  659. DLLEXPORT bool istGleich(const char* format, const char* zeit) const;
  660. //! Checks if the time equals the given time.
  661. //! \param format A string specifying the format of the
  662. //! time in (zeit). y=year, m=month, d=day, h=hour,
  663. //! i=minute, s=second. \param zeit A Text object containing the
  664. //! time to check. \return (true) if the times are equal.
  665. //! (false) otherwise.
  666. DLLEXPORT bool istGleich(const char* format, Text* zeit) const;
  667. //! Checks if the time equals the given time.
  668. //! \param jahr The year to check.
  669. //! \param monat The month to check.
  670. //! \param tag The day to check.
  671. //! \param stunde The hour to check.
  672. //! \param minute The minute to check.
  673. //! \param sekunde The second to check.
  674. //! \return (true) if the times are equal. (false) otherwise.
  675. DLLEXPORT bool istGleich(int jahr,
  676. int monat,
  677. int tag,
  678. int stunde,
  679. int minute,
  680. int sekunde) const;
  681. //! Returns the object storing the date with increased reference counter.
  682. DLLEXPORT Datum* getDatum() const;
  683. //! Returns the object storing the date without increased reference counter.
  684. DLLEXPORT Datum* zDatum() const;
  685. //! Returns the object storing the time of day with increased reference counter.
  686. DLLEXPORT Uhrzeit* getUhrzeit() const;
  687. //! Returns the object storing the time of day without increased reference counter.
  688. DLLEXPORT Uhrzeit* zUhrzeit() const;
  689. //! Checks if the stored time is less than the given time.
  690. //! \param zeit The time to check. \return (true)
  691. //! if the stored time is before the given time. (false)
  692. //! otherwise.
  693. DLLEXPORT bool istKleiner(Zeit* zeit) const;
  694. //! Checks if the stored time is less than the given time.
  695. //! \param jahr The year to check. \param monat The
  696. //! month to check. \param tag The day to check.
  697. //! \param stunde The hour to check. \param minute The
  698. //! minute to check. \param sekunde The second to check.
  699. //! \return (true) if the stored time is before the given time.
  700. //! (false) otherwise.
  701. DLLEXPORT bool istKleiner(int jahr,
  702. int monat,
  703. int tag,
  704. int stunde,
  705. int minute,
  706. int sekunde) const;
  707. //! Checks if the stored time is less than the given time.
  708. //! \param format A string specifying the format of the
  709. //! time in (zeit). y=year, m=month, d=day, h=hour,
  710. //! i=minute, s=second. \param zeit A string containing the
  711. //! time to check. \return (true) if the stored time is before
  712. //! the given time. (false) otherwise.
  713. DLLEXPORT bool istKleiner(const char* format, const char* zeit) const;
  714. //! Checks if the stored time is less than the given time.
  715. //! \param format A string specifying the format of the
  716. //! time in (zeit). y=year, m=month, d=day, h=hour,
  717. //! i=minute, s=second. \param zeit A Text object containing the
  718. //! time to check. \return (true) if the stored time is before
  719. //! the given time. (false) otherwise.
  720. DLLEXPORT bool istKleiner(const char* format, Text* zeit) const;
  721. //! Checks if the stored time is greater than the given time.
  722. //! \param zeit The time to check. \return (true)
  723. //! if the stored time is after the given time. (false)
  724. //! otherwise.
  725. DLLEXPORT bool istLater(Zeit* zeit) const;
  726. //! Checks if the stored time is greater than the given time.
  727. //! \param jahr The year to check. \param monat The
  728. //! month to check. \param tag The day to check.
  729. //! \param stunde The hour to check. \param minute The
  730. //! minute to check. \param sekunde The second to check.
  731. //! \return (true) if the stored time is after the given time.
  732. //! (false) otherwise.
  733. DLLEXPORT bool istLater(int jahr,
  734. int monat,
  735. int tag,
  736. int stunde,
  737. int minute,
  738. int sekunde) const;
  739. //! Checks if the stored time is greater than the given time.
  740. //! \param format A string specifying the format of the
  741. //! time in (zeit). y=year, m=month, d=day, h=hour,
  742. //! i=minute, s=second. \param zeit A string containing the
  743. //! time to check. \return (true) if the stored time is after
  744. //! the given time. (false) otherwise.
  745. DLLEXPORT bool istLater(const char* format, const char* zeit) const;
  746. //! Checks if the stored time is greater than the given time.
  747. //! \param format A string specifying the format of the
  748. //! time in (zeit). y=year, m=month, d=day, h=hour,
  749. //! i=minute, s=second. \param zeit A Text object containing the
  750. //! time to check. \return (true) if the stored time is after
  751. //! the given time. (false) otherwise.
  752. DLLEXPORT bool istLater(const char* format, Text* zeit) const;
  753. };
  754. //! Diese Klasse kann messen, wie viel Zeit zwischen zwei Zeitpunkten
  755. //! verstrichen ist
  756. class ZeitMesser : public virtual ReferenceCounter
  757. {
  758. private:
  759. double start;
  760. double ende;
  761. double messung;
  762. public:
  763. //! Creates a new ZeitMesser object
  764. DLLEXPORT ZeitMesser();
  765. //! Deletes the current object
  766. DLLEXPORT ~ZeitMesser();
  767. //! Sets the start point of the time measurement
  768. DLLEXPORT void messungStart();
  769. //! Sets the end point of the time measurement
  770. DLLEXPORT void messungEnde();
  771. //! Returns the interval between start and end of the measurement
  772. //! in seconds
  773. DLLEXPORT double getSekunden() const;
  774. //! Returns the interval between start and end of the measurement
  775. //! in minutes
  776. DLLEXPORT double getMinuten() const;
  777. //! Returns the interval between start and end of the measurement
  778. //! in hours
  779. DLLEXPORT double getStunden() const;
  780. //! Returns true if a measurement is currently running
  781. DLLEXPORT bool isMeasuring() const;
  782. };
  783. //! Returns the current time of day.
  784. DLLEXPORT Uhrzeit* getUhrzeit();
  785. //! Returns the current date.
  786. DLLEXPORT Datum* getDatum();
  787. //! Returns the current time (date and time of day).
  788. DLLEXPORT Zeit* getZeit();
  789. //! Checks whether jahr is a leap year.
  790. //! \param jahr The year to check.
  791. //! \return (true) if the given year is a leap year. (false) otherwise.
  792. DLLEXPORT bool istSchaltjahr(int jahr);
  793. } // namespace Framework
  794. #endif