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

00001 /*
00002  * Copyright (C) 2003-2007 Funambol, Inc
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 version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 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 Tue Oct 30 15:11:25 2007 for Funambol C++ Client Library by  doxygen 1.5.2