1 /* |
|
2 * Copyright (c) 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: Service Provider Settings entry |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_SPENTRY_H |
|
20 #define C_SPENTRY_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "spdefinitions.h" |
|
25 |
|
26 class CSPProperty; |
|
27 |
|
28 |
|
29 /** |
|
30 * Service Provider Settings entry. |
|
31 * Container class for service attributes and settings properties |
|
32 * |
|
33 * @lib serviceprovidersettings.lib |
|
34 * @since S60 V3.2 |
|
35 */ |
|
36 NONSHARABLE_CLASS( CSPEntry ): public CBase |
|
37 { |
|
38 |
|
39 public: // Constructors and destructor |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 */ |
|
43 IMPORT_C static CSPEntry* NewL(); |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 IMPORT_C static CSPEntry* NewLC(); |
|
49 |
|
50 /** |
|
51 * Destructors. |
|
52 */ |
|
53 IMPORT_C virtual ~CSPEntry(); |
|
54 |
|
55 public: // Member functions |
|
56 /** |
|
57 * Returns service Id of this entry. |
|
58 * |
|
59 * @since S60 V3.2 |
|
60 * @return Service ID |
|
61 */ |
|
62 IMPORT_C TServiceId GetServiceId() const; |
|
63 |
|
64 /** |
|
65 * Sets unique service provider ID for this entry. |
|
66 * This ID is generated automatically when new entry is added. |
|
67 * Service ID is also required when user updates entry in service table |
|
68 * |
|
69 * @since S60 V3.2 |
|
70 * @param aServiceId service ID |
|
71 */ |
|
72 void SetServiceId( TServiceId aServiceId ); |
|
73 |
|
74 /** |
|
75 * Returns service name of this entry. |
|
76 * |
|
77 * @since S60 V3.2 |
|
78 * @return Service name |
|
79 */ |
|
80 IMPORT_C const TDesC& GetServiceName() const; |
|
81 |
|
82 /** |
|
83 * Sets service name for this entry. |
|
84 * |
|
85 * @since S60 V3.2 |
|
86 * @param aServiceName service name |
|
87 */ |
|
88 IMPORT_C TInt SetServiceName( const TDesC& aServiceName ); |
|
89 |
|
90 /** |
|
91 * Adds new property to this entry. |
|
92 * |
|
93 * @since S60 V3.2 |
|
94 * @param aProperty new property pointer |
|
95 * @return KErrNone if addition succeeded, |
|
96 * system wide error code otherwise. |
|
97 */ |
|
98 IMPORT_C TInt AddPropertyL( const CSPProperty& aProperty ); |
|
99 |
|
100 /** |
|
101 * Updates content of property in this entry. |
|
102 * |
|
103 * @since S60 V3.2 |
|
104 * @param aPropertyName property name |
|
105 * @param aValue new TInt value |
|
106 * @return KErrNone if update succeeded. |
|
107 */ |
|
108 IMPORT_C TInt UpdateProperty( TServicePropertyName aPropertyName, TInt aValue ); |
|
109 |
|
110 /** |
|
111 * Updates content of property in this entry. |
|
112 * |
|
113 * @since S60 V3.2 |
|
114 * @param aPropertyName property name |
|
115 * @param aValue new TDesC value |
|
116 * @return KErrNone if update succeeded. |
|
117 */ |
|
118 IMPORT_C TInt UpdateProperty( TServicePropertyName aPropertyName, const TDesC& aValue ); |
|
119 |
|
120 /** |
|
121 * Updates content of property in this entry. |
|
122 * |
|
123 * @since S60 V3.2 |
|
124 * @param aPropertyName property name |
|
125 * @param aValue new TOnOff value |
|
126 * @return KErrNone if update succeeded. |
|
127 */ |
|
128 IMPORT_C TInt UpdateProperty( TServicePropertyName aPropertyName, TOnOff aValue ); |
|
129 |
|
130 /** |
|
131 * Returns property of this entry by property name. |
|
132 * |
|
133 * @since S60 V3.2 |
|
134 * @param aProperty On return, reference to requested property |
|
135 * @param aPropertyName Name of requested property |
|
136 * @return error code |
|
137 */ |
|
138 IMPORT_C TInt GetProperty( const CSPProperty*& aProperty, |
|
139 TServicePropertyName aPropertyName ) const; |
|
140 |
|
141 /** |
|
142 * Returns property of this entry by property index. |
|
143 * |
|
144 * @since S60 V3.2 |
|
145 * @param aProperty On return, reference to requested property |
|
146 * @param aIndex index of requested property |
|
147 * @return error code |
|
148 */ |
|
149 IMPORT_C TInt GetProperty( const CSPProperty*& aProperty, |
|
150 TInt aIndex ) const; |
|
151 |
|
152 /** |
|
153 * Deletes property from this entry by index. |
|
154 * |
|
155 * @since S60 V3.2 |
|
156 * @param aIndex index of requested property |
|
157 * @return error code |
|
158 */ |
|
159 IMPORT_C TInt DeleteProperty( TInt aIndex ); |
|
160 |
|
161 /** |
|
162 * Deletes property from this entry by property name. |
|
163 * |
|
164 * @since S60 V3.2 |
|
165 * @param aProperty property name |
|
166 * @return error code |
|
167 */ |
|
168 IMPORT_C TInt DeleteProperty( TServicePropertyName aProperty ); |
|
169 |
|
170 /** |
|
171 * Returns all properties of this entry. |
|
172 * |
|
173 * @since S60 V3.2 |
|
174 * @return Reference to array of properties |
|
175 */ |
|
176 IMPORT_C const RPropertyArray& GetAllProperties() const; |
|
177 |
|
178 /** |
|
179 * Returns count of properties in this entry |
|
180 * |
|
181 * @since S60 V3.2 |
|
182 * @return Count of properties |
|
183 */ |
|
184 IMPORT_C TInt PropertyCount() const; |
|
185 |
|
186 /** |
|
187 * reset service entry |
|
188 * |
|
189 * @since S60 V3.2 |
|
190 * @return Count of properties |
|
191 */ |
|
192 IMPORT_C void Reset(); |
|
193 |
|
194 |
|
195 private: |
|
196 |
|
197 /** |
|
198 * C++ default constructor. |
|
199 */ |
|
200 CSPEntry(); |
|
201 |
|
202 /** |
|
203 * By default Symbian 2nd phase constructor is private. |
|
204 */ |
|
205 void ConstructL(); |
|
206 |
|
207 /** |
|
208 * Search index of requested property in iPropertyArray |
|
209 * |
|
210 * @since S60 ?S60_version |
|
211 * @param aProperty |
|
212 * @return Index of property or KErrNotFound |
|
213 */ |
|
214 TInt SearchProperty( TServicePropertyName aProperty ) const; |
|
215 |
|
216 private: // data |
|
217 |
|
218 /** |
|
219 * Id of service settings entry ( unique ) |
|
220 */ |
|
221 TServiceId iServiceId; |
|
222 |
|
223 /** |
|
224 * Name of settings entry ( unique ) |
|
225 * Own. |
|
226 */ |
|
227 RBuf iServiceName; |
|
228 |
|
229 /** |
|
230 * Service settings properties owned by this entry |
|
231 * Own. |
|
232 */ |
|
233 RPropertyArray iPropertyArray; |
|
234 |
|
235 }; |
|
236 |
|
237 |
|
238 #endif // C_SPENTRY_H |
|