Date.h

Go to the documentation of this file.
00001 /*
00002  * $Id: Date.h 562 2007-12-02 08:04:16Z mindstorm2600 $
00003  *
00004  * X-VR2 
00005  * 
00006  * Copyright (C) Juan V. Guerrero 2007
00007  * 
00008  * Juan V. Guerrero <mindstorm2600@users.sourceforge.net>
00009  * 
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License Version 2. See the LICENSE file
00012  * at the top of the source tree.
00013  */
00014 #ifndef __XVR2_DATE_H__
00015 #define __XVR2_DATE_H__
00016 #include<xvr2/System.h>
00017 #include<sys/types.h>
00018 #include<xvr2/String.h>
00019 #include<xvr2/CoreExceptions.h>
00020 
00021 namespace xvr2{
00022         
00026         class Date:public System{
00027                 protected:
00029                         time_t unixtime;
00032                         //String drep;
00033                         void setTStamp(UInt32 tstamp);
00034                         void decode(const char *format, const char *date_text);
00035                         virtual void encode();
00036                         std::string *string_representation;
00037                 public:
00038                         enum DateAMPM{
00039                                 AM,
00040                                 PM
00041                         };
00042                         enum DateARITHParts{
00043                                 DAYS,
00044                                 HOURS,
00045                                 MINUTES,
00046                                 SECONDS
00047                         };
00049                         int hour;
00051                         int hr12hour;
00053                         int minute;
00055                         int second;
00057                         int dayofweek;
00059                         int dayofyear;
00061                         int dayofmonth;
00063                         int month;
00065                         int year;
00067                         int hr12ampm;
00068 
00070                         Date();
00074                         Date(UInt32 __unixtime);
00084                         Date(int __y, int __m, int __dw, int __dm, int __h, int __mi, int __s = 0);
00093                         Date(const char *format, const char *date_text);
00102                         Date(const String &format, const String &date_text);
00103                         Date(const Date &d);
00104                         Date(const Date *d);
00105                         virtual ~Date();
00106                         Date &operator=(const Date &_d);
00108                         virtual time_t getCurrentTime();
00109                         
00112                         const UInt32 unixTime();
00113                         const UInt32 unixTime() const;
00118                         virtual std::string toString();
00119                         virtual void add(DateARITHParts component, int value);
00120                         static Date Now();
00121         };
00122 
00123 }
00124 
00125 
00126 #endif

Generated on Fri Jun 20 22:55:47 2008 for X-VR2 SDK by  doxygen 1.5.5