Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef __JAUS_CORE_DATE__H
00042 #define __JAUS_CORE_DATE__H
00043
00044 #include <cxutils/time.h>
00045 #include "jaus/core/types.h"
00046
00047 namespace JAUS
00048 {
00055 class JAUS_CORE_DLL Date
00056 {
00057 public:
00058 Date() : mYear(0), mMonth(0), mDay(0) {}
00059 Date(const Date& d) { *this = d; }
00060 ~Date() {}
00073 UShort ToUShort() const
00074 {
00075 UShort dstamp = 0;
00076
00077 dstamp |= (mYear - 2000) << 9;
00078 dstamp |= mMonth << 5;
00079 dstamp |= mDay;
00080
00081 return dstamp;
00082 }
00095 inline Date& FromUShort(const UShort dstamp)
00096 {
00097 mDay = (dstamp & 0x001F);
00098 mMonth = (dstamp & 0x01E0) >> 5;
00099 mYear = ((dstamp & 0xFE00) >> 9) + 2000;
00100 return *this;
00101 }
00107 inline Date& operator=(const Date& date)
00108 {
00109 mYear = date.mYear;
00110 mMonth = date.mMonth;
00111 mDay = date.mDay;
00112 return *this;
00113 }
00114 UShort mYear;
00115 UShort mMonth;
00116 UShort mDay;
00117 };
00118 }
00119
00120 #endif
00121