SenXmlProperties.h

Go to the documentation of this file.
00001 /*
00002 * =========================================================================
00003 *  Name     : SenXmlProperties.h
00004 *  Part of  : Nokia Web Services Framework
00005 *  Created  : 2005-09-26 by Nokia
00006 *  Descr.   : Superclass for XML based properties implementations
00007 *   
00008 *  Copyright © 2002-2005 Nokia. All rights reserved.
00009 *  This material, including documentation and any related 
00010 *  computer programs, is protected by copyright controlled by 
00011 *  Nokia. All rights are reserved. Copying, including 
00012 *  reproducing, storing, adapting or translating, any 
00013 *  or all of this material requires the prior written consent of 
00014 *  Nokia. This material also contains confidential 
00015 *  information which may not be disclosed to others without the 
00016 *  prior written consent of Nokia.
00017 * ==============================================================================
00018 */
00019 
00020 
00021 #ifndef SEN_XML_PROPERTIES_H
00022 #define SEN_XML_PROPERTIES_H
00023 
00024 #include <e32std.h>
00025 #include <SenDomFragment.h>
00026 #include <MSenProperties.h>
00027 
00028 // FORWARD DECLARATIONS
00029 class RWriteStream;
00030 class CSenXmlReader;
00031 class CSenPropertiesFragment;
00032 
00033 // CONSTANTS
00034 _LIT8(KSenXmlPropertiesLocalname,       "Properties");
00035 _LIT8(KSenTypeAttributeName,            "Type");
00036 _LIT8(KSenOmittedAttributeName,         "Omitted");
00037 _LIT8(KSenOmittedTrueNoValue,            "");
00038 _LIT8(KSenPropertyTrue,                 "true");
00039 _LIT8(KSenPropertyFalse,                "false");
00040 
00041 
00042 //_LIT8(KSenXmlPropertiesQualifiedname,  "props:Properties);
00043 //_LIT8(KSenXmlPropertiesNamespace,      "urn:com.nokia.Sen.properties.1.0");
00044 
00045 // CLASS DESCRIPTION
00046 
00047 /*
00048 * 
00049 * This class provides XML based implementation, which is mainly targetted
00050 * for further evolved subclasses, which extend this to more concrete classes,
00051 * like CSenHttpTransportProperties. Class provides serialization of properties
00052 * into XML.
00053 * 
00054 * Please bear in mind the following limitations:
00055 * 
00056 * 1. It is illegal to provide following property names as argument to 
00057 *    any of the setter methods, as they become XML tags - local element
00058 *    names - when properties object is serialized:
00059 *      (a) zero-length descriptor
00060 *      (b) descriptor starts with number and
00061 *      c descriptor contains any of the 5 basic XML entities in 
00062 *          unencoded form (&, ', ", <, >)
00063 * 
00064 * 2. It is illegal to provide following property values as argument to 
00065 *    any of the setter methods, as they become XML element content when 
00066 *    properties object is serialized:
00067 *      (a) descriptor contains any of the 5 basic XML entities in
00068 *      unencoded form (&, ', ", <, >)
00069 * @lib SenUtils.lib
00070 * @since Series60 5.0
00071 */
00072 
00073 class CSenXmlProperties : public CBase, public MSenProperties
00074     {
00075     public:
00076 
00081         IMPORT_C static CSenXmlProperties* NewL();
00086         IMPORT_C static CSenXmlProperties* NewLC();
00087 
00094         IMPORT_C static CSenXmlProperties* NewL(const TDesC8& aXmlUtf8,
00095                                        CSenXmlReader& aParser);
00102         IMPORT_C static CSenXmlProperties* NewLC(const TDesC8& aXmlUtf8,
00103                                         CSenXmlReader& aParser);
00104 
00110         IMPORT_C static CSenXmlProperties* NewL(const CSenElement& aElement);
00116         IMPORT_C static CSenXmlProperties* NewLC(const CSenElement& aElement);
00117 
00118         // From MSenProperties
00119         virtual void SetReader(CSenXmlReader& aReader);
00120         virtual TSenPropertiesClassType PropertiesClassType();
00121         virtual void WriteToL(RWriteStream& aWriteStream);
00122         virtual void ReadFromL(const TDesC8& aBuffer);
00123         virtual HBufC8* AsUtf8L();
00124         virtual HBufC8* AsUtf8LC();
00125         virtual TBool IsSafeToCast(TSenPropertiesClassType aClass);
00126         
00127         virtual MSenProperties* Clone(TInt& aOkOrError) const;
00128         virtual MSenProperties* CloneL() const;
00129 
00136         virtual TInt SetPropertyL(const TDesC8& aName,
00137                                   const TDesC8& aValue);
00138 
00139         virtual TInt PropertyL(const TDesC8& aName, TPtrC8& aValue);
00140         
00147         virtual TInt SetIntPropertyL(const TDesC8& aName,
00148                                      const TInt aValue);
00149                                      
00150         virtual TInt IntPropertyL(const TDesC8& aName,
00151                                   TInt& aValue);
00158         virtual TInt SetBoolPropertyL(const TDesC8& aName,
00159                                       const TBool aValue);
00160                                       
00161         virtual TInt BoolPropertyL(const TDesC8& aName,
00162                                    TBool& aValue);        
00163         virtual TInt SetOmittedL(const TDesC8& aName, TBool aValue);
00164 
00165         virtual TInt RemovePropertyL(const TDesC8& aName);
00169         virtual ~CSenXmlProperties();
00170         
00186         virtual TInt SetPropertyL(const TDesC8& aName, 
00187                                   const TDesC8& aValue,
00188                                   const TDesC8& aType);
00189 
00201         virtual TInt PropertyL(const TDesC8& aName, 
00202                                TPtrC8& aValue,
00203                                TPtrC8& aType);
00204     
00205     protected: // base class functions
00206 
00207         virtual void BaseConstructL(const TDesC8& aLocalname, 
00208                                     const TDesC8& aXml,
00209                                     CSenXmlReader* aParser = NULL);
00210 
00211         virtual void BaseConstructL(const TDesC8& aNamespace, 
00212                                     const TDesC8& aLocalname, 
00213                                     const TDesC8& aXml,
00214                                     CSenXmlReader* aParser = NULL);
00215 
00216         virtual void BaseConstructL(const TDesC8& aNamespace, 
00217                                     const TDesC8& aLocalname, 
00218                                     const TDesC8& aQualifiedName, 
00219                                     const TDesC8& aXml,
00220                                     CSenXmlReader* aParser = NULL);
00221 
00222         virtual void BaseConstructL(const CSenElement& aElement);
00223 
00224     protected:
00228         CSenXmlProperties();
00229 
00230     protected:
00231         CSenPropertiesFragment*     ipFragment; // owned
00232         CSenXmlReader*              ipReader;   // owned
00233     };
00234 
00235 #endif // SEN_XML_PROPERTIES_H

Copyright © Nokia Corporation 2001-2007
Back to top