src/include/common/base/util/BasicTime.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 #ifndef INCL_BASIC_TIME
00019     #define INCL_BASIC_TIME
00020 
00022 #include "base/fscapi.h"
00023 #include "base/util/ArrayElement.h"
00024 
00025 class BasicTime : public ArrayElement {
00026 
00027     // ------------------------------------------------------- Private data
00028     private:
00029        
00030         int year;       
00031         int month;      // 1 - 12
00032         int day;        // 1 - 31
00033         int weekday;    // 0 - 7  (Sunday is 0 or 7)
00034         int hour;       // 0 - 23
00035         int min;        // 0 - 59
00036         int sec;        // 0 - 59
00037 
00038         int tzHour;
00039         int tzMin;
00040 
00041     public:
00042 
00043     // ------------------------------------------------------- Constructors
00044     BasicTime();
00045 
00046     // ---------------------------------------------------------- Accessors
00047     int getYear() const { return year; }
00048     void setYear(int v) { year=v; }
00049 
00050     int getMonth() const { return month; }
00051     void setMonth(int v) { month=v; }
00052 
00053     int getDay() const { return day; }
00054     void setDay(int v) { day=v; }
00055 
00056     int getWeekday() const { return weekday; }
00057     void setWeekday(int v) { weekday=v; }
00058 
00059     int getHour() const { return hour; }
00060     void setHour(int v) { hour=v; }
00061 
00062     int getMin() const { return min; }
00063     void setMin(int v) { min=v; }
00064 
00065     int getSec() const { return sec; }
00066     void setSec(int v) { sec=v; }
00067 
00068     int getTzHour() const { return tzHour; }
00069     void setTzHour(int v) { tzHour=v; }
00070 
00071     int getTzMin() const { return tzMin; }
00072     void setTzMin(int v) { tzMin=v; }
00073 
00074     // ----------------------------------------------------- Public Methods
00075 
00076     int set(int yy, int mon, int dd, int wd,
00077             int hh, int mm, int ss, int tzh, int tzm);
00078             
00079     int parseRfc822(const char *date);
00080     char *formatRfc822() const ;
00081     bool isADate(const char* date);
00082     ArrayElement *clone();
00083 
00084     BasicTime& operator=(const BasicTime& d);
00085     bool operator==(const BasicTime& d) const;
00086     bool operator!=(const BasicTime& d) const { return !(*this == d); }
00087 
00088 
00089 };
00091 #endif

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2