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

- Search for |

- File List
- Globals

# rbtz.h

Go to the documentation of this file.

    00001 /*
    00002 *******************************************************************************
    00003 * Copyright (C) 2007-2008, International Business Machines Corporation and    *
    00004 * others. All Rights Reserved.                                                *
    00005 *******************************************************************************
    00006 */
    00007 #ifndef RBTZ_H
    00008 #define RBTZ_H
    00009
    00010 #include "unicode/utypes.h"
    00011
    00017 #if !UCONFIG_NO_FORMATTING
    00018
    00019 #include "unicode/basictz.h"
    00020 #include "unicode/unistr.h"
    00021
    00022 U_NAMESPACE_BEGIN
    00023
    00024 // forward declaration
    00025 class UVector;
    00026 struct Transition;
    00027
    00034 class U_I18N_API RuleBasedTimeZone : public BasicTimeZone {
    00035 public:
    00045     RuleBasedTimeZone(const UnicodeString& id, InitialTimeZoneRule* initialRule);
    00046
    00052     RuleBasedTimeZone(const RuleBasedTimeZone& source);
    00053
    00058     virtual ~RuleBasedTimeZone();
    00059
    00065     RuleBasedTimeZone& operator=(const RuleBasedTimeZone& right);
    00066
    00075     virtual UBool operator==(const TimeZone& that) const;
    00076
    00085     virtual UBool operator!=(const TimeZone& that) const;
    00086
    00102     void addTransitionRule(TimeZoneRule* rule, UErrorCode& status);
    00103
    00113     void complete(UErrorCode& status);
    00114
    00122     virtual TimeZone* clone(void) const;
    00123
    00148     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
    00149                               uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
    00150
    00170     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
    00171                            uint8_t dayOfWeek, int32_t millis,
    00172                            int32_t monthLength, UErrorCode& status) const;
    00173
    00196     virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
    00197                            int32_t& dstOffset, UErrorCode& ec) const;
    00198
    00206     virtual void setRawOffset(int32_t offsetMillis);
    00207
    00215     virtual int32_t getRawOffset(void) const;
    00216
    00223     virtual UBool useDaylightTime(void) const;
    00224
    00238     virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
    00239
    00248     virtual UBool hasSameRules(const TimeZone& other) const;
    00249
    00258     virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
    00259
    00268     virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
    00269
    00278     virtual int32_t countTransitionRules(UErrorCode& status) /*const*/;
    00279
    00296     virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
    00297         const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/;
    00298
    00303     virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
    00304         int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/;
    00305
    00306 private:
    00307     void deleteRules(void);
    00308     void deleteTransitions(void);
    00309     UVector* copyRules(UVector* source);
    00310     TimeZoneRule* findRuleInFinal(UDate date, UBool local,
    00311         int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const;
    00312     UBool findNext(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const;
    00313     UBool findPrev(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const;
    00314     int32_t getLocalDelta(int32_t rawBefore, int32_t dstBefore, int32_t rawAfter, int32_t dstAfter,
    00315         int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const;
    00316     UDate getTransitionTime(Transition* transition, UBool local,
    00317         int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const;
    00318     void getOffsetInternal(UDate date, UBool local, int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt,
    00319         int32_t& rawOffset, int32_t& dstOffset, UErrorCode& ec) const;
    00320
    00321     InitialTimeZoneRule *fInitialRule;
    00322     UVector             *fHistoricRules;
    00323     UVector             *fFinalRules;
    00324     UVector             *fHistoricTransitions;
    00325     UBool               fUpToDate;
    00326
    00327 public:
    00339     static UClassID U_EXPORT2 getStaticClassID(void);
    00340
    00352     virtual UClassID getDynamicClassID(void) const;
    00353 };
    00354
    00355 U_NAMESPACE_END
    00356
    00357 #endif /* #if !UCONFIG_NO_FORMATTING */
    00358
    00359 #endif // RBTZ_H
    00360
    00361 //eof