|
1 /* |
|
2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements the definition of CICalTimeZoneInterval. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Class include. |
|
21 #include "ICalTimeZoneInterval.h" // CICalTimeZoneInterval |
|
22 |
|
23 //debug |
|
24 #include "calendarengines_debug.h" |
|
25 |
|
26 // User includes. |
|
27 #include "ICalKeyWords.h" // Literals |
|
28 |
|
29 /** |
|
30 Static factory construction |
|
31 @param aType The type of time zone interval. |
|
32 @return A new timezone interval component |
|
33 @leave Leaves with KErrCorrupt if the requested component is invalid. |
|
34 @internalTechnology |
|
35 */ |
|
36 CICalTimeZoneInterval* CICalTimeZoneInterval::NewLC(TICalComponentType aType, TICalMethod aMethod) |
|
37 { |
|
38 TRACE_ENTRY_POINT; |
|
39 |
|
40 if ((aType != EICalDaylight) && (aType != EICalStandard)) |
|
41 { |
|
42 User::Leave(KErrCorrupt); |
|
43 } |
|
44 |
|
45 CICalTimeZoneInterval* self = new (ELeave) CICalTimeZoneInterval(aType); |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL(aMethod); |
|
48 |
|
49 TRACE_EXIT_POINT; |
|
50 return self; |
|
51 } |
|
52 |
|
53 /** |
|
54 Destructor |
|
55 @internalTechnology |
|
56 */ |
|
57 CICalTimeZoneInterval::~CICalTimeZoneInterval() |
|
58 { |
|
59 TRACE_ENTRY_POINT; |
|
60 TRACE_EXIT_POINT; |
|
61 } |
|
62 |
|
63 /** |
|
64 Constructor |
|
65 @param aType The type of time zone interval. |
|
66 @internalTechnology |
|
67 */ |
|
68 CICalTimeZoneInterval::CICalTimeZoneInterval(TICalComponentType aType) |
|
69 { |
|
70 TRACE_ENTRY_POINT; |
|
71 |
|
72 iComponentType = aType; |
|
73 |
|
74 TRACE_EXIT_POINT; |
|
75 } |
|
76 |
|
77 /** |
|
78 Internal construction |
|
79 @internalTechnology |
|
80 */ |
|
81 void CICalTimeZoneInterval::ConstructL(TICalMethod aMethod) |
|
82 { |
|
83 TRACE_ENTRY_POINT; |
|
84 |
|
85 iMethod = aMethod; |
|
86 iComponentMethodBitMask = EMaskTimezoneIntervalAny; |
|
87 |
|
88 TRACE_EXIT_POINT; |
|
89 } |
|
90 |
|
91 /** |
|
92 Checks that the iCalendar specification allows this calendar component to |
|
93 contain the property aName. |
|
94 @param aName the name of the property to validate. |
|
95 @return ETrue if the property is valid for this component, otherwise EFalse |
|
96 @internalTechnology |
|
97 */ |
|
98 TBool CICalTimeZoneInterval::ValidatePropertyImpl(const TDesC& aName) const |
|
99 { |
|
100 TRACE_ENTRY_POINT; |
|
101 |
|
102 if ((aName.CompareF(KICalDtstart) == 0) || (aName.CompareF(KICalTzoffsetto) == 0) || |
|
103 (aName.CompareF(KICalTzoffsetfrom) == 0) || (aName.CompareF(KICalComment) == 0) || |
|
104 (aName.CompareF(KICalRdate) == 0) || (aName.CompareF(KICalRRule) == 0) || |
|
105 (aName.CompareF(KICalTzname) == 0)) |
|
106 { |
|
107 // 1 dtstart / tzoffsetto / tzoffsetfrom |
|
108 // 0..1 comment / rdate / rrule / tzname |
|
109 TRACE_EXIT_POINT; |
|
110 return (FindProperty(aName) == NULL); |
|
111 } |
|
112 |
|
113 if ((aName.Length() >= 2) && (aName.Left(2).CompareF(KICalXProperty) == 0)) |
|
114 { |
|
115 // 0..* X-[anything] |
|
116 TRACE_EXIT_POINT; |
|
117 return ETrue; |
|
118 } |
|
119 |
|
120 // If we got this far we didn't match any of the possible property names |
|
121 TRACE_EXIT_POINT; |
|
122 return EFalse; |
|
123 } |
|
124 |
|
125 /** |
|
126 Checks that the iCalendar specification allows this calendar component to |
|
127 contain a nested component of type aType. |
|
128 @param aType the type of component to validate. |
|
129 @return ETrue if the component is a valid child for this component, otherwise |
|
130 EFalse. |
|
131 @internalTechnology |
|
132 */ |
|
133 TBool CICalTimeZoneInterval::ValidateComponent(TICalComponentType /*aType*/) const |
|
134 { |
|
135 TRACE_ENTRY_POINT; |
|
136 TRACE_EXIT_POINT; |
|
137 // DAYLIGHT or STANDARD components cannot contain other components. |
|
138 return EFalse; |
|
139 } |
|
140 |
|
141 // End of file |
|
142 |
|
143 |