#include <OSGDate.h>
Public Member Functions | |
Constructors | |
| * | Date (void) |
| Date (const Date &obj) | |
Destructors | |
| *virtual | ~Date (void) |
Access | |
| *void | setSecond (UInt32 second) |
| UInt32 | getSecond (void) |
| void | setMinute (UInt32 minute) |
| UInt32 | getMinute (void) |
| void | setHour (UInt32 hour) |
| UInt32 | getHour (void) |
| void | setDay (UInt32 day) |
| UInt32 | getDay (void) |
| void | setYear (Int32 year) |
| Int32 | getYear (void) |
| void | clear (void) |
| void | setSystemDate (void) |
| void | set (const Char8 *stringP) |
| bool | isLeapYear (void) |
| bool | valid (void) |
| void | set (UInt32 day, UInt32 month, Int32 year, UInt32 hour=0, UInt32 minute=0, UInt32 second=0) |
Operators | |
| *bool | operator== (const Date &other) |
| bool | operator!= (const Date &other) |
| bool | operator< (const Date &other) |
Private Attributes | |
| UInt32 | _second |
| UInt32 | _minute |
| UInt32 | _hour |
| UInt32 | _day |
| UInt32 | _month |
| UInt32 | _year |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Date &obj) |
| std::istream & | operator>> (std::istream &is, Date &obj) |
Definition at line 55 of file OSGDate.h.
|
|
Definition at line 49 of file OSGDate.cpp. 00049 : 00050 _second(0), 00051 _minute(0), 00052 _hour (0), 00053 _day (0), 00054 _month (0), 00055 _year (0) 00056 { 00057 }
|
|
|
Definition at line 60 of file OSGDate.cpp. 00060 : 00061 _second(obj._second), 00062 _minute(obj._minute), 00063 _hour (obj._hour ), 00064 _day (obj._day ), 00065 _month (obj._month ), 00066 _year (obj._year ) 00067 { 00068 }
|
|
|
Definition at line 71 of file OSGDate.cpp.
|
|
|
Definition at line 48 of file OSGDate.inl. References _second. 00049 { 00050 _second = second; 00051 }
|
|
|
Definition at line 55 of file OSGDate.inl. References _second. 00056 { 00057 return _second; 00058 }
|
|
|
Definition at line 62 of file OSGDate.inl. References _minute. 00063 { 00064 _minute = minute; 00065 }
|
|
|
Definition at line 69 of file OSGDate.inl. References _minute. 00070 { 00071 return _minute; 00072 }
|
|
|
Definition at line 76 of file OSGDate.inl. References _hour. 00077 { 00078 _hour = hour; 00079 }
|
|
|
Definition at line 83 of file OSGDate.inl. References _hour. 00084 { 00085 return _hour; 00086 }
|
|
|
Definition at line 90 of file OSGDate.inl. References _day. 00091 { 00092 _day = day; 00093 }
|
|
|
Definition at line 97 of file OSGDate.inl. References _day. 00098 { 00099 return _day; 00100 }
|
|
|
Definition at line 105 of file OSGDate.inl. References _year. 00106 { 00107 _year = year; 00108 }
|
|
|
Definition at line 112 of file OSGDate.inl. References _year. 00113 { 00114 return _year; 00115 }
|
|
|
|
|
|
Definition at line 76 of file OSGDate.cpp. References _day, _hour, _minute, _month, _second, and _year. 00077 { 00078 time_t clock; 00079 struct tm *tm_time; 00080 00081 time(&clock); 00082 00083 tm_time = localtime(&clock); 00084 00085 _second = tm_time->tm_sec; 00086 _minute = tm_time->tm_min; 00087 _hour = tm_time->tm_hour; 00088 _day = tm_time->tm_mday; 00089 _month = tm_time->tm_mon + 1; 00090 _year = tm_time->tm_year + 1900; 00091 }
|
|
|
Definition at line 94 of file OSGDate.cpp. 00095 { 00096 if(stringP != NULL&& *stringP != '\0') 00097 { 00098 // istrstream is(string); 00099 // is >> *this; 00100 } 00101 }
|
|
|
Definition at line 104 of file OSGDate.cpp. References _year. Referenced by valid(). 00105 { 00106 if(_year & 3) 00107 { 00108 return false; 00109 } 00110 00111 if((_year % 100) || !(_year % 400)) 00112 { 00113 return true; 00114 } 00115 00116 return false; 00117 }
|
|
|
Definition at line 120 of file OSGDate.cpp. References _day, _hour, _minute, _month, _second, and isLeapYear(). 00121 { 00122 static const UInt32 daysPerMonth[12] = 00123 { 00124 31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31 00125 }; 00126 00127 if((_hour > 23) || (_minute > 59) || (_second > 59)) 00128 { 00129 return false; 00130 } 00131 00132 if((_month < 1) || (_day < 1) || (_month > 12)) 00133 { 00134 return false; 00135 } 00136 00137 if(_day <= daysPerMonth[_month - 1]) 00138 { 00139 return true; 00140 } 00141 00142 if((_month == 2) && (_day == 29)) 00143 { 00144 return isLeapYear(); 00145 } 00146 00147 return false; 00148 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 151 of file OSGDate.cpp. References _day, _hour, _minute, _month, _second, and _year. 00157 { 00158 _day = day; 00159 _month = month; 00160 _year = year; 00161 _hour = hour; 00162 _minute = minute; 00163 _second = sec; 00164 }
|
|
|
Definition at line 167 of file OSGDate.cpp. References _day, _hour, _minute, _month, _second, and _year. 00168 { 00169 return ((_day == other._day ) && 00170 (_month == other._month ) && 00171 (_year == other._year ) && 00172 (_hour == other._hour ) && 00173 (_minute == other._minute) && 00174 (_second == other._second) ); 00175 }
|
|
|
Definition at line 119 of file OSGDate.inl.
|
|
|
Definition at line 178 of file OSGDate.cpp. References _day, _hour, _minute, _month, _second, and _year. 00179 { 00180 if(_year < other._year) 00181 return true; 00182 00183 if(_year > other._year) 00184 return false; 00185 00186 // _year == other._year 00187 00188 if(_month < other._month) 00189 return true; 00190 00191 if(_month > other._month) 00192 return false; 00193 00194 // _month == other._month 00195 00196 if(_day < other._day) 00197 return true; 00198 if(_day > other._day) 00199 return false; 00200 00201 // _day == other._day 00202 00203 if(_hour < other._hour) 00204 return true; 00205 if(_hour > other._hour) 00206 return false; 00207 00208 // _hour == other._hour 00209 00210 if(_minute < other._minute) 00211 return true; 00212 if(_minute > other._minute) 00213 return false; 00214 00215 // _minute == other._minute 00216 00217 if(_second < other._second) 00218 return true; 00219 00220 return false; 00221 }
|
|
||||||||||||
|
Definition at line 224 of file OSGDate.cpp. 00225 { 00226 return outStream << std::setfill('0') 00227 << std::setw(2) << obj._day << '.' 00228 << std::setw(2) << obj._month << '.' 00229 << obj._year << ' ' 00230 << std::setw(2) << obj._hour << ':' 00231 << std::setw(2) << obj._minute << ':' 00232 << std::setw(2) << obj._second; 00233 }
|
|
||||||||||||
|
Definition at line 236 of file OSGDate.cpp. 00237 { 00238 Char8 c; 00239 00240 return inStream >> obj._day >> c >> obj._month >> c >> obj._year 00241 >> obj._hour >> c >> obj._minute >> c >> obj._second; 00242 }
|
|
|
Definition at line 123 of file OSGDate.h. Referenced by getSecond(), operator<(), osg::operator<<(), operator==(), osg::operator>>(), set(), setSecond(), setSystemDate(), and valid(). |
|
|
Definition at line 124 of file OSGDate.h. Referenced by getMinute(), operator<(), osg::operator<<(), operator==(), osg::operator>>(), set(), setMinute(), setSystemDate(), and valid(). |
|
|
Definition at line 125 of file OSGDate.h. Referenced by getHour(), operator<(), osg::operator<<(), operator==(), osg::operator>>(), set(), setHour(), setSystemDate(), and valid(). |
|
|
Definition at line 126 of file OSGDate.h. Referenced by getDay(), operator<(), osg::operator<<(), operator==(), osg::operator>>(), set(), setDay(), setSystemDate(), and valid(). |
|
|
Definition at line 127 of file OSGDate.h. Referenced by operator<(), osg::operator<<(), operator==(), osg::operator>>(), set(), setSystemDate(), and valid(). |
|
|
Definition at line 128 of file OSGDate.h. Referenced by getYear(), isLeapYear(), operator<(), osg::operator<<(), operator==(), osg::operator>>(), set(), setSystemDate(), and setYear(). |
1.4.3