webservices/wsframework/inc/senlayeredxmlproperties.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2006 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: Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef SEN_LAYERED_XML_PROPERTIES_H
       
    26 #define SEN_LAYERED_XML_PROPERTIES_H
       
    27 
       
    28 #include <e32std.h>
       
    29 #include <SenDomFragment.h>
       
    30 
       
    31 #include "msenlayeredproperties.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class RWriteStream;
       
    35 class CSenXmlReader;
       
    36 class CSenPropertiesFragment;
       
    37 
       
    38 _LIT8(KSenLayeredXmlPropertiesLocalname,      "Properties");
       
    39 
       
    40 class CSenLayeredXmlProperties : public CBase, public MSenLayeredProperties
       
    41     {
       
    42     public:
       
    43 
       
    44         static CSenLayeredXmlProperties* NewL();
       
    45         static CSenLayeredXmlProperties* NewLC();
       
    46 
       
    47         static CSenLayeredXmlProperties* NewL(const TDesC8& aXmlUtf8, CSenXmlReader& aParser);
       
    48         static CSenLayeredXmlProperties* NewLC(const TDesC8& aXmlUtf8, CSenXmlReader& aParser);
       
    49 
       
    50         static CSenLayeredXmlProperties* NewL(const CSenElement& aElement);
       
    51         static CSenLayeredXmlProperties* NewLC(const CSenElement& aElement);
       
    52 
       
    53         static CSenLayeredXmlProperties* NewL(RStringPool& aStringPool);
       
    54         static CSenLayeredXmlProperties* NewLC(RStringPool& aStringPool);
       
    55 
       
    56         static CSenLayeredXmlProperties* NewL(const TDesC8& aXmlUtf8, CSenXmlReader& aParser, RStringPool& aStringPool);
       
    57         static CSenLayeredXmlProperties* NewLC(const TDesC8& aXmlUtf8, CSenXmlReader& aParser, RStringPool& aStringPool);
       
    58 
       
    59         static CSenLayeredXmlProperties* NewL(const CSenElement& aElement, RStringPool& aStringPool);
       
    60         static CSenLayeredXmlProperties* NewLC(const CSenElement& aElement, RStringPool& aStringPool);
       
    61 
       
    62         // From MSenProperties
       
    63         virtual void SetReader(CSenXmlReader& aReader);
       
    64         virtual TSenPropertiesClassType PropertiesClassType();
       
    65         virtual void WriteToL(RWriteStream& aWriteStream);
       
    66         virtual void ReadFromL(const TDesC8& aBuffer);
       
    67         virtual HBufC8* AsUtf8L();
       
    68         virtual HBufC8* AsUtf8LC();
       
    69         virtual TBool IsSafeToCast(TSenPropertiesClassType aClass);
       
    70         /**
       
    71         * @see MSenProperties
       
    72         * Leave codes: 
       
    73         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
    74         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
    75         */
       
    76         virtual TInt SetPropertyL(const TDesC8& aName,
       
    77                                   const TDesC8& aValue);
       
    78                                   
       
    79         virtual TInt PropertyL(const TDesC8& aName, 
       
    80                                TPtrC8& aValue);
       
    81                
       
    82         /**
       
    83         * @see MSenProperties
       
    84         * Leave codes: 
       
    85         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
    86         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
    87         */
       
    88         virtual TInt SetIntPropertyL(const TDesC8& aName,
       
    89                                      const TInt aValue);
       
    90                                      
       
    91         virtual TInt IntPropertyL(const TDesC8& aName,
       
    92                                   TInt& aValue);
       
    93         /**
       
    94         * @see MSenProperties
       
    95         * Leave codes: 
       
    96         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
    97         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
    98         */
       
    99         virtual TInt SetBoolPropertyL(const TDesC8& aName,
       
   100                                       const TBool aValue);
       
   101         virtual TInt BoolPropertyL(const TDesC8& aName,
       
   102                                    TBool& aValue);
       
   103         /**
       
   104         * @see MSenProperties
       
   105         * Leave codes: 
       
   106         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
   107         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
   108         */
       
   109         virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue);
       
   110         virtual TInt RemovePropertyL(const TDesC8& aName);
       
   111                                    
       
   112         // From MSenLayeredProperties 
       
   113         virtual void WriteToL(RWriteStream& aWriteStream, TSenPropertiesLayer aLayer);
       
   114         virtual void ReadFromL(const TDesC8& aBuffer, TSenPropertiesLayer aLayer);
       
   115         virtual HBufC8* AsUtf8L(TSenPropertiesLayer aLayer);
       
   116         virtual HBufC8* AsUtf8LC(TSenPropertiesLayer aLayer);        
       
   117         virtual TInt ShrinkTo(TSenPropertiesLayer aLayer);
       
   118         virtual void ExpandToL(TSenPropertiesLayer aLayer);
       
   119         virtual TSenPropertiesLayer TopLayer();
       
   120 
       
   121         /**
       
   122         * @see MSenLayeredProperties
       
   123         * Leave codes: 
       
   124         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
   125         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
   126         */
       
   127         virtual TInt SetPropertyL(const TDesC8& aName, 
       
   128                                   const TDesC8& aValue,
       
   129                                   TSenPropertiesLayer aLayer);
       
   130                                   
       
   131         virtual TInt PropertyL(const TDesC8& aName, 
       
   132                                TPtrC8& aValue,
       
   133                                TSenPropertiesLayer aLayer);
       
   134                                
       
   135         virtual TInt PropertyL(const TDesC8& aName,
       
   136                                MSenProperty*& aValue,
       
   137                                TSenPropertiesLayer aLayer);
       
   138         
       
   139         virtual TInt PropertyL(const TDesC8& aName,
       
   140                                MSenProperty*& aValue);      
       
   141                                
       
   142         /**
       
   143         * Sets new property with certain type. 
       
   144         *
       
   145         * If property with given name does not exist, 
       
   146         * new property with given value will be added. Otherwise the value of 
       
   147         * existing property will be updated.
       
   148         *
       
   149         * @since Series60
       
   150         * @param aName         Name of the property, which can be later used to
       
   151         *                      refer the given value.
       
   152         * @param aValue        Is the value of this property.
       
   153         * @param aType         Is the type of this property.
       
   154         * @return              KErrNone if no error, or some of the system wide
       
   155         *                      error codes.
       
   156         */
       
   157         virtual TInt SetPropertyL(const TDesC8& aName, 
       
   158                                   const TDesC8& aValue,
       
   159                                   const TDesC8& aType);
       
   160 
       
   161         /**
       
   162         * Gets the value of the property behind certain name.
       
   163         * @since Series60
       
   164         * @param aName    The name identifying this property.
       
   165         * @param aValue   A TPtrC8 reference to be filled in with the value of
       
   166         *                 the property.
       
   167         * @param aType    A TPtrC8 reference to be filled in with the type of
       
   168         *                 the property.
       
   169         * @return         KErrNone if no error, or some of the system wide
       
   170         *                 error codes.     
       
   171         */
       
   172         virtual TInt PropertyL(const TDesC8& aName, 
       
   173                                TPtrC8& aValue,
       
   174                                TPtrC8& aType);                                                        
       
   175 
       
   176         virtual TInt PropertiesByTypeL(const TDesC8& aTypeName,
       
   177                                        RPointerArray<MSenProperty>& aArray);
       
   178                                
       
   179         /**
       
   180         * @see MSenLayeredProperties
       
   181         * Leave codes: 
       
   182         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
   183         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
   184         */
       
   185         virtual TInt SetIntPropertyL(const TDesC8& aName, const TInt aValue,
       
   186                                      TSenPropertiesLayer aLayer);
       
   187                                      
       
   188         virtual TInt IntPropertyL(const TDesC8& aName, TInt& aValue,
       
   189                                   TSenPropertiesLayer aLayer);
       
   190                                   
       
   191         virtual MSenProperties* CloneL() const;
       
   192         
       
   193         virtual MSenProperties* Clone(TInt& aOkOrError) const;
       
   194         
       
   195         /**
       
   196         * @see MSenLayeredProperties
       
   197         * Leave codes: 
       
   198         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
   199         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
   200         */
       
   201         virtual TInt SetBoolPropertyL(const TDesC8& aName, const TBool aValue,
       
   202                                       TSenPropertiesLayer aLayer);
       
   203                                       
       
   204         virtual TInt BoolPropertyL(const TDesC8& aName, TBool& aValue,
       
   205                                    TSenPropertiesLayer aLayer);        
       
   206                                    
       
   207         /**
       
   208         * @see MSenLayeredProperties
       
   209         * Leave codes: 
       
   210         *      KErrSenInvalidCharacters if aName contains illegal characters.     
       
   211         *      KErrSenZeroLengthDescriptor if aName is zero length.
       
   212         */
       
   213         virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue,
       
   214                                  TSenPropertiesLayer aLayer);
       
   215 
       
   216         virtual TInt RemovePropertyL(const TDesC8& aName,
       
   217                                      TSenPropertiesLayer aLayer);
       
   218                                      
       
   219         /**
       
   220         * Destructor.
       
   221         */
       
   222         virtual ~CSenLayeredXmlProperties();
       
   223 
       
   224     protected: // base class functions
       
   225 
       
   226         virtual void BaseConstructL(const TDesC8& aLocalname, 
       
   227                                     const TDesC8& aXml,
       
   228                                     CSenXmlReader* aParser = NULL,
       
   229                                     RStringPool* aStringPool = NULL);
       
   230 
       
   231         virtual void BaseConstructL(const TDesC8& aNamespace, 
       
   232                                     const TDesC8& aLocalname, 
       
   233                                     const TDesC8& aXml,
       
   234                                     CSenXmlReader* aParser = NULL,
       
   235                                     RStringPool* aStringPool = NULL);
       
   236 
       
   237         virtual void BaseConstructL(const TDesC8& aNamespace, 
       
   238                                     const TDesC8& aLocalname, 
       
   239                                     const TDesC8& aQualifiedName, 
       
   240                                     const TDesC8& aXml,
       
   241                                     CSenXmlReader* aParser = NULL,
       
   242                                     RStringPool* aStringPool = NULL);
       
   243 
       
   244         virtual void BaseConstructL(const CSenElement& aElement,
       
   245                                     RStringPool* aStringPool = NULL);
       
   246 
       
   247         virtual TInt AllPropertiesByTypeL(const TDesC8& aTypeName,
       
   248                                           RPointerArray<MSenProperty>& aArray);
       
   249 
       
   250     protected:
       
   251         /**
       
   252         * Constructor.
       
   253         */
       
   254         CSenLayeredXmlProperties();
       
   255         
       
   256     private:
       
   257         void CreateChildPropertiesL(); //codescannerwarnings
       
   258         void ElementsL(RPointerArray<CSenElement>& aProps) const;
       
   259         
       
   260     protected:
       
   261         CSenPropertiesFragment*     ipFragment;
       
   262         CSenLayeredXmlProperties*   ipChildProperties;
       
   263         
       
   264     private:
       
   265         TSenPropertiesLayer         iLayer;
       
   266         CSenXmlReader*              ipReader;
       
   267         CSenLayeredXmlProperties*   ipParentProperties;
       
   268     };
       
   269 
       
   270 #endif // SEN_LAYERED_XML_PROPERTIES_H
       
   271 
       
   272 // End of File
       
   273