1.1 --- a/epoc32/include/vtzrules.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,187 +0,0 @@
1.4 -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __VTZRULES_H__
1.20 -#define __VTZRULES_H__
1.21 -
1.22 -#include <e32base.h>
1.23 -#include <s32strm.h>
1.24 -#include <tzdefines.h>
1.25 -#include <tz.h>
1.26 -
1.27 -class CVTzActualisedRules;
1.28 -class TVTzActualisedRule;
1.29 -
1.30 -const TInt KVTzRulesGranularity = 4;
1.31 -
1.32 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1.33 - * Time zone rules
1.34 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1.35 -
1.36 -/**
1.37 -Encapsulates one time zone rule.
1.38 -
1.39 -@publishedAll
1.40 -@released
1.41 -*/
1.42 -class TTzRule
1.43 - {
1.44 -public:
1.45 - IMPORT_C TTzRule(TInt16 aFromYear, TInt16 aToYear, TInt16 aOldOffset, TInt16 aNewOffset, TMonth aMonth, TTzRuleDay aDayRule,
1.46 - TUint8 aDayOfMonth, TUint8 aDayOfWeek, TTzTimeReference aTimeReference, TUint16 aTimeOfChange);
1.47 - IMPORT_C TTzRule();
1.48 - IMPORT_C TTzRule(const TTzRule& aRule);
1.49 - IMPORT_C TTzRule(TTimeWithReference aFromYear, TTimeWithReference aToYear, TInt16 aOldOffset, TInt16 aNewOffset, TMonth aMonth, TTzRuleDay aDayRule,
1.50 - TUint8 aDayOfMonth, TUint8 aDayOfWeek, TTzTimeReference aTimeReference, TUint16 aTimeOfChange);
1.51 -
1.52 -
1.53 - void ExternalizeL(RWriteStream& aStream) const;
1.54 - void InternalizeL(RReadStream& aStream);
1.55 - TBool RuleApplies(const TTime& aStart, const TTime& aEnd) const;
1.56 -
1.57 - IMPORT_C TVTzActualisedRule Actualise(TInt aYear) const; // deprecated, replace by the L version
1.58 - IMPORT_C TVTzActualisedRule ActualiseL(TInt aYear) const;
1.59 -
1.60 -public:
1.61 - TTimeWithReference iFrom; // first date the rule applies
1.62 - TTimeWithReference iTo; // last date the rule applies
1.63 - TInt16 iOldLocalTimeOffset; // local time offset (in minutes) BEFORE the change (local time = UTC + DST)
1.64 - TInt16 iNewLocalTimeOffset; // local time offset (in minutes) AFTER the change
1.65 - TMonth iMonth;
1.66 - TTzRuleDay iDayRule; // format in which the rule is expressed
1.67 - TUint8 iDayOfMonth;
1.68 - TUint8 iDayOfWeek;
1.69 - TTzTimeReference iTimeReference;
1.70 - TUint16 iTimeOfChange; // number of minutes since midnight
1.71 - TUint32 iReserved;
1.72 - };
1.73 -
1.74 -
1.75 -
1.76 -/**
1.77 -Encapsulates a collection of time zone rules, and includes the period covered by the rules
1.78 -and the standard time offset at the start of that period.
1.79 -
1.80 -@publishedAll
1.81 -@released
1.82 -*/
1.83 -class CTzRules : public CBase
1.84 - {
1.85 -public:
1.86 - IMPORT_C static CTzRules* NewL();
1.87 - IMPORT_C static CTzRules* NewL(TInt aStartYear, TInt aEndYear);
1.88 - IMPORT_C static CTzRules* NewL(RReadStream& aStream);
1.89 - IMPORT_C ~CTzRules();
1.90 - IMPORT_C TBool RulesApply(const TTime& aTime) const;
1.91 - IMPORT_C void AddRuleL(TTzRule aRule);
1.92 - IMPORT_C void RemoveRule(TInt aIndex);
1.93 - IMPORT_C TTzRule& operator[](TInt aIndex);
1.94 - IMPORT_C TInt Count() const;
1.95 - IMPORT_C TInt StartYear() const;
1.96 - IMPORT_C TInt EndYear() const;
1.97 - IMPORT_C void SetStartYear(TInt aYear);
1.98 - IMPORT_C void SetEndYear(TInt aYear);
1.99 - IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.100 - IMPORT_C void InternalizeL(RReadStream& aStream);
1.101 - IMPORT_C TInt InitialStdTimeOffset() const;
1.102 - IMPORT_C void SetInitialStdTimeOffset(TInt aOffset);
1.103 - IMPORT_C void ConvertToUtcL(TTime& aLocalTime) const;
1.104 - IMPORT_C void ConvertToLocalL(TTime& aUtcTime) const;
1.105 - IMPORT_C CTzRules* CloneL() const;
1.106 - IMPORT_C TBool IsEqualTo(const CTzRules& aRules) const;
1.107 -
1.108 - IMPORT_C void GetActualisedRulesL(CVTzActualisedRules& aActRules) const;
1.109 - IMPORT_C TInt ConvertTime(CVTzActualisedRules& aRules, TTime& aTime, TTzTimeReference aTimerRef) const;
1.110 -
1.111 -private:
1.112 - CTzRules();
1.113 - CTzRules(TInt aStartYear, TInt aEndYear);
1.114 - void GetActualisedRulesL(CVTzActualisedRules& aActRules, TInt aYear) const;
1.115 - TInt GetOffsetL(const TTime& aTime, TTzTimeReference aTimeRef) const;
1.116 - TInt AddActualisedRulesL(CVTzActualisedRules& aActRules, TInt aYear) const;
1.117 - TInt CompareTimesWithRef(TTime aTimeA, TTzTimeReference aTimeARef,
1.118 - TTime aTimeB, TTzTimeReference aTimeBRef, TInt aStdOffset, TInt aWallOffset,
1.119 - TTimeIntervalMinutes* aMinutesDifference) const;
1.120 -
1.121 -private:
1.122 - TInt16 iStartYear;
1.123 - TInt16 iEndYear;
1.124 - RArray<TTzRule> iRules;
1.125 - TInt iInitialStdTimeOffset;
1.126 - };
1.127 -
1.128 -
1.129 -
1.130 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1.131 - * Actualised time zone rules
1.132 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1.133 -
1.134 -/**
1.135 -Encapsulates a local time change.
1.136 -
1.137 -@publishedAll
1.138 -@released
1.139 -*/
1.140 -class TVTzActualisedRule
1.141 - {
1.142 -public:
1.143 - IMPORT_C TVTzActualisedRule(TTime aTimeOfChange, TInt aNewOffset, TTzTimeReference aTimeReference);
1.144 - IMPORT_C TVTzActualisedRule();
1.145 -
1.146 - IMPORT_C void operator=(TVTzActualisedRule aRule);
1.147 - static TInt Order(const TVTzActualisedRule& aLeft, const TVTzActualisedRule& aRight);
1.148 -
1.149 -public:
1.150 - TTime iTimeOfChange;
1.151 - TInt32 iNewOffset;
1.152 - TTzTimeReference iTimeReference;
1.153 - };
1.154 -
1.155 -
1.156 -/**
1.157 -Encapsulates a collection of the local time changes occurring during a range of years.
1.158 -
1.159 -@publishedAll
1.160 -@released
1.161 -*/
1.162 -NONSHARABLE_CLASS(CVTzActualisedRules) : public CBase
1.163 - {
1.164 -public:
1.165 - IMPORT_C static CVTzActualisedRules* NewL(TInt aStartYear, TInt aEndYear);
1.166 - IMPORT_C ~CVTzActualisedRules();
1.167 - IMPORT_C void AddRuleL(const TVTzActualisedRule& aRule);
1.168 - IMPORT_C TInt Count() const;
1.169 - IMPORT_C TVTzActualisedRule& operator[](TInt aIndex) const;
1.170 -
1.171 - IMPORT_C TInt StartYear() const;
1.172 - IMPORT_C TInt EndYear() const;
1.173 -
1.174 - IMPORT_C TBool IsDaylightSavingOn(TTime& aTime) const;
1.175 - IMPORT_C TInt GetOffsetFromRuleL(const TTime& aTime, TTzTimeReference aTimeRef) const;
1.176 -
1.177 -private:
1.178 - CVTzActualisedRules(TInt aStartYear, TInt aEndYear);
1.179 - CVTzActualisedRules();
1.180 - TInt CompareTimesWithRef(TTime aRolloverTime, TTzTimeReference aTimeRefRollover,
1.181 - TTime aUserTime, TTzTimeReference aTimeRefUser,
1.182 - TInt aOldWallOffset, TTimeIntervalMinutes& aDiffMinutes) const;
1.183 -
1.184 -private:
1.185 - TInt32 iStartYear; // years covered by
1.186 - TInt32 iEndYear; // the actualised rules
1.187 - RArray<TVTzActualisedRule> iRules;
1.188 - };
1.189 -
1.190 -#endif