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