iDateTime.h
Go to the documentation of this file.
00001 /*
00002 imagen - Simple object-oriented imaging library
00003 Copyright (C) 2011-2012 Mark D. Procarione
00004 
00005 imagen is free software: you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation, either
00008 version 3 of the License, or (at your option) any later version.
00009 
00010 imagen is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014 */
00015 
00016 #ifndef __IDATETIME_H__
00017 #define __IDATETIME_H__
00018 
00019 #include "imagen.h"
00020 
00021 namespace imagen
00022 {
00024 
00029     class iDateTime
00030     {
00031         public:
00033 
00035             iDateTime();
00036 
00038             iDateTime( const iDateTime &dt ) { *this = dt; }
00039 
00041             void update();
00042 
00044 
00051             void set( Iuint y, Iuint m, Iuint d, Iuint h, Iuint mn, Iuint s, Iuint ms )
00052                     { yr = y; mon = m; dy = d; hr = h; min = mn; sec = s; misec = ms; }
00053 
00055             Iuint year() const { return yr; }
00056 
00058             Iuint month() const { return mon; }
00059 
00061             Iuint day() const { return dy; }
00062 
00064             Iuint hour() const { return hr; }
00065 
00067             Iuint minute() const { return min; }
00068 
00070             Iuint second() const { return sec; }
00071 
00073             Iuint millisec() const { return misec; }
00074 
00076             void setYear( Iuint y ) { yr = y; }
00077 
00079             void setMonth( Iuint m ) { mon = m; }
00080 
00082             void setDay( Iuint d ) { dy = d; }
00083 
00085             void setHour( Iuint h ) { hr = h; }
00086 
00088             void setMinute( Iuint m ) { min = m; }
00089 
00091             void setSecond( Iuint s ) { sec = s; }
00092 
00094             void setMillisec( Iuint ms ) { misec = ms; }
00095 
00096             iDateTime &operator=( const iDateTime &dt )
00097             {
00098                 yr = dt.yr; mon = dt.mon; dy = dt.dy; hr = dt.hr;
00099                 min = dt.min; sec = dt.sec; misec = dt.misec; return *this;
00100             }
00101 
00102         private:
00103             Iuint yr, mon, dy, hr, min, sec, misec;
00104     };
00105 
00107 
00108     class iJobTime
00109     {
00110         public:
00112             iJobTime() : hr(0), min(0), sec(0) {}
00113 
00115             iJobTime( const iJobTime &jt ) { *this = jt; }
00116 
00118 
00121             void set( short h, short m, short s  )
00122                     { hr = h; min = m; sec = s; }
00123 
00125             short hours() const { return hr; }
00126 
00128             short minutes() const { return min; }
00129 
00131             short seconds() const { return sec; }
00132 
00134             void setHours( short h ) { hr = h; }
00135 
00137             void setMinutes( short m ) { min = m; }
00138 
00140             void setSeconds( short s ) { sec = s; }
00141 
00142             iJobTime &operator=( const iJobTime &jt )
00143             {
00144                 hr = jt.hr; min = jt.min; sec = jt.sec;
00145                 return *this;
00146             }
00147 
00148         private:
00149             short hr, min, sec;
00150     };
00151 }
00152 
00153 #endif // __IDATETIME_H__