- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# vtzone.h

Go to the documentation of this file.

    00001 /*
    00002 *******************************************************************************
    00003 * Copyright (C) 2007-2009, International Business Machines Corporation and         *
    00004 * others. All Rights Reserved.                                                *
    00005 *******************************************************************************
    00006 */
    00007 #ifndef VTZONE_H
    00008 #define VTZONE_H
    00009
    00010 #include "unicode/utypes.h"
    00011
    00017 #if !UCONFIG_NO_FORMATTING
    00018
    00019 #include "unicode/basictz.h"
    00020
    00021 U_NAMESPACE_BEGIN
    00022
    00023 class VTZWriter;
    00024 class VTZReader;
    00025 class UVector;
    00026
    00039 class U_I18N_API VTimeZone : public BasicTimeZone {
    00040 public:
    00046     VTimeZone(const VTimeZone& source);
    00047
    00052     virtual ~VTimeZone();
    00053
    00059     VTimeZone& operator=(const VTimeZone& right);
    00060
    00069     virtual UBool operator==(const TimeZone& that) const;
    00070
    00079     virtual UBool operator!=(const TimeZone& that) const;
    00080
    00088     static VTimeZone* createVTimeZoneByID(const UnicodeString& ID);
    00089
    00099     static VTimeZone* createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status);
    00100
    00109     UBool getTZURL(UnicodeString& url) const;
    00110
    00116     void setTZURL(const UnicodeString& url);
    00117
    00126     UBool getLastModified(UDate& lastModified) const;
    00127
    00133     void setLastModified(UDate lastModified);
    00134
    00141     void write(UnicodeString& result, UErrorCode& status) const;
    00142
    00151     void write(UDate start, UnicodeString& result, UErrorCode& status) /*const*/;
    00152
    00166     void writeSimple(UDate time, UnicodeString& result, UErrorCode& status) /*const*/;
    00167
    00174     virtual TimeZone* clone(void) const;
    00175
    00200     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
    00201                               uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
    00202
    00222     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
    00223                            uint8_t dayOfWeek, int32_t millis,
    00224                            int32_t monthLength, UErrorCode& status) const;
    00225
    00248     virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
    00249                            int32_t& dstOffset, UErrorCode& ec) const;
    00250
    00258     virtual void setRawOffset(int32_t offsetMillis);
    00259
    00267     virtual int32_t getRawOffset(void) const;
    00268
    00275     virtual UBool useDaylightTime(void) const;
    00276
    00290     virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
    00291
    00300     virtual UBool hasSameRules(const TimeZone& other) const;
    00301
    00310     virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
    00311
    00320     virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
    00321
    00330     virtual int32_t countTransitionRules(UErrorCode& status) /*const*/;
    00331
    00348     virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
    00349         const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/;
    00350
    00351 private:
    00352     enum { DEFAULT_VTIMEZONE_LINES = 100 };
    00353
    00357     VTimeZone();
    00358     static VTimeZone* createVTimeZone(VTZReader* reader);
    00359     void write(VTZWriter& writer, UErrorCode& status) const;
    00360     void write(UDate start, VTZWriter& writer, UErrorCode& status) /*const*/;
    00361     void writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) /*const*/;
    00362     void load(VTZReader& reader, UErrorCode& status);
    00363     void parse(UErrorCode& status);
    00364
    00365     void writeZone(VTZWriter& w, BasicTimeZone& basictz, UVector* customProps,
    00366         UErrorCode& status) const;
    00367
    00368     void writeHeaders(VTZWriter& w, UErrorCode& status) const;
    00369     void writeFooter(VTZWriter& writer, UErrorCode& status) const;
    00370
    00371     void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
    00372                               int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE,
    00373                               UErrorCode& status) const;
    00374     void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
    00375                              int32_t fromOffset, int32_t toOffset,
    00376                              int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime,
    00377                              UErrorCode& status) const;
    00378     void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
    00379                              int32_t fromOffset, int32_t toOffset,
    00380                              int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
    00381                              UDate startTime, UDate untilTime, UErrorCode& status) const;
    00382     void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
    00383                                      int32_t fromOffset, int32_t toOffset,
    00384                                      int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
    00385                                      UDate startTime, UDate untilTime, UErrorCode& status) const;
    00386     void writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int32_t dayOfMonth,
    00387                                          int32_t dayOfWeek, int32_t numDays,
    00388                                          UDate untilTime, int32_t fromOffset, UErrorCode& status) const;
    00389     void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
    00390                                      int32_t fromOffset, int32_t toOffset,
    00391                                      int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
    00392                                      UDate startTime, UDate untilTime, UErrorCode& status) const;
    00393     void writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRule* rule,
    00394                         int32_t fromRawOffset, int32_t fromDSTSavings,
    00395                         UDate startTime, UErrorCode& status) const;
    00396
    00397     void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
    00398                         int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const;
    00399     void endZoneProps(VTZWriter& writer, UBool isDst, UErrorCode& status) const;
    00400     void beginRRULE(VTZWriter& writer, int32_t month, UErrorCode& status) const;
    00401     void appendUNTIL(VTZWriter& writer, const UnicodeString& until, UErrorCode& status) const;
    00402
    00403     BasicTimeZone   *tz;
    00404     UVector         *vtzlines;
    00405     UnicodeString   tzurl;
    00406     UDate           lastmod;
    00407     UnicodeString   olsonzid;
    00408     UnicodeString   icutzver;
    00409
    00410 public:
    00422     static UClassID U_EXPORT2 getStaticClassID(void);
    00423
    00435     virtual UClassID getDynamicClassID(void) const;
    00436 };
    00437
    00438 U_NAMESPACE_END
    00439
    00440 #endif /* #if !UCONFIG_NO_FORMATTING */
    00441
    00442 #endif // VTZONE_H
    00443 //eof

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines