Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

simpletz.h

This is the verbatim text of the simpletz.h include file.
/*
* Copyright © {1997-1999}, International Business Machines Corporation and others. All Rights Reserved.
*                                                                              *
********************************************************************************
*
* File SIMPLETZ.H
*
* Modification History:
*
*   Date        Name        Description
*   04/21/97    aliu        Overhauled header.
*    08/10/98    stephen        JDK 1.2 sync
*                            Added setStartRule() / setEndRule() overloads
*                            Added hasSameRules()
*    09/02/98    stephen        Added getOffset(monthLen)
*                            Changed getOffset() to take UErrorCode
*    07/09/99    stephen     Removed millisPerHour (unused, for HP compiler)
*   12/02/99    aliu        Added TimeMode and constructor and setStart/EndRule
*                           methods that take TimeMode. Added to docs.
********************************************************************************
*/

#ifndef SIMPLETZ_H
#define SIMPLETZ_H

#include "unicode/timezone.h"

struct StandardZone;
struct DSTZone;
class TimeZone;

class U_I18N_API SimpleTimeZone: public TimeZone {
public:

    enum TimeMode {
        WALL_TIME = 0,
        STANDARD_TIME,
        UTC_TIME
    };

    SimpleTimeZone(const SimpleTimeZone& source);

    SimpleTimeZone& operator=(const SimpleTimeZone& right);

    virtual ~SimpleTimeZone();

    virtual UBool operator==(const TimeZone& that) const;

    SimpleTimeZone(int32_t rawOffset, const UnicodeString& ID);

    SimpleTimeZone(int32_t rawOffset, const UnicodeString& ID,
        int8_t startMonth, int8_t startDayOfWeekInMonth,
        int8_t startDayOfWeek, int32_t startTime,
        int8_t endMonth, int8_t endDayOfWeekInMonth,
        int8_t endDayOfWeek, int32_t endTime,
        UErrorCode& status);

    SimpleTimeZone(int32_t rawOffset, const UnicodeString& ID,
        int8_t startMonth, int8_t startDayOfWeekInMonth,
        int8_t startDayOfWeek, int32_t startTime,
        int8_t endMonth, int8_t endDayOfWeekInMonth,
        int8_t endDayOfWeek, int32_t endTime,
        int32_t dstSavings, UErrorCode& status);

    SimpleTimeZone(int32_t rawOffset, const UnicodeString& ID,
        int8_t startMonth, int8_t startDayOfWeekInMonth,
        int8_t startDayOfWeek, int32_t startTime, TimeMode startTimeMode,
        int8_t endMonth, int8_t endDayOfWeekInMonth,
        int8_t endDayOfWeek, int32_t endTime, TimeMode endTimeMode,
        int32_t dstSavings, UErrorCode& status);

    void setStartYear(int32_t year);

    void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
                      int32_t time, UErrorCode& status);

    void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
                      int32_t time, TimeMode mode, UErrorCode& status);

    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time, 
                      UErrorCode& status);

    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time, 
                      TimeMode mode, UErrorCode& status);

    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, 
                      int32_t time, UBool after, UErrorCode& status);

    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, 
                      int32_t time, TimeMode mode, UBool after, UErrorCode& status);

    void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
                    int32_t time, UErrorCode& status);

    void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
                    int32_t time, TimeMode mode, UErrorCode& status);

    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode& status);

    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time,
                    TimeMode mode, UErrorCode& status);

    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, 
                    int32_t time, UBool after, UErrorCode& status);

    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, 
                    int32_t time, TimeMode mode, UBool after, UErrorCode& status);

    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
                              uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;

    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
                              uint8_t dayOfWeek, int32_t millis) const;

    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
                           uint8_t dayOfWeek, int32_t milliseconds, 
                           int32_t monthLength, UErrorCode& status) const;

    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
                              uint8_t dayOfWeek, int32_t milliseconds, 
                              int32_t monthLength, int32_t prevMonthLength,
                              UErrorCode& status) const;

    virtual int32_t getRawOffset(void) const;

    virtual void setRawOffset(int32_t offsetMillis);

    void setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status);

    void setDSTSavings(int32_t millisSavedDuringDST);

    int32_t getDSTSavings(void) const;

    virtual UBool useDaylightTime(void) const;

    virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;

    UBool hasSameRules(const TimeZone& other) const;

    virtual TimeZone* clone(void) const;

public:

    virtual UClassID getDynamicClassID(void) const { return (UClassID)&fgClassID; }

    static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }

private:
    enum EMode
    {
        DOM_MODE = 1,
        DOW_IN_MONTH_MODE,
        DOW_GE_DOM_MODE,
        DOW_LE_DOM_MODE
    };

    friend class TimeZone; // for access to these 2 constructors:

    SimpleTimeZone(const StandardZone& stdZone, const UnicodeString& id);
    SimpleTimeZone(const DSTZone& dstZone, const UnicodeString& id);

    void construct(int32_t rawOffset, const UnicodeString& ID,
                   int8_t startMonth, int8_t startDay, int8_t startDayOfWeek,
                   int32_t startTime, TimeMode startTimeMode,
                   int8_t endMonth, int8_t endDay, int8_t endDayOfWeek,
                   int32_t endTime, TimeMode endTimeMode,
                   int32_t dstSavings, UErrorCode& status);

    static int32_t compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen,
                                 int8_t dayOfMonth,
                                 int8_t dayOfWeek, int32_t millis, int32_t millisDelta,
                                 EMode ruleMode, int8_t ruleMonth, int8_t ruleDayOfWeek,
                                 int8_t ruleDay, int32_t ruleMillis);

    void decodeRules(UErrorCode& status);
    void decodeStartRule(UErrorCode& status);
    void decodeEndRule(UErrorCode& status);

    static char     fgClassID;

    int8_t startMonth, startDay, startDayOfWeek;   // the month, day, DOW, and time DST starts
    int32_t startTime;
    TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode
    int8_t endMonth, endDay, endDayOfWeek; // the month, day, DOW, and time DST ends
    int32_t endTime;
    int32_t startYear;  // the year these DST rules took effect
    int32_t rawOffset;  // the TimeZone's raw GMT offset
    UBool useDaylight; // flag indicating whether this TimeZone uses DST
    static const int8_t staticMonthLength[12]; // lengths of the months
    EMode startMode, endMode;   // flags indicating what kind of rules the DST rules are

    int32_t dstSavings;
};

inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth,
                                         int32_t dayOfWeek,
                                         int32_t time, UErrorCode& status) {
    setStartRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
}

inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
                                         int32_t time, 
                                         UErrorCode& status) {
    setStartRule(month, dayOfMonth, time, WALL_TIME, status);
}

inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
                                         int32_t dayOfWeek, 
                                         int32_t time, UBool after, UErrorCode& status) {
    setStartRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
}

inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth,
                                       int32_t dayOfWeek,
                                       int32_t time, UErrorCode& status) {
    setEndRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
}

inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth,
                                       int32_t time, UErrorCode& status) {
    setEndRule(month, dayOfMonth, time, WALL_TIME, status);
}

inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, 
                                       int32_t time, UBool after, UErrorCode& status) {
    setEndRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
}

#endif // _SIMPLETZ

Generated at Wed Aug 16 16:05:50 2000 for ICU1.6 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999