rbtz.h

Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 * Copyright (C) 2007, 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 
00027 class U_I18N_API RuleBasedTimeZone : public BasicTimeZone {
00028 public:
00038     RuleBasedTimeZone(const UnicodeString& id, InitialTimeZoneRule* initialRule);
00039 
00045     RuleBasedTimeZone(const RuleBasedTimeZone& source);
00046 
00051     virtual ~RuleBasedTimeZone();
00052 
00058     RuleBasedTimeZone& operator=(const RuleBasedTimeZone& right);
00059 
00068     virtual UBool operator==(const TimeZone& that) const;
00069 
00078     virtual UBool operator!=(const TimeZone& that) const;
00079 
00095     void addTransitionRule(TimeZoneRule* rule, UErrorCode& status);
00096 
00106     void complete(UErrorCode& status);
00107 
00115     virtual TimeZone* clone(void) const;
00116 
00141     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00142                               uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
00143 
00163     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00164                            uint8_t dayOfWeek, int32_t millis,
00165                            int32_t monthLength, UErrorCode& status) const;
00166 
00189     virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
00190                            int32_t& dstOffset, UErrorCode& ec) const;
00191 
00199     virtual void setRawOffset(int32_t offsetMillis);
00200 
00208     virtual int32_t getRawOffset(void) const;
00209 
00216     virtual UBool useDaylightTime(void) const;
00217 
00231     virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
00232 
00241     virtual UBool hasSameRules(const TimeZone& other) const;
00242 
00251     virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
00252 
00261     virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
00262 
00271     virtual int32_t countTransitionRules(UErrorCode& status) /*const*/;
00272 
00289     virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
00290         const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/;
00291 
00292 private:
00293     void deleteRules(void);
00294     void deleteTransitions(void);
00295     UVector* copyRules(UVector* source);
00296     TimeZoneRule* findRuleInFinal(UDate date, UBool local) const;
00297     UBool findNext(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const;
00298     UBool findPrev(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const;
00299 
00300     InitialTimeZoneRule *fInitialRule;
00301     UVector             *fHistoricRules;
00302     UVector             *fFinalRules;
00303     UVector             *fHistoricTransitions;
00304     UBool               fUpToDate;
00305 
00306 public:
00318     static UClassID U_EXPORT2 getStaticClassID(void);
00319 
00331     virtual UClassID getDynamicClassID(void) const;
00332 };
00333 
00334 U_NAMESPACE_END
00335 
00336 #endif /* #if !UCONFIG_NO_FORMATTING */
00337 
00338 #endif // RBTZ_H
00339 
00340 //eof

Generated on Fri Jan 25 08:31:02 2008 for ICU 3.8 by  doxygen 1.5.4