|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Generic parameter family bundles: |
|
15 // Serialisable containers for structured custom data. |
|
16 // FamilyBundle |
|
17 // has 0..n |
|
18 // Parameter Families |
|
19 // each of which has 0..n |
|
20 // ParameterSets |
|
21 // |
|
22 // |
|
23 // Note: Every effort should be made to ensure that the classes forming this API be kept consistent with each other |
|
24 // When making changes to these classes also see the files es_parameterbundle.h, es_parameterfamily.h, |
|
25 // ss_parameterfamilybundle.h |
|
26 // |
|
27 |
|
28 /** |
|
29 @file |
|
30 @publishedPartner |
|
31 @released |
|
32 */ |
|
33 |
|
34 #ifndef __ES_PARAMETERFAMILY_H |
|
35 #define __ES_PARAMETERFAMILY_H |
|
36 |
|
37 #include <comms-infras/es_parameterset.h> |
|
38 #include <comms-infras/metacontainer.h> |
|
39 #include <comms-infras/metatype.h> |
|
40 #include <es_sock.h> |
|
41 |
|
42 class CParameterSetContainer; |
|
43 class CGenericParameterBundle; |
|
44 class RParameterFamilyBundle; |
|
45 |
|
46 |
|
47 /** |
|
48 Wrapper round CParameterSetContainer presenting the following interface: |
|
49 For each Parameter Type (Requested, Acceptable and Granted) it contains 0..N parameter sets. |
|
50 @released |
|
51 */ |
|
52 class RParameterFamily |
|
53 { |
|
54 friend class RParameterFamilyBundle; |
|
55 friend class RParameterFamilyBundleC; |
|
56 |
|
57 public: |
|
58 enum TParameterSetType |
|
59 { |
|
60 ERequested = 0, |
|
61 EAcceptable = 1, |
|
62 EGranted = 2, |
|
63 ENumValues = 3 // The number of values in this enum |
|
64 }; |
|
65 |
|
66 RParameterFamily() |
|
67 : iContainer(NULL) |
|
68 { |
|
69 } |
|
70 |
|
71 public: |
|
72 // creation & deserialising |
|
73 IMPORT_C void CreateL(RParameterFamilyBundle& aBundle, TUint32 aFamilyId); |
|
74 IMPORT_C void LoadL(RParameterFamilyBundle& aBundle, TPtrC8& aBuffer); |
|
75 |
|
76 // serialising |
|
77 IMPORT_C TUint Length() const; |
|
78 IMPORT_C TInt Store(TDes8& aDes) const; |
|
79 |
|
80 // check if we're pointing to something valid |
|
81 inline TBool IsNull() const; |
|
82 |
|
83 // destruction |
|
84 IMPORT_C void Destroy(); |
|
85 |
|
86 public: |
|
87 // adding parameter sets |
|
88 IMPORT_C TInt AddParameterSet(XParameterSetBase* aParameterSet, TParameterSetType aType); |
|
89 IMPORT_C void AddParameterSetL(XParameterSetBase* aParameterSet, TParameterSetType aType); |
|
90 |
|
91 // counting parameter sets |
|
92 IMPORT_C TInt CountParameterSets(TParameterSetType aType); |
|
93 |
|
94 // getting/finding parameter sets |
|
95 IMPORT_C XParameterSetBase* GetParameterSetAtIndex(TUint aIndex, TParameterSetType aType); |
|
96 IMPORT_C XParameterSetBase* FindParameterSet(Meta::STypeId aSetId, TParameterSetType aType); |
|
97 |
|
98 // getting/finding parameter sets (const) |
|
99 const XParameterSetBase* GetParameterSetAtIndex(TUint aIndex, TParameterSetType aType) const |
|
100 {return const_cast<RParameterFamily&>(*this).GetParameterSetAtIndex(aIndex,aType);} |
|
101 const XParameterSetBase* FindParameterSet(const Meta::STypeId& aSetId, TParameterSetType aType) const |
|
102 {return const_cast<RParameterFamily&>(*this).FindParameterSet(aSetId,aType);} |
|
103 |
|
104 // removing parameter set, and relinquish ownership to caller |
|
105 IMPORT_C TInt RemoveParameterSet(XParameterSetBase* aSetToRemove, TParameterSetType aType); |
|
106 IMPORT_C TInt RemoveAndDestroyParameterSet(XParameterSetBase* aSetToRemove, TParameterSetType aType); |
|
107 |
|
108 // ID of the parameter family |
|
109 IMPORT_C TUint32 Id() const; |
|
110 |
|
111 // clear all parameters of specified type |
|
112 IMPORT_C void ClearAllParameters(TParameterSetType aType); |
|
113 |
|
114 IMPORT_C TInt CountParameterSets(); |
|
115 |
|
116 IMPORT_C TInt DeleteParameterSet(TInt aIndex); |
|
117 IMPORT_C void DeleteParameterSetL(TInt aIndex); |
|
118 |
|
119 IMPORT_C TInt ClearParameterSetPointer(TInt aIndex, TParameterSetType aType); |
|
120 |
|
121 private: |
|
122 CParameterSetContainer* iContainer; // not necessarily owned. |
|
123 }; |
|
124 |
|
125 |
|
126 /** |
|
127 Bundle of (i.e. container for) parameter families. |
|
128 May contain and 0..N parameter families. |
|
129 @released |
|
130 */ |
|
131 class RParameterFamilyBundleC |
|
132 { |
|
133 friend class RParameterFamily; |
|
134 friend class RParameterFamilyBundle; |
|
135 |
|
136 public: |
|
137 // creation & deserialising |
|
138 IMPORT_C void CreateL(); |
|
139 IMPORT_C void LoadL(TDesC8& aDes); |
|
140 IMPORT_C TInt Load(const TDesC8& aDes); |
|
141 |
|
142 // serialising |
|
143 IMPORT_C TUint Length() const; |
|
144 IMPORT_C TInt Store(TDes8& aDes) const; |
|
145 |
|
146 // check if we're pointing to something valid |
|
147 inline TBool IsNull() const; |
|
148 |
|
149 // destruction |
|
150 IMPORT_C void Destroy(); |
|
151 |
|
152 // get/find families |
|
153 IMPORT_C const RParameterFamily GetFamilyAtIndex(TUint aIndex) const; |
|
154 IMPORT_C const RParameterFamily FindFamily(TUint32 aFamilyId) const; |
|
155 |
|
156 RParameterFamilyBundleC() |
|
157 : iBundle(NULL) |
|
158 { |
|
159 } |
|
160 |
|
161 private: |
|
162 RParameterFamilyBundleC(const RParameterFamilyBundleC& aBundle); |
|
163 RParameterFamilyBundleC& operator=(const RParameterFamilyBundleC& aBundle); |
|
164 |
|
165 private: |
|
166 CGenericParameterBundle* iBundle; |
|
167 }; |
|
168 |
|
169 |
|
170 /** |
|
171 Bundle of (i.e. container for) parameter families. |
|
172 May contain and 0..N parameter families. |
|
173 @released |
|
174 */ |
|
175 class RParameterFamilyBundle : public RParameterFamilyBundleC |
|
176 { |
|
177 public: |
|
178 // adding/creating families |
|
179 IMPORT_C RParameterFamily CreateFamilyL(TUint32 aFamilyId); |
|
180 |
|
181 // get/find families (non-const version) |
|
182 IMPORT_C RParameterFamily GetFamilyAtIndex(TUint aIndex); |
|
183 IMPORT_C RParameterFamily FindFamily(TUint32 aFamilyId); |
|
184 |
|
185 // clear all parameters |
|
186 IMPORT_C void ClearAllParameters(RParameterFamily::TParameterSetType aType); |
|
187 |
|
188 RParameterFamilyBundle() |
|
189 : RParameterFamilyBundleC() |
|
190 { |
|
191 } |
|
192 |
|
193 IMPORT_C TInt CountParameterFamilies() const; |
|
194 IMPORT_C TInt DeleteFamilyAtIndex(TInt aIndex); |
|
195 IMPORT_C void RemoveFamilyAtIndex(TInt aIndex); |
|
196 |
|
197 private: |
|
198 RParameterFamilyBundle(const RParameterFamilyBundle& aBundle); |
|
199 RParameterFamilyBundle& operator=(const RParameterFamilyBundle& aBundle); |
|
200 }; |
|
201 |
|
202 |
|
203 #include <comms-infras/es_parameterfamily.inl> |
|
204 |
|
205 #endif |
|
206 // __ES_PARAMETERFAMILY_H |
|
207 |
|
208 |
|
209 |
|
210 |