2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Transport and Xml properies interface declaration
18 #ifndef M_SEN_PROPERTIES_H
19 #define M_SEN_PROPERTIES_H
21 const TInt KErrSenOmitted = 10;
26 // FORWARD DECLARATIONS
34 * PropertiesClassType enumeration.
36 enum TSenPropertiesClassType
39 ESenXmlProperties = 1,
40 ESenTransportProperties = 2,
41 ESenHttpTransportProperties = 3,
42 ESenVtcpTransportProperties = 4,
43 ESenLayeredXmlProperties = 5,
44 ESenLayeredTransportProperties = 6,
45 ESenLayeredHttpTransportProperties = 7,
46 ESenLayeredVtcpTransportProperties = 8
50 * Sets the XML reader to be used for parsing.
51 * @param aReader: the reader to be used.
52 * Ownership is NOT transferred.
54 virtual void SetReader(CSenXmlReader& aReader) = 0;
57 * Get an integer identifying properties class type.
58 * All subclasses MUST return use unique integer value.
59 * @return unique TInt identifying this properties class type
61 virtual TSenPropertiesClassType PropertiesClassType() = 0;
64 * Writes this properties object as descriptor into a stream.
65 * UTF-8 charset encoding will be used.
67 * @param aWriteStream The stream to write to.
69 virtual void WriteToL(RWriteStream& aWriteStream) = 0;
72 * Reads this properties object from the descriptor.
73 * UTF-8 charset encoding should be used.
75 * @param aBuffer The buffer to read from.
77 virtual void ReadFromL(const TDesC8& aBuffer) = 0;
80 * Get these properties as UTF-8 charset encoded descriptor.
82 * @return a pointer to UTF-8 encoded descriptor.
83 * Caller takes ownership.
85 virtual HBufC8* AsUtf8L() = 0;
88 * Get these properties as UTF-8 charset encoded descriptor.
90 * @return a pointer to UTF-8 encoded descriptor, which is
91 * has been left on cleanup stack.
92 * Caller takes ownership.
94 virtual HBufC8* AsUtf8LC() = 0;
99 * If property with given name does not exist,
100 * new property with given value will be added. Otherwise the value of
101 * existing property will be updated.
104 * @param aName Name of the property, which can be later used to
105 * refer the given value.
106 * @param aValue Is the value of this property.
107 * @return KErrNone if no error, or some of the system wide
110 * According to implementing classes.
112 virtual TInt SetPropertyL(const TDesC8& aName,
113 const TDesC8& aValue) = 0;
116 * Gets the value of the property behind certain name.
118 * @param aName The name identifying this property.
119 * @param aValue The value of the property, or KNullDesC8 if
120 * property is not found.
121 * @return KErrNone on success, KErrSenOmitted if property
122 * has been omitted, or some of the system-wide error codes
125 virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue) = 0;
128 * Sets new integer property.
130 * If property with given name does not exist,
131 * new property with given value will be added. Otherwise the value of
132 * existing property will be updated.
135 * @param aName Name of the property, which can be later used
136 * to refer the given value.
137 * @param aValue Is the integer value of this property.
138 * @return KErrNone if no error, or some of the system wide
141 * According to implementing classes.
143 virtual TInt SetIntPropertyL(const TDesC8& aName,
144 const TInt aValue) = 0;
147 * Gets the integer value of the property behind certain name.
149 * @param aName The name identifying this property.
150 * @param aValue A TInt reference to be filled in with the value of
152 * @return KErrNone on success, KErrSenOmitted if property
153 * has been omitted, or some of the system-wide error codes
156 virtual TInt IntPropertyL(const TDesC8& aName,
160 * Sets new boolean property.
162 * If property with given name does not exist,
163 * new property with given value will be added. Otherwise the value of
164 * existing property will be updated.
167 * @param aName Name of the property, which can be later used
168 * to refer the given value.
169 * @param aValue The boolean value of this property.
170 * @return KErrNone if no error, or some of the system wide
173 * According to implementing classes.
175 virtual TInt SetBoolPropertyL(const TDesC8& aName,
176 const TBool aValue) = 0;
179 * Gets the boolean value of the property behind certain name.
181 * @param aName The name identifying this property.
182 * @param aValue A TBool reference to be filled in with the value of
184 * @return KErrNone on success, KErrSenOmitted if property
185 * has been omitted, or some of the system-wide error codes
188 virtual TInt BoolPropertyL(const TDesC8& aName,
192 * Method creates exact copy of the properties, preserving
193 * the real, concrete subclass type (this can be resolved
194 * via PropertiesClassType() method. Furthermore, the
195 * IsSafeToCast() method can be used to reflect the returned
196 * pointer to a concrete class. NOTE: one must cast the
197 * returned pointer to concrete class in order to safely
198 * de-allocate any memory allocated by this method.
199 * @param aOkOrError is KErrNone when clone is successfully
200 * allocated, or some system-wide error otherwise.
201 * @return pointer to *concrete* properties object, which
202 * MUST be class cast to known subclass(!).
204 virtual MSenProperties* Clone(TInt& aOkOrError) const = 0;
207 * Method provies reflection support for properties classes,
208 * enabling safe class-casts to concrete subclass objects.
209 * @return ETrue, if object is of a known subclass type
210 * EFalse, if the object cannot be cast to given type.
212 virtual TBool IsSafeToCast(TSenPropertiesClassType aClass) = 0;
215 * Method creates exact copy of the properties, preserving
216 * the real, concrete subclass type (this can be resolved
217 * via PropertiesClassType() method. Furthermore, the
218 * IsSafeToCast() method can be used to reflect the returned
219 * pointer to a concrete class. NOTE: one must cast the
220 * returned pointer to concrete class in order to safely
221 * de-allocate any memory allocated by this method.
222 * @return pointer to *concrete* properties object, which
223 * MUST be class cast to known subclass(!).
225 virtual MSenProperties* CloneL() const = 0;
228 #endif // M_SEN_PROPERTIES_H