|
1 /* |
|
2 * Copyright (c) 2006 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: RLS and Presence XDM, This class represents Presence Transform |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __PRESENCETRANSFORMXDM_H__ |
|
22 #define __PRESENCETRANSFORMXDM_H__ |
|
23 |
|
24 // Includes |
|
25 #include <e32std.h> |
|
26 #include <e32base.h> |
|
27 #include <rlspresxdmconsts.h> |
|
28 |
|
29 // Forward declarations |
|
30 class CXdmDocumentNode; |
|
31 class CPresenceXDM; |
|
32 |
|
33 // Class declaration |
|
34 /** |
|
35 * This class should be used in conjunction with an already created CPresenceXDM. |
|
36 * The CPresenceXDM deals with the Presence rules as a whole and has communication |
|
37 * with the server. |
|
38 * TPresenceTransformXDM is used to manipulate the Transformation part of a rule. |
|
39 * Remember to call Init function after constructing this object. |
|
40 * |
|
41 * Here the Presence transforms are classified into three categories according to |
|
42 * their xml data types. These three categories are: complex transforms types, |
|
43 * boolean transform types and other transform types. |
|
44 * Refer to RLSPresXDMConsts.h to find transforms and their categories. |
|
45 * Constants from rlspresxdmconsts.h may be used for transform names. |
|
46 * |
|
47 * @lib rlspresxdm.lib |
|
48 * @since S60 3.2 |
|
49 */ |
|
50 class TPresenceTransformXDM |
|
51 { |
|
52 public: |
|
53 |
|
54 /** |
|
55 * C++ Constructor, After contructing Init must be called before using |
|
56 * this object. |
|
57 */ |
|
58 IMPORT_C TPresenceTransformXDM(); |
|
59 |
|
60 /** |
|
61 * Initializes the object with the given pointer to CPresenceXDM. |
|
62 * This function must be called before using other functions. |
|
63 * |
|
64 * @param CPresenceXDM* pointer to created CPresenceXDM |
|
65 */ |
|
66 IMPORT_C void Init(CPresenceXDM* const aPresXDM); |
|
67 |
|
68 /** |
|
69 * Adds transform's complex child element to a rule |
|
70 * |
|
71 * @param TDesC& aRuleID rule ID |
|
72 * @param TDesC& aComplexChild, The childtype of transform. Currently there are |
|
73 * following complex transforms possible: provide-persons, provide-devices, |
|
74 * provide-services. Use the constants from rlspresxdmconsts.h |
|
75 * @param RArray<TTransDataCompo>& aTypeAndValues Type and values for complex child. |
|
76 * The all-devices, all-persons and all-services can not be used in this |
|
77 * function, use AddOrRepProvideAllTransComplex for those. Remember that this |
|
78 * function will delete above provide-all nodes if they found in this child. |
|
79 * Constants from rlspresxdmconsts.h may be used for transform names. |
|
80 * @return TInt KErrNone, KErrNotFound if rule doesnt found, |
|
81 * KErrArgument if invalid child element or its arguments |
|
82 */ |
|
83 IMPORT_C TInt AddTransComplexL(const TDesC& aRuleID, |
|
84 const TDesC& aComplexChild, |
|
85 const RArray<TTransDataCompo>& aTypeAndValues); |
|
86 |
|
87 /** |
|
88 * Adds or replace transform's complex child provide-all element to a rule |
|
89 * |
|
90 * @param TDesC& aRuleID rule ID |
|
91 * @param TDesC& aComplexChild, The childtype of transform. Currently there are |
|
92 * following complex transforms possible: provide-persons, provide-devices, |
|
93 * provide-services. Additionally this function can also be used for |
|
94 * provide-all-attributes. |
|
95 * Depending on the complex child this function will |
|
96 * replace the existing complex child with all-devices, all-persons or |
|
97 * all-services. Constants from rlspresxdmconsts.h may be used for |
|
98 * transform names. |
|
99 * @return TInt KErrNone, KErrNotFound if rule doesnt found, |
|
100 * KErrArgument if invalid child element |
|
101 */ |
|
102 IMPORT_C TInt AddOrRepProvideAllTransComplexL(const TDesC& aRuleID, |
|
103 const TDesC& aComplexChild); |
|
104 |
|
105 /** |
|
106 * Gets transform's complex child element from a rule |
|
107 * |
|
108 * @param TDesC& aRuleID rule ID |
|
109 * @param TDesC& aComplexChild, The childtype of transform. Currently there are |
|
110 * following complex transforms possible: provide-persons, provide-devices, |
|
111 * provide-services. Use the constants from rlspresxdmconsts.h |
|
112 * @param RArray<TTransDataCompo>& aTypeAndValues Type and values for complex child. |
|
113 * Constants from rlspresxdmconsts.h may be used for transform names. |
|
114 * @return TInt KErrNone, KErrNotFound if rule or transform not found, |
|
115 * KErrArgument if invalid child element. |
|
116 */ |
|
117 IMPORT_C TInt GetTransComplexL(const TDesC& aRuleID, |
|
118 const TDesC& aComplexChild, |
|
119 RArray<TTransDataCompo>& aTypeAndValues); |
|
120 |
|
121 /** |
|
122 * Adds or replace transform's boolean child element to a rule |
|
123 * |
|
124 * @param TDesC& aRuleID rule ID |
|
125 * @param TDesC& aBoolChild, The childtype of transform. Refer to rlspresxdmconsts.h |
|
126 * for a list of supported boolean transforms. Constants from rlspresxdmconsts.h |
|
127 * may be used for transform names. |
|
128 * @param TBool aValue value to add or replace. |
|
129 * @return TInt KErrNone, KErrNotFound if rule not found, |
|
130 * KErrArgument if invalid child element |
|
131 */ |
|
132 IMPORT_C TInt AddOrRepTransKnownBoolL(const TDesC& aRuleID, |
|
133 const TDesC& aBoolChild, TBool aValue); |
|
134 |
|
135 /** |
|
136 * Gets transform's boolean child element from a rule |
|
137 * |
|
138 * @param TDesC& aRuleID rule ID |
|
139 * @param TDesC& aBoolChild, The childtype of transform. Refer to rlspresxdmconsts.h |
|
140 * for a list of supported boolean transforms. Constants from rlspresxdmconsts.h |
|
141 * may be used for transform names. |
|
142 * @param TBool aValue returned value. |
|
143 * @return TInt KErrNone, KErrNotFound if rule or child doesnt found, |
|
144 * KErrArgument if invalid child element |
|
145 */ |
|
146 IMPORT_C TInt GetTransKnownBoolL(const TDesC& aRuleID, |
|
147 const TDesC& aBoolChild, TBool& aValue); |
|
148 |
|
149 /** |
|
150 * Adds or replace transform's unknown boolean element to a rule |
|
151 * |
|
152 * @param TDesC& aRuleID rule ID |
|
153 * @param const TDesC& aName, Unknown boolean permission name |
|
154 * @param TBool aValue value to add or replace. |
|
155 * @return TInt KErrNone, KErrNotFound if rule doesnt found |
|
156 */ |
|
157 IMPORT_C TInt AddOrRepTransUnknownBoolL(const TDesC& aRuleID, |
|
158 const TDesC& aName, TBool aValue); |
|
159 |
|
160 /** |
|
161 * Gets transform's unknown boolean child element from a rule |
|
162 * |
|
163 * @param TDesC& aRuleID rule ID |
|
164 * @param const TDesC& aName, Unknown boolean permission name |
|
165 * @param TBool aValue returned value. |
|
166 * @return TInt KErrNone, KErrNotFound if rule or child element |
|
167 * doesnt found |
|
168 */ |
|
169 IMPORT_C TInt GetTransUnknownBoolL(const TDesC& aRuleID, |
|
170 const TDesC& aName, TBool& aValue); |
|
171 |
|
172 /** |
|
173 * Removes transform's child element from a given rule. If Child Element |
|
174 * is NullDesC, whole transform with all childrens is removed from rule. |
|
175 * This method is applicable to all transform types. |
|
176 * |
|
177 * @param TDesC& aRuleID rule ID |
|
178 * @param TDesC& aChildElement, The childtype of transform. Refer to rlspresxdmconsts.h |
|
179 * for a list of supported transforms. Constants from rlspresxdmconsts.h |
|
180 * may be used for transform names. |
|
181 * |
|
182 * @return TInt KErrNone, KErrNotFound if rule or child doesnt found, |
|
183 * KErrArgument if invalid child element. |
|
184 */ |
|
185 IMPORT_C TInt RemoveTransformL(const TDesC& aRuleID, |
|
186 const TDesC& aChildElement); |
|
187 |
|
188 /** |
|
189 * Finds whether given transform with childelement exists. |
|
190 * This method is applicable for all transform types. |
|
191 * |
|
192 * @param TDesC& aRuleID rule ID |
|
193 * @param TDesC& aChildElement, The childtype of transform. Refer to rlspresxdmconsts.h |
|
194 * for a list of supported transforms. Constants from rlspresxdmconsts.h |
|
195 * may be used for transform names. |
|
196 * @return TBool ETrue if transform exist |
|
197 */ |
|
198 IMPORT_C TBool IsTransformExistL(const TDesC& aRuleID, |
|
199 const TDesC& aChildElement); |
|
200 |
|
201 private: |
|
202 |
|
203 /** |
|
204 * Gets the transform's child node |
|
205 * |
|
206 * @param TDesC& aRuleID rule ID |
|
207 * @param TDesC& aTransformChild The childtype of transform. |
|
208 * @param TBool aCreate, if ETrue creates the child in case it doesnt exists |
|
209 * @return CXdmDocumentNode* transfrom's child node or NULL if not found |
|
210 */ |
|
211 CXdmDocumentNode* GetTransformChildNodeL(const TDesC& aRuleID, |
|
212 const TDesC& aTransformChild, TBool aCreate); |
|
213 |
|
214 /** |
|
215 * Find whether the given transform child and its childrens are valid |
|
216 * |
|
217 * @param TDesC& aComplexChild, complex child of the transform |
|
218 * @param RArray<TTransDataCompo>& aTypeAndValues, children types and their |
|
219 * contents |
|
220 * @return ETrue if valid |
|
221 */ |
|
222 TBool AreNodeNamesValid(const TDesC& aComplexChild, |
|
223 const RArray<TTransDataCompo>& aTypeAndValues); |
|
224 |
|
225 /** |
|
226 * Find whether the provide-all node exists in given complex child. |
|
227 * the practicality of this is that if provide-all exists then it |
|
228 * should be the only child of given complex child of transform. |
|
229 * |
|
230 * @param TDesC& aRuleID rule ID |
|
231 * @param TDesC& aComplexChild, complex child of the transform |
|
232 * @return ETrue if provide-all node found |
|
233 */ |
|
234 TBool IsProvideAllExistL(const TDesC& aRuleID,const TDesC& aComplexChild); |
|
235 |
|
236 /** |
|
237 * Find whether the given boolean child is supported or not. |
|
238 * |
|
239 * @param TDesC& aBoolChild |
|
240 * @return ETrue if supported |
|
241 */ |
|
242 TBool IsBoolChildSupported(const TDesC& aBoolChild); |
|
243 |
|
244 /** |
|
245 * Add or replace the transform's boolean child |
|
246 * |
|
247 * @param TDesC& aRuleID rule ID |
|
248 * @param TDesC& aBoolChild, boolean child of the transform, either known or unknown |
|
249 * @param TBool aValue, value of the boolean child |
|
250 * @return KErrNotFound if rule not found. |
|
251 */ |
|
252 TInt AddOrRepTransBoolL(const TDesC& aRuleID, const TDesC& aBoolChild, |
|
253 TBool aValue); |
|
254 |
|
255 /** |
|
256 * Gets the transform's boolean child |
|
257 * |
|
258 * @param TDesC& aRuleID rule ID |
|
259 * @param TDesC& aBoolChild, boolean child of the transform, either known or unknown |
|
260 * @param TBool aValue, returned value of the boolean child |
|
261 * @return KErrNotFound if rule or booleanchild not found. |
|
262 */ |
|
263 TInt GetTransBoolL(const TDesC& aRuleID, const TDesC& aBoolChild, |
|
264 TBool& aValue); |
|
265 |
|
266 private: // data |
|
267 |
|
268 // Pointer to CPresenceXDM - not owned |
|
269 CPresenceXDM* iPresXDM; |
|
270 |
|
271 }; |
|
272 |
|
273 #endif //__PRESENCETRANSFORMXDM_H__ |