williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Transport and Xml properies interface declaration
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
#ifndef M_SEN_PROPERTIES_H
|
williamr@2
|
19 |
#define M_SEN_PROPERTIES_H
|
williamr@2
|
20 |
|
williamr@2
|
21 |
const TInt KErrSenOmitted = 10;
|
williamr@2
|
22 |
|
williamr@2
|
23 |
// INCLUDES
|
williamr@2
|
24 |
#include <e32std.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// FORWARD DECLARATIONS
|
williamr@2
|
27 |
class RWriteStream;
|
williamr@2
|
28 |
class CSenXmlReader;
|
williamr@2
|
29 |
|
williamr@2
|
30 |
class MSenProperties
|
williamr@2
|
31 |
{
|
williamr@2
|
32 |
public:
|
williamr@2
|
33 |
/**
|
williamr@2
|
34 |
* PropertiesClassType enumeration.
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
enum TSenPropertiesClassType
|
williamr@2
|
37 |
{
|
williamr@2
|
38 |
ENotInUse = 0,
|
williamr@2
|
39 |
ESenXmlProperties = 1,
|
williamr@2
|
40 |
ESenTransportProperties = 2,
|
williamr@2
|
41 |
ESenHttpTransportProperties = 3,
|
williamr@2
|
42 |
ESenVtcpTransportProperties = 4,
|
williamr@2
|
43 |
ESenLayeredXmlProperties = 5,
|
williamr@2
|
44 |
ESenLayeredTransportProperties = 6,
|
williamr@2
|
45 |
ESenLayeredHttpTransportProperties = 7,
|
williamr@2
|
46 |
ESenLayeredVtcpTransportProperties = 8
|
williamr@2
|
47 |
};
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* Sets the XML reader to be used for parsing.
|
williamr@2
|
51 |
* @param aReader: the reader to be used.
|
williamr@2
|
52 |
* Ownership is NOT transferred.
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
virtual void SetReader(CSenXmlReader& aReader) = 0;
|
williamr@2
|
55 |
|
williamr@2
|
56 |
/**
|
williamr@2
|
57 |
* Get an integer identifying properties class type.
|
williamr@2
|
58 |
* All subclasses MUST return use unique integer value.
|
williamr@2
|
59 |
* @return unique TInt identifying this properties class type
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
virtual TSenPropertiesClassType PropertiesClassType() = 0;
|
williamr@2
|
62 |
|
williamr@2
|
63 |
/**
|
williamr@2
|
64 |
* Writes this properties object as descriptor into a stream.
|
williamr@2
|
65 |
* UTF-8 charset encoding will be used.
|
williamr@2
|
66 |
* @since Series60
|
williamr@2
|
67 |
* @param aWriteStream The stream to write to.
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
virtual void WriteToL(RWriteStream& aWriteStream) = 0;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/**
|
williamr@2
|
72 |
* Reads this properties object from the descriptor.
|
williamr@2
|
73 |
* UTF-8 charset encoding should be used.
|
williamr@2
|
74 |
* @since Series60
|
williamr@2
|
75 |
* @param aBuffer The buffer to read from.
|
williamr@2
|
76 |
*/
|
williamr@2
|
77 |
virtual void ReadFromL(const TDesC8& aBuffer) = 0;
|
williamr@2
|
78 |
|
williamr@2
|
79 |
/**
|
williamr@2
|
80 |
* Get these properties as UTF-8 charset encoded descriptor.
|
williamr@2
|
81 |
* @since Series60
|
williamr@2
|
82 |
* @return a pointer to UTF-8 encoded descriptor.
|
williamr@2
|
83 |
* Caller takes ownership.
|
williamr@2
|
84 |
*/
|
williamr@2
|
85 |
virtual HBufC8* AsUtf8L() = 0;
|
williamr@2
|
86 |
|
williamr@2
|
87 |
/**
|
williamr@2
|
88 |
* Get these properties as UTF-8 charset encoded descriptor.
|
williamr@2
|
89 |
* @since Series60
|
williamr@2
|
90 |
* @return a pointer to UTF-8 encoded descriptor, which is
|
williamr@2
|
91 |
* has been left on cleanup stack.
|
williamr@2
|
92 |
* Caller takes ownership.
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
virtual HBufC8* AsUtf8LC() = 0;
|
williamr@2
|
95 |
|
williamr@2
|
96 |
/**
|
williamr@2
|
97 |
* Sets new property.
|
williamr@2
|
98 |
*
|
williamr@2
|
99 |
* If property with given name does not exist,
|
williamr@2
|
100 |
* new property with given value will be added. Otherwise the value of
|
williamr@2
|
101 |
* existing property will be updated.
|
williamr@2
|
102 |
*
|
williamr@2
|
103 |
* @since Series60
|
williamr@2
|
104 |
* @param aName Name of the property, which can be later used to
|
williamr@2
|
105 |
* refer the given value.
|
williamr@2
|
106 |
* @param aValue Is the value of this property.
|
williamr@2
|
107 |
* @return KErrNone if no error, or some of the system wide
|
williamr@2
|
108 |
* error codes.
|
williamr@2
|
109 |
* Leave codes:
|
williamr@2
|
110 |
* According to implementing classes.
|
williamr@2
|
111 |
*/
|
williamr@2
|
112 |
virtual TInt SetPropertyL(const TDesC8& aName,
|
williamr@2
|
113 |
const TDesC8& aValue) = 0;
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Gets the value of the property behind certain name.
|
williamr@2
|
117 |
* @since Series60
|
williamr@2
|
118 |
* @param aName The name identifying this property.
|
williamr@2
|
119 |
* @param aValue The value of the property, or KNullDesC8 if
|
williamr@2
|
120 |
* property is not found.
|
williamr@2
|
121 |
* @return KErrNone on success, KErrSenOmitted if property
|
williamr@2
|
122 |
* has been omitted, or some of the system-wide error codes
|
williamr@2
|
123 |
* otherwise.
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue) = 0;
|
williamr@2
|
126 |
|
williamr@2
|
127 |
/**
|
williamr@2
|
128 |
* Sets new integer property.
|
williamr@2
|
129 |
*
|
williamr@2
|
130 |
* If property with given name does not exist,
|
williamr@2
|
131 |
* new property with given value will be added. Otherwise the value of
|
williamr@2
|
132 |
* existing property will be updated.
|
williamr@2
|
133 |
*
|
williamr@2
|
134 |
* @since Series60
|
williamr@2
|
135 |
* @param aName Name of the property, which can be later used
|
williamr@2
|
136 |
* to refer the given value.
|
williamr@2
|
137 |
* @param aValue Is the integer value of this property.
|
williamr@2
|
138 |
* @return KErrNone if no error, or some of the system wide
|
williamr@2
|
139 |
* error codes.
|
williamr@2
|
140 |
* Leave codes:
|
williamr@2
|
141 |
* According to implementing classes.
|
williamr@2
|
142 |
*/
|
williamr@2
|
143 |
virtual TInt SetIntPropertyL(const TDesC8& aName,
|
williamr@2
|
144 |
const TInt aValue) = 0;
|
williamr@2
|
145 |
|
williamr@2
|
146 |
/**
|
williamr@2
|
147 |
* Gets the integer value of the property behind certain name.
|
williamr@2
|
148 |
* @since Series60
|
williamr@2
|
149 |
* @param aName The name identifying this property.
|
williamr@2
|
150 |
* @param aValue A TInt reference to be filled in with the value of
|
williamr@2
|
151 |
* the property.
|
williamr@2
|
152 |
* @return KErrNone on success, KErrSenOmitted if property
|
williamr@2
|
153 |
* has been omitted, or some of the system-wide error codes
|
williamr@2
|
154 |
* otherwise.
|
williamr@2
|
155 |
*/
|
williamr@2
|
156 |
virtual TInt IntPropertyL(const TDesC8& aName,
|
williamr@2
|
157 |
TInt& aValue) = 0;
|
williamr@2
|
158 |
|
williamr@2
|
159 |
/**
|
williamr@2
|
160 |
* Sets new boolean property.
|
williamr@2
|
161 |
*
|
williamr@2
|
162 |
* If property with given name does not exist,
|
williamr@2
|
163 |
* new property with given value will be added. Otherwise the value of
|
williamr@2
|
164 |
* existing property will be updated.
|
williamr@2
|
165 |
*
|
williamr@2
|
166 |
* @since Series60
|
williamr@2
|
167 |
* @param aName Name of the property, which can be later used
|
williamr@2
|
168 |
* to refer the given value.
|
williamr@2
|
169 |
* @param aValue The boolean value of this property.
|
williamr@2
|
170 |
* @return KErrNone if no error, or some of the system wide
|
williamr@2
|
171 |
* error codes.
|
williamr@2
|
172 |
* Leave codes:
|
williamr@2
|
173 |
* According to implementing classes.
|
williamr@2
|
174 |
*/
|
williamr@2
|
175 |
virtual TInt SetBoolPropertyL(const TDesC8& aName,
|
williamr@2
|
176 |
const TBool aValue) = 0;
|
williamr@2
|
177 |
|
williamr@2
|
178 |
/**
|
williamr@2
|
179 |
* Gets the boolean value of the property behind certain name.
|
williamr@2
|
180 |
* @since Series60
|
williamr@2
|
181 |
* @param aName The name identifying this property.
|
williamr@2
|
182 |
* @param aValue A TBool reference to be filled in with the value of
|
williamr@2
|
183 |
* the property.
|
williamr@2
|
184 |
* @return KErrNone on success, KErrSenOmitted if property
|
williamr@2
|
185 |
* has been omitted, or some of the system-wide error codes
|
williamr@2
|
186 |
* otherwise.
|
williamr@2
|
187 |
*/
|
williamr@2
|
188 |
virtual TInt BoolPropertyL(const TDesC8& aName,
|
williamr@2
|
189 |
TBool& aValue) = 0;
|
williamr@2
|
190 |
|
williamr@2
|
191 |
/**
|
williamr@2
|
192 |
* Method creates exact copy of the properties, preserving
|
williamr@2
|
193 |
* the real, concrete subclass type (this can be resolved
|
williamr@2
|
194 |
* via PropertiesClassType() method. Furthermore, the
|
williamr@2
|
195 |
* IsSafeToCast() method can be used to reflect the returned
|
williamr@2
|
196 |
* pointer to a concrete class. NOTE: one must cast the
|
williamr@2
|
197 |
* returned pointer to concrete class in order to safely
|
williamr@2
|
198 |
* de-allocate any memory allocated by this method.
|
williamr@2
|
199 |
* @param aOkOrError is KErrNone when clone is successfully
|
williamr@2
|
200 |
* allocated, or some system-wide error otherwise.
|
williamr@2
|
201 |
* @return pointer to *concrete* properties object, which
|
williamr@2
|
202 |
* MUST be class cast to known subclass(!).
|
williamr@2
|
203 |
*/
|
williamr@2
|
204 |
virtual MSenProperties* Clone(TInt& aOkOrError) const = 0;
|
williamr@2
|
205 |
|
williamr@2
|
206 |
/**
|
williamr@2
|
207 |
* Method provies reflection support for properties classes,
|
williamr@2
|
208 |
* enabling safe class-casts to concrete subclass objects.
|
williamr@2
|
209 |
* @return ETrue, if object is of a known subclass type
|
williamr@2
|
210 |
* EFalse, if the object cannot be cast to given type.
|
williamr@2
|
211 |
*/
|
williamr@2
|
212 |
virtual TBool IsSafeToCast(TSenPropertiesClassType aClass) = 0;
|
williamr@2
|
213 |
|
williamr@2
|
214 |
/**
|
williamr@2
|
215 |
* Method creates exact copy of the properties, preserving
|
williamr@2
|
216 |
* the real, concrete subclass type (this can be resolved
|
williamr@2
|
217 |
* via PropertiesClassType() method. Furthermore, the
|
williamr@2
|
218 |
* IsSafeToCast() method can be used to reflect the returned
|
williamr@2
|
219 |
* pointer to a concrete class. NOTE: one must cast the
|
williamr@2
|
220 |
* returned pointer to concrete class in order to safely
|
williamr@2
|
221 |
* de-allocate any memory allocated by this method.
|
williamr@2
|
222 |
* @return pointer to *concrete* properties object, which
|
williamr@2
|
223 |
* MUST be class cast to known subclass(!).
|
williamr@2
|
224 |
*/
|
williamr@2
|
225 |
virtual MSenProperties* CloneL() const = 0;
|
williamr@2
|
226 |
};
|
williamr@2
|
227 |
|
williamr@2
|
228 |
#endif // M_SEN_PROPERTIES_H
|