|
1 /* |
|
2 * Copyright (c) 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: Attribute model constuctor. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CPEngPresenceAttrConstructor.h" |
|
20 #include "CPEngAttrConstructorCon.h" |
|
21 #include "MPEngPresenceAttrConstructorTypeImp.h" |
|
22 |
|
23 #include "CPEngPresenceAttrModel.h" |
|
24 #include "MPEngPresenceAttrModelTypeImp.h" |
|
25 |
|
26 |
|
27 #include <E32Std.h> |
|
28 |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CPEngPresenceAttrConstructor::NewL() |
|
35 // Two-phased constructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CPEngPresenceAttrConstructor* CPEngPresenceAttrConstructor::NewL( |
|
39 CPEngAttrConstructorCon& aContainer, |
|
40 MPEngPresenceAttrConstructorTypeImp& aTypeConstructor, |
|
41 TUint32 aType, |
|
42 TPEngAttributeOriginator aOrigin ) |
|
43 { |
|
44 CPEngPresenceAttrConstructor* self = new ( ELeave ) CPEngPresenceAttrConstructor( |
|
45 aContainer, |
|
46 aTypeConstructor, |
|
47 aType, |
|
48 aOrigin ); |
|
49 return self; |
|
50 } |
|
51 |
|
52 |
|
53 |
|
54 // C++ default constructor can NOT contain any code, that |
|
55 // might leave. |
|
56 // |
|
57 CPEngPresenceAttrConstructor::CPEngPresenceAttrConstructor( |
|
58 CPEngAttrConstructorCon& aContainer, |
|
59 MPEngPresenceAttrConstructorTypeImp& aTypeConstructor, |
|
60 TUint32 aType, |
|
61 TPEngAttributeOriginator aOrigin ) |
|
62 : iType( aType ), |
|
63 iContainer( aContainer ), |
|
64 iTypeConstructor( &aTypeConstructor ), |
|
65 iOrigin( aOrigin ) |
|
66 { |
|
67 } |
|
68 |
|
69 |
|
70 // Destructor |
|
71 CPEngPresenceAttrConstructor::~CPEngPresenceAttrConstructor() |
|
72 { |
|
73 delete iTypeConstructor; |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CPEngPresenceAttrConstructor::NewAttributeInstanceLC() |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 MPEngPresenceAdvancedAttrModel2* CPEngPresenceAttrConstructor::NewAttributeInstanceLC( |
|
82 TBool aUserModel, |
|
83 const TDesC& aPresenceID ) |
|
84 { |
|
85 MPEngPresenceAttrModelTypeImp* typeImp = iTypeConstructor->NewAttributeInstanceLC( aUserModel ); |
|
86 CPEngPresenceAttrModel* model = CPEngPresenceAttrModel::NewL( *this, |
|
87 aPresenceID, |
|
88 typeImp ); |
|
89 CleanupStack::Pop(); //typeImp |
|
90 CleanupStack::PushL( model ); |
|
91 |
|
92 return model; |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CPEngPresenceAttrConstructor::OpenRef() |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CPEngPresenceAttrConstructor::OpenRef() |
|
101 { |
|
102 iContainer.OpenRef(); |
|
103 } |
|
104 |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CPEngPresenceAttrConstructor::CloseRef() |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CPEngPresenceAttrConstructor::CloseRef() |
|
111 { |
|
112 iContainer.CloseRef(); |
|
113 } |
|
114 |
|
115 |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CPEngPresenceAttrConstructor::GetCurrentXmlNames() |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CPEngPresenceAttrConstructor::GetCurrentXmlNames( TPtrC8& aAttributeName, |
|
122 TPtrC8& aAttributeNameSpace ) const |
|
123 { |
|
124 return iTypeConstructor->GetCurrentCspName( aAttributeName, aAttributeNameSpace ); |
|
125 } |
|
126 |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CPEngPresenceAttrConstructor::Type() |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 TUint32 CPEngPresenceAttrConstructor::Type() const |
|
133 { |
|
134 return iType; |
|
135 } |
|
136 |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CPEngPresenceAttrConstructor::Originator() |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 TPEngAttributeOriginator CPEngPresenceAttrConstructor::Originator() const |
|
143 { |
|
144 return iOrigin; |
|
145 } |
|
146 |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CPEngPresenceAttrConstructor::GetProperty() |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TInt CPEngPresenceAttrConstructor::GetProperty( TUint aPropertyName, |
|
153 TUint aPropertyLevel, |
|
154 TInt& aProperty ) const |
|
155 { |
|
156 return iTypeConstructor->GetProperty( aPropertyName, aPropertyLevel, aProperty ); |
|
157 } |
|
158 |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CPEngPresenceAttrConstructor::GetProperty() |
|
162 // ----------------------------------------------------------------------------- |
|
163 // |
|
164 TInt CPEngPresenceAttrConstructor::GetProperty( TUint aPropertyName, |
|
165 TUint aPropertyLevel, |
|
166 TDes8& aProperty ) const |
|
167 { |
|
168 return iTypeConstructor->GetProperty( aPropertyName, aPropertyLevel, aProperty ); |
|
169 } |
|
170 |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CPEngPresenceAttrConstructor::GetProperty() |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 TInt CPEngPresenceAttrConstructor::GetPropertyPtr( TUint aPropertyName, |
|
177 TUint aPropertyLevel, |
|
178 TPtrC16& aProperty ) const |
|
179 { |
|
180 return iTypeConstructor->GetPropertyPtr( aPropertyName, aPropertyLevel, aProperty ); |
|
181 } |
|
182 |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CPEngPresenceAttrConstructor::Extension() |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 MPEngPresenceAttrTypePropertiesExt2* CPEngPresenceAttrConstructor::Extension() |
|
189 { |
|
190 return NULL; |
|
191 } |
|
192 |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CPEngPresenceAttrConstructor::TypeExtension() |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 TAny* CPEngPresenceAttrConstructor::TypeExtension( TUint32 aType ) |
|
199 { |
|
200 return iTypeConstructor->TypeExtension( aType ); |
|
201 } |
|
202 |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CPEngPresenceAttrConstructor::__DbgPanicL() |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 void CPEngPresenceAttrConstructor::__DbgPanicL( TPEngAttributeConstructorPanics aReason, |
|
209 TInt aLeaveCode ) const |
|
210 |
|
211 { |
|
212 #if defined(_DEBUG) |
|
213 User::Panic( KPEngAttributeConstructorPanicCategory, aReason ); |
|
214 #else |
|
215 User::Leave( aLeaveCode ); |
|
216 #endif |
|
217 |
|
218 // suppress the unreferenced variable warnings |
|
219 ( void ) aReason; |
|
220 ( void ) aLeaveCode; |
|
221 } |
|
222 |
|
223 |
|
224 // End of File |
|
225 |