Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/home/groups/n/no/noxwizard/cvs/src/gamedate.h

Go to the documentation of this file.
00001   /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
00002     || NoX-Wizard UO Server Emulator (NXW) [http://noxwizard.sourceforge.net]  ||
00003     ||                                                                         ||
00004     || This software is free software released under GPL2 license.             ||
00005     || You can find detailed license information in nox-wizard.cpp file.       ||
00006     ||                                                                         ||
00007     || For any question post to NoX-Wizard forums.                             ||
00008     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
00009 
00010 #ifndef __CGAMEDATE__
00011 #define __CGAMEDATE__
00012 
00013 class cGameDate
00014 {
00015         enum eDateFormat
00016         {
00017                 YMD,
00018                 DMY
00019         };
00020 
00021         private:
00022                 static  char            dateSeparator;
00023                 static  char            timeSeparator;
00024                 static  char            dateTimeSeparator;
00025                 static  eDateFormat     dateFormat;
00026         public:
00027                 static  char            getDateSeparator();
00028                 static  void            setDateSeparator( char separator );
00029                 static  char            getTimeSeparator();
00030                 static  void            setTimeSeparator( char separator );
00031                 static  char            getDateTimeSeparator();
00032                 static  void            setDateTimeSeparator( char separator );
00033         public:
00034                                         cGameDate();
00035                                         cGameDate( const cGameDate &copy );
00036                                         ~cGameDate();
00037         private:
00038                 UI16                    year;
00039                 UI08                    month;
00040                 UI08                    day;
00041                 UI08                    hour;
00042                 UI08                    minute;
00043         public:
00044                 UI16                    getYear();
00045                 UI08                    getMonth();
00046                 UI08                    getDay();
00047                 UI08                    getHour();
00048                 UI08                    getMinute();
00049                 void                    setYear( UI16 newYear );
00050                 void                    setMonth( UI08 newMonth );
00051                 void                    setDay( UI08 newDay );
00052                 void                    setHour( UI08 newHour );
00053                 void                    setMinute( UI08 newMinute );
00054                 std::string             toDateString();
00055                 std::string             toDateString( eDateFormat format );
00056                 std::string             toTimeString();
00057                 std::string             toString();
00058                 std::string             toString( eDateFormat format );
00059                 void                    fromString( const std::string& arg );
00060                 void                    fromString( const std::string& arg, eDateFormat format );
00061         private:
00062                 void                    setDefaultDate();
00063                 void                    setDefaultYear();
00064                 void                    setDefaultMonth();
00065                 void                    setDefaultDay();
00066                 void                    setDefaultTime();
00067                 void                    setDefaultHour();
00068                 void                    setDefaultMinute();
00069 };
00070 
00071 #endif
SourceForge.net Logo