|
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 CICalComponent. It defines various ICAL components for calendar events. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Class include. |
|
21 #include "ICalComponent.h" // CICalComponent |
|
22 |
|
23 //debug |
|
24 #include "calendarengines_debug.h" |
|
25 |
|
26 // User includes |
|
27 #include "ICalAlarm.h" // CICalAlarm |
|
28 #include "ICalEvent.h" // CICalEvent |
|
29 #include "ICalFreeBusy.h" // CICalFreeBusy |
|
30 #include "ICalJournal.h" // CICalJournal |
|
31 #include "ICalKeyWords.h" // Literals |
|
32 #include "ICalTimeZone.h" // CICalTimeZone |
|
33 #include "ICalTimeZoneInterval.h" // CICalTimeZoneInterval |
|
34 #include "ICalTodo.h" // CICalTodo |
|
35 |
|
36 /** |
|
37 Destructor |
|
38 @internalTechnology |
|
39 */ |
|
40 CICalComponent::~CICalComponent() |
|
41 { |
|
42 TRACE_ENTRY_POINT; |
|
43 TRACE_EXIT_POINT; |
|
44 } |
|
45 |
|
46 /** |
|
47 Factory function for creating new components of the type indicated by the aName |
|
48 argument. |
|
49 @param aName The type of component to create |
|
50 @return The new component. |
|
51 @leave Leaves with KErrCorrupt if the requested component is unknown. |
|
52 @publishedPartner |
|
53 */ |
|
54 EXPORT_C CICalComponent* CICalComponent::CreateICalComponentL(const TDesC& aName, TICalMethod aMethod) |
|
55 { |
|
56 TRACE_ENTRY_POINT; |
|
57 |
|
58 CICalComponent* self = CreateICalComponentLC(aName, aMethod); |
|
59 CleanupStack::Pop(self); |
|
60 |
|
61 TRACE_EXIT_POINT; |
|
62 return self; |
|
63 } |
|
64 |
|
65 /** |
|
66 Factory function for creating new components of the type indicated by the aName |
|
67 argument. Pushes the new component onto the Cleanup Stack. |
|
68 @param aName The type of component to create. |
|
69 @return The new component. |
|
70 @leave Leaves with KErrCorrupt if the requested component is unknown. |
|
71 @publishedPartner |
|
72 */ |
|
73 EXPORT_C CICalComponent* CICalComponent::CreateICalComponentLC(const TDesC& aName, TICalMethod aMethod) |
|
74 { |
|
75 TRACE_ENTRY_POINT; |
|
76 |
|
77 CICalComponent* self = NULL; |
|
78 |
|
79 if (aName.CompareF(KICalEvent) == 0) |
|
80 { |
|
81 self = CICalEvent::NewLC(aMethod); |
|
82 } |
|
83 else if (aName.CompareF(KICalTodo) == 0) |
|
84 { |
|
85 self = CICalTodo::NewLC(aMethod); |
|
86 } |
|
87 else if (aName.CompareF(KICalJournal) == 0) |
|
88 { |
|
89 self = CICalJournal::NewLC(aMethod); |
|
90 } |
|
91 else if (aName.CompareF(KICalAlarm) == 0) |
|
92 { |
|
93 self = CICalAlarm::NewLC(aMethod); |
|
94 } |
|
95 else if (aName.CompareF(KICalTimeZone) == 0) |
|
96 { |
|
97 self = CICalTimeZone::NewLC(aMethod); |
|
98 } |
|
99 else if (aName.CompareF(KICalFreeBusy) == 0) |
|
100 { |
|
101 self = CICalFreeBusy::NewLC(aMethod); |
|
102 } |
|
103 else if (aName.CompareF(KICalStandard) == 0) |
|
104 { |
|
105 self = CICalTimeZoneInterval::NewLC(EICalStandard, aMethod); |
|
106 } |
|
107 else if (aName.CompareF(KICalDaylight) == 0) |
|
108 { |
|
109 self = CICalTimeZoneInterval::NewLC(EICalDaylight, aMethod); |
|
110 } |
|
111 else |
|
112 { |
|
113 User::Leave(KErrCorrupt); |
|
114 } |
|
115 |
|
116 TRACE_EXIT_POINT; |
|
117 return self; |
|
118 } |
|
119 |
|
120 /** |
|
121 Factory function for creating new components of the type indicated by the aType |
|
122 argument. |
|
123 @param aType The type of component to create. |
|
124 @return The new component. |
|
125 @leave Leaves with KErrCorrupt if the requested component is unknown. |
|
126 @publishedPartner |
|
127 */ |
|
128 EXPORT_C CICalComponent* CICalComponent::CreateICalComponentL(CICalBase::TICalComponentType aType, TICalMethod aMethod) |
|
129 { |
|
130 TRACE_ENTRY_POINT; |
|
131 |
|
132 CICalComponent* self = CreateICalComponentLC(aType, aMethod); |
|
133 CleanupStack::Pop(self); |
|
134 |
|
135 TRACE_EXIT_POINT; |
|
136 return self; |
|
137 } |
|
138 |
|
139 /** |
|
140 Factory function for creating new components of the type indicated by the aType |
|
141 argument. Pushes the new component onto the cleanup stack. |
|
142 @param aType The type of component to create. |
|
143 @return The new component. |
|
144 @leave Leaves with KErrCorrupt if the requested component is unknown. |
|
145 @publishedPartner |
|
146 */ |
|
147 EXPORT_C CICalComponent* CICalComponent::CreateICalComponentLC(CICalBase::TICalComponentType aType, TICalMethod aMethod) |
|
148 { |
|
149 TRACE_ENTRY_POINT; |
|
150 |
|
151 CICalComponent* self = NULL; |
|
152 |
|
153 switch (aType) |
|
154 { |
|
155 case EICalEvent: |
|
156 self = CICalEvent::NewLC(aMethod); |
|
157 break; |
|
158 case EICalTodo: |
|
159 self = CICalTodo::NewLC(aMethod); |
|
160 break; |
|
161 case EICalJournal: |
|
162 self = CICalJournal::NewLC(aMethod); |
|
163 break; |
|
164 case EICalAlarm: |
|
165 self = CICalAlarm::NewLC(aMethod); |
|
166 break; |
|
167 case EICalFreeBusy: |
|
168 self = CICalFreeBusy::NewLC(aMethod); |
|
169 break; |
|
170 case EICalTimeZone: |
|
171 self = CICalTimeZone::NewLC(aMethod); |
|
172 break; |
|
173 case EICalStandard: |
|
174 self = CICalTimeZoneInterval::NewLC(EICalStandard, aMethod); |
|
175 break; |
|
176 case EICalDaylight: |
|
177 self = CICalTimeZoneInterval::NewLC(EICalDaylight, aMethod); |
|
178 break; |
|
179 default: |
|
180 User::Leave(KErrCorrupt); |
|
181 break; |
|
182 } |
|
183 |
|
184 TRACE_EXIT_POINT; |
|
185 return self; |
|
186 } |
|
187 |
|
188 /** |
|
189 Constructor. |
|
190 @internalTechnology |
|
191 */ |
|
192 CICalComponent::CICalComponent() |
|
193 { |
|
194 TRACE_ENTRY_POINT; |
|
195 TRACE_EXIT_POINT; |
|
196 } |
|
197 |
|
198 // End of File |