VCardDateValue.h
00001 /* 00002 libvcard - vCard parsing library for vCard version 3.0 00003 00004 Copyright (C) 1999 Rik Hemsley rik@kde.org 00005 00006 Permission is hereby granted, free of charge, to any person obtaining a copy 00007 of this software and associated documentation files (the "Software"), to 00008 deal in the Software without restriction, including without limitation the 00009 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 00010 sell copies of the Software, and to permit persons to whom the Software is 00011 furnished to do so, subject to the following conditions: 00012 00013 The above copyright notice and this permission notice shall be included in 00014 all copies or substantial portions of the Software. 00015 00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00020 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00021 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 */ 00023 00024 #ifndef DATEVALUE_H 00025 #define DATEVALUE_H 00026 00027 #include <tqcstring.h> 00028 #include <tqdatetime.h> 00029 00030 #include <VCardValue.h> 00031 00032 namespace VCARD 00033 { 00034 00035 class KVCARD_EXPORT DateValue : public Value 00036 { 00037 public: 00038 DateValue(); 00039 DateValue(const DateValue&); 00040 DateValue(const TQCString&); 00041 DateValue & operator = (DateValue&); 00042 DateValue & operator = (const TQCString&); 00043 bool operator ==(DateValue&); 00044 bool operator !=(DateValue& x) {return !(*this==x);} 00045 bool operator ==(const TQCString& s) {DateValue a(s);return(*this==a);} 00046 bool operator != (const TQCString& s) {return !(*this == s);} 00047 00048 virtual ~DateValue(); 00049 void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} 00050 00051 void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} 00052 00053 void _parse(); 00054 void _assemble(); 00055 const char * className() const { return "DateValue"; } 00056 00057 DateValue( 00058 unsigned int year, 00059 unsigned int month, 00060 unsigned int day, 00061 unsigned int hour = 0, 00062 unsigned int minute = 0, 00063 unsigned int second = 0, 00064 double secFrac = 0, 00065 bool zonePositive = true, 00066 unsigned int zoneHour = 0, 00067 unsigned int zoneMinute = 0); 00068 00069 DateValue(const TQDate &); 00070 DateValue(const TQDateTime &); 00071 00072 DateValue *clone(); 00073 00074 bool hasTime(); 00075 00076 unsigned int year(); 00077 unsigned int month(); 00078 unsigned int day(); 00079 unsigned int hour(); 00080 unsigned int minute(); 00081 unsigned int second(); 00082 double secondFraction(); 00083 bool zonePositive(); 00084 unsigned int zoneHour(); 00085 unsigned int zoneMinute(); 00086 00087 void setYear (unsigned int); 00088 void setMonth (unsigned int); 00089 void setDay (unsigned int); 00090 void setHour (unsigned int); 00091 void setMinute (unsigned int); 00092 void setSecond (unsigned int); 00093 void setSecondFraction (double); 00094 void setZonePositive (bool); 00095 void setZoneHour (unsigned int); 00096 void setZoneMinute (unsigned int); 00097 00098 TQDate qdate(); 00099 TQTime qtime(); 00100 TQDateTime qdt(); 00101 00102 private: 00103 00104 unsigned int year_, month_, day_, 00105 hour_, minute_, second_, 00106 zoneHour_, zoneMinute_; 00107 00108 double secFrac_; 00109 00110 bool zonePositive_; 00111 00112 bool hasTime_; 00113 }; 00114 00115 } 00116 00117 #endif