epoc32/include/mw/msenproperties.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2005 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:  Transport and Xml properies interface declaration     
    15 *
    16 */
    17 
    18 #ifndef M_SEN_PROPERTIES_H
    19 #define M_SEN_PROPERTIES_H
    20 
    21 const TInt KErrSenOmitted = 10;
    22 
    23 // INCLUDES
    24 #include <e32std.h>
    25 
    26 // FORWARD DECLARATIONS
    27 class RWriteStream;
    28 class CSenXmlReader;
    29 
    30 class MSenProperties
    31     {
    32     public:
    33         /**
    34         * PropertiesClassType enumeration. 
    35         */
    36         enum TSenPropertiesClassType
    37         	{
    38         	ENotInUse                           = 0,
    39         	ESenXmlProperties                   = 1,
    40         	ESenTransportProperties             = 2,
    41         	ESenHttpTransportProperties         = 3,    
    42             ESenVtcpTransportProperties         = 4,    
    43         	ESenLayeredXmlProperties            = 5,
    44         	ESenLayeredTransportProperties      = 6,
    45         	ESenLayeredHttpTransportProperties  = 7,
    46         	ESenLayeredVtcpTransportProperties  = 8
    47         	};
    48 
    49         /**
    50         *  Sets the XML reader to be used for parsing.
    51         *  @param aReader:     the reader to be used. 
    52         *                      Ownership is NOT transferred.
    53         */
    54         virtual void SetReader(CSenXmlReader& aReader) = 0;
    55              
    56         /**
    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
    60         */
    61         virtual TSenPropertiesClassType PropertiesClassType() = 0;
    62 
    63         /**
    64         * Writes this properties object as descriptor into a stream.
    65         * UTF-8 charset encoding will be used.
    66         * @since Series60
    67         * @param aWriteStream The stream to write to.
    68         */
    69         virtual void WriteToL(RWriteStream& aWriteStream) = 0;
    70 
    71         /**
    72         * Reads this properties object from the descriptor.
    73         * UTF-8 charset encoding should be used.
    74         * @since Series60
    75         * @param aBuffer The buffer to read from.
    76         */
    77         virtual void ReadFromL(const TDesC8& aBuffer) = 0;
    78 
    79         /**
    80         * Get these properties as UTF-8 charset encoded descriptor.
    81         * @since Series60
    82         * @return a pointer to UTF-8 encoded descriptor.
    83         * Caller takes ownership.
    84         */
    85         virtual HBufC8* AsUtf8L() = 0;
    86 
    87         /**
    88         * Get these properties as UTF-8 charset encoded descriptor.
    89         * @since Series60
    90         * @return a pointer to UTF-8 encoded descriptor, which is
    91         * has been left on cleanup stack.
    92         * Caller takes ownership.
    93         */
    94         virtual HBufC8* AsUtf8LC() = 0;
    95         
    96         /**
    97         * Sets new property. 
    98         *
    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.
   102         *
   103         * @since Series60
   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
   108         *                      error codes.
   109         * Leave codes:
   110         *                      According to implementing classes. 
   111         */
   112         virtual TInt SetPropertyL(const TDesC8& aName,
   113                                   const TDesC8& aValue) = 0;
   114         
   115         /**
   116         * Gets the value of the property behind certain name.
   117         * @since Series60
   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
   123         * otherwise.                  
   124         */
   125         virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue) = 0;
   126         
   127         /**
   128         * Sets new integer property.
   129         *
   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.
   133         *
   134         * @since Series60
   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
   139         *                      error codes.
   140         * Leave codes:
   141         *                      According to implementing classes. 
   142         */
   143         virtual TInt SetIntPropertyL(const TDesC8& aName,
   144                                      const TInt aValue) = 0;
   145         
   146         /**
   147         * Gets the integer value of the property behind certain name.
   148         * @since Series60
   149         * @param aName    The name identifying this property.
   150         * @param aValue   A TInt reference to be filled in with the value of
   151         *                 the property.
   152         * @return KErrNone on success, KErrSenOmitted if property
   153         * has been omitted, or some of the system-wide error codes
   154         * otherwise.                  
   155         */
   156         virtual TInt IntPropertyL(const TDesC8& aName,
   157                                   TInt& aValue) = 0;
   158         
   159         /**
   160         * Sets new boolean property.
   161         *
   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.
   165         *
   166         * @since Series60
   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
   171         *                      error codes.
   172         * Leave codes:
   173         *                      According to implementing classes. 
   174         */
   175         virtual TInt SetBoolPropertyL(const TDesC8& aName,
   176                                       const TBool aValue) = 0;
   177         
   178         /**
   179         * Gets the boolean value of the property behind certain name.
   180         * @since Series60
   181         * @param aName    The name identifying this property.
   182         * @param aValue   A TBool reference to be filled in with the value of
   183         *                 the property.
   184         * @return KErrNone on success, KErrSenOmitted if property
   185         * has been omitted, or some of the system-wide error codes
   186         * otherwise.                  
   187         */
   188         virtual TInt BoolPropertyL(const TDesC8& aName,
   189                                    TBool& aValue) = 0;
   190                                    
   191         /**
   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(!).
   203         */                                   
   204 		virtual MSenProperties* Clone(TInt& aOkOrError) const = 0;
   205 
   206         /**
   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.
   211         */
   212         virtual TBool IsSafeToCast(TSenPropertiesClassType aClass) = 0;
   213         
   214         /**
   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(!).
   224         */                                   
   225         virtual MSenProperties* CloneL() const = 0;
   226     };
   227 
   228 #endif // M_SEN_PROPERTIES_H