williamr@2: /* williamr@2: * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Transport and Xml properies interface declaration williamr@2: * williamr@2: */ williamr@2: williamr@2: #ifndef M_SEN_PROPERTIES_H williamr@2: #define M_SEN_PROPERTIES_H williamr@2: williamr@2: const TInt KErrSenOmitted = 10; williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class RWriteStream; williamr@2: class CSenXmlReader; williamr@2: williamr@2: class MSenProperties williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * PropertiesClassType enumeration. williamr@2: */ williamr@2: enum TSenPropertiesClassType williamr@2: { williamr@2: ENotInUse = 0, williamr@2: ESenXmlProperties = 1, williamr@2: ESenTransportProperties = 2, williamr@2: ESenHttpTransportProperties = 3, williamr@2: ESenVtcpTransportProperties = 4, williamr@2: ESenLayeredXmlProperties = 5, williamr@2: ESenLayeredTransportProperties = 6, williamr@2: ESenLayeredHttpTransportProperties = 7, williamr@2: ESenLayeredVtcpTransportProperties = 8 williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Sets the XML reader to be used for parsing. williamr@2: * @param aReader: the reader to be used. williamr@2: * Ownership is NOT transferred. williamr@2: */ williamr@2: virtual void SetReader(CSenXmlReader& aReader) = 0; williamr@2: williamr@2: /** williamr@2: * Get an integer identifying properties class type. williamr@2: * All subclasses MUST return use unique integer value. williamr@2: * @return unique TInt identifying this properties class type williamr@2: */ williamr@2: virtual TSenPropertiesClassType PropertiesClassType() = 0; williamr@2: williamr@2: /** williamr@2: * Writes this properties object as descriptor into a stream. williamr@2: * UTF-8 charset encoding will be used. williamr@2: * @since Series60 williamr@2: * @param aWriteStream The stream to write to. williamr@2: */ williamr@2: virtual void WriteToL(RWriteStream& aWriteStream) = 0; williamr@2: williamr@2: /** williamr@2: * Reads this properties object from the descriptor. williamr@2: * UTF-8 charset encoding should be used. williamr@2: * @since Series60 williamr@2: * @param aBuffer The buffer to read from. williamr@2: */ williamr@2: virtual void ReadFromL(const TDesC8& aBuffer) = 0; williamr@2: williamr@2: /** williamr@2: * Get these properties as UTF-8 charset encoded descriptor. williamr@2: * @since Series60 williamr@2: * @return a pointer to UTF-8 encoded descriptor. williamr@2: * Caller takes ownership. williamr@2: */ williamr@2: virtual HBufC8* AsUtf8L() = 0; williamr@2: williamr@2: /** williamr@2: * Get these properties as UTF-8 charset encoded descriptor. williamr@2: * @since Series60 williamr@2: * @return a pointer to UTF-8 encoded descriptor, which is williamr@2: * has been left on cleanup stack. williamr@2: * Caller takes ownership. williamr@2: */ williamr@2: virtual HBufC8* AsUtf8LC() = 0; williamr@2: williamr@2: /** williamr@2: * Sets new property. williamr@2: * williamr@2: * If property with given name does not exist, williamr@2: * new property with given value will be added. Otherwise the value of williamr@2: * existing property will be updated. williamr@2: * williamr@2: * @since Series60 williamr@2: * @param aName Name of the property, which can be later used to williamr@2: * refer the given value. williamr@2: * @param aValue Is the value of this property. williamr@2: * @return KErrNone if no error, or some of the system wide williamr@2: * error codes. williamr@2: * Leave codes: williamr@2: * According to implementing classes. williamr@2: */ williamr@2: virtual TInt SetPropertyL(const TDesC8& aName, williamr@2: const TDesC8& aValue) = 0; williamr@2: williamr@2: /** williamr@2: * Gets the value of the property behind certain name. williamr@2: * @since Series60 williamr@2: * @param aName The name identifying this property. williamr@2: * @param aValue The value of the property, or KNullDesC8 if williamr@2: * property is not found. williamr@2: * @return KErrNone on success, KErrSenOmitted if property williamr@2: * has been omitted, or some of the system-wide error codes williamr@2: * otherwise. williamr@2: */ williamr@2: virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue) = 0; williamr@2: williamr@2: /** williamr@2: * Sets new integer property. williamr@2: * williamr@2: * If property with given name does not exist, williamr@2: * new property with given value will be added. Otherwise the value of williamr@2: * existing property will be updated. williamr@2: * williamr@2: * @since Series60 williamr@2: * @param aName Name of the property, which can be later used williamr@2: * to refer the given value. williamr@2: * @param aValue Is the integer value of this property. williamr@2: * @return KErrNone if no error, or some of the system wide williamr@2: * error codes. williamr@2: * Leave codes: williamr@2: * According to implementing classes. williamr@2: */ williamr@2: virtual TInt SetIntPropertyL(const TDesC8& aName, williamr@2: const TInt aValue) = 0; williamr@2: williamr@2: /** williamr@2: * Gets the integer value of the property behind certain name. williamr@2: * @since Series60 williamr@2: * @param aName The name identifying this property. williamr@2: * @param aValue A TInt reference to be filled in with the value of williamr@2: * the property. williamr@2: * @return KErrNone on success, KErrSenOmitted if property williamr@2: * has been omitted, or some of the system-wide error codes williamr@2: * otherwise. williamr@2: */ williamr@2: virtual TInt IntPropertyL(const TDesC8& aName, williamr@2: TInt& aValue) = 0; williamr@2: williamr@2: /** williamr@2: * Sets new boolean property. williamr@2: * williamr@2: * If property with given name does not exist, williamr@2: * new property with given value will be added. Otherwise the value of williamr@2: * existing property will be updated. williamr@2: * williamr@2: * @since Series60 williamr@2: * @param aName Name of the property, which can be later used williamr@2: * to refer the given value. williamr@2: * @param aValue The boolean value of this property. williamr@2: * @return KErrNone if no error, or some of the system wide williamr@2: * error codes. williamr@2: * Leave codes: williamr@2: * According to implementing classes. williamr@2: */ williamr@2: virtual TInt SetBoolPropertyL(const TDesC8& aName, williamr@2: const TBool aValue) = 0; williamr@2: williamr@2: /** williamr@2: * Gets the boolean value of the property behind certain name. williamr@2: * @since Series60 williamr@2: * @param aName The name identifying this property. williamr@2: * @param aValue A TBool reference to be filled in with the value of williamr@2: * the property. williamr@2: * @return KErrNone on success, KErrSenOmitted if property williamr@2: * has been omitted, or some of the system-wide error codes williamr@2: * otherwise. williamr@2: */ williamr@2: virtual TInt BoolPropertyL(const TDesC8& aName, williamr@2: TBool& aValue) = 0; williamr@2: williamr@2: /** williamr@2: * Method creates exact copy of the properties, preserving williamr@2: * the real, concrete subclass type (this can be resolved williamr@2: * via PropertiesClassType() method. Furthermore, the williamr@2: * IsSafeToCast() method can be used to reflect the returned williamr@2: * pointer to a concrete class. NOTE: one must cast the williamr@2: * returned pointer to concrete class in order to safely williamr@2: * de-allocate any memory allocated by this method. williamr@2: * @param aOkOrError is KErrNone when clone is successfully williamr@2: * allocated, or some system-wide error otherwise. williamr@2: * @return pointer to *concrete* properties object, which williamr@2: * MUST be class cast to known subclass(!). williamr@2: */ williamr@2: virtual MSenProperties* Clone(TInt& aOkOrError) const = 0; williamr@2: williamr@2: /** williamr@2: * Method provies reflection support for properties classes, williamr@2: * enabling safe class-casts to concrete subclass objects. williamr@2: * @return ETrue, if object is of a known subclass type williamr@2: * EFalse, if the object cannot be cast to given type. williamr@2: */ williamr@2: virtual TBool IsSafeToCast(TSenPropertiesClassType aClass) = 0; williamr@2: williamr@2: /** williamr@2: * Method creates exact copy of the properties, preserving williamr@2: * the real, concrete subclass type (this can be resolved williamr@2: * via PropertiesClassType() method. Furthermore, the williamr@2: * IsSafeToCast() method can be used to reflect the returned williamr@2: * pointer to a concrete class. NOTE: one must cast the williamr@2: * returned pointer to concrete class in order to safely williamr@2: * de-allocate any memory allocated by this method. williamr@2: * @return pointer to *concrete* properties object, which williamr@2: * MUST be class cast to known subclass(!). williamr@2: */ williamr@2: virtual MSenProperties* CloneL() const = 0; williamr@2: }; williamr@2: williamr@2: #endif // M_SEN_PROPERTIES_H