SenXmlElement.h

Go to the documentation of this file.
00001 /*
00002 * =========================================================================
00003 *  Name        : SenXmlElement.h
00004 *  Part of     : Web Services Xml
00005 *  Interface   : 
00006 *  Description : This is an optimized variant of XML element, which consumes
00007 *                significantly less heap when compared to CSenBaseElement
00008 *  Version     : 
00009 *
00010 *  Copyright © 2002-2006 Nokia. All rights reserved.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia. All rights are reserved. Copying, including 
00014 *  reproducing, storing, adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia.
00019 * ==============================================================================
00020 */
00021 
00022 #ifndef SEN_XML_ELEMENT_H
00023 #define SEN_XML_ELEMENT_H
00024 
00025 //  INCLUDES
00026 #include <s32mem.h>
00027 #include <SenElement.h>
00028 #include <SenNamespace.h>
00029 #include <SenBaseAttribute.h>
00030 
00031 // CLASS DECLARATION
00032 
00045 class CSenXmlElement : public CSenElement
00046     {
00047     public:  // Constructors and destructor
00048 
00057         IMPORT_C static CSenXmlElement* NewL(const TDesC8& aLocalName);
00066         IMPORT_C static CSenXmlElement* NewL(const TDesC8& aNsUri,
00067                                              const TDesC8& aLocalName);
00068 
00079         IMPORT_C static CSenXmlElement* NewL(const TDesC8& aNsUri,
00080                                              const TDesC8& aLocalName,
00081                                              const TDesC8& aQName);
00082 
00094         IMPORT_C static CSenXmlElement* NewL(const TDesC8& aNsUri, 
00095                                              const TDesC8& aLocalName,
00096                                              const TDesC8& aQName,
00097                                              const RAttributeArray& apAttrs);
00098 
00111         IMPORT_C static CSenXmlElement* NewL(const TDesC8& aNsUri,
00112                                              const TDesC8& aLocalName,
00113                                              const TDesC8& aQName,
00114                                              const RAttributeArray& apAttrs,
00115                                              CSenElement& aParent);
00116 
00120         IMPORT_C virtual ~CSenXmlElement();
00121 
00122     public: // New functions
00123     
00129         IMPORT_C virtual void SetAttributesL(const RAttributeArray& apAttrs);
00130     
00131         // Functions from base classes
00132     
00133         // From CSenElement
00134     
00139         IMPORT_C virtual const TDesC8& LocalName() const;
00140 
00145         IMPORT_C virtual const TDesC8& NamespaceURI() const;
00146 
00151         IMPORT_C virtual const TDesC8& NsPrefix() const;
00152 
00157         IMPORT_C virtual void SetPrefixL(const TDesC8& aPrefix);
00158 
00163         IMPORT_C virtual TBool HasContent() const;
00164 
00169         IMPORT_C virtual TPtrC8 Content() const;
00170 
00175         IMPORT_C virtual HBufC* ContentUnicodeL() const;
00176 
00182         IMPORT_C virtual TPtrC8 SetContentL(const TDesC8& aContent);
00183 
00190         IMPORT_C virtual RWriteStream& ContentWriteStreamL();
00191 
00202         IMPORT_C virtual TBool ConsistsOfL(MSenElement& aCandidate);
00203 
00208         IMPORT_C virtual void SetNamespaceL(const TDesC8& aNsUri);
00209 
00215         IMPORT_C virtual void SetNamespaceL(const TDesC8& aNsPrefix,
00216                                             const TDesC8& aNsUri);
00217 
00227         IMPORT_C virtual const CSenNamespace* AddNamespaceL(CSenNamespace& aNewNamespace,
00228                                                             TBool aCheckInParent);
00235         IMPORT_C virtual const CSenNamespace* AddNamespaceL(const TDesC8& aPrefix,
00236                                                             const TDesC8& aUri);
00242         IMPORT_C virtual const CSenNamespace* Namespace();
00243 
00251         IMPORT_C virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix);
00252 
00265         IMPORT_C virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix,
00266                                                         const TBool aCheckInParent);
00267 
00276         IMPORT_C virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix,
00277                                                         const TDesC8& aUri);
00278 
00290         IMPORT_C virtual TInt ElementsL(RPointerArray<CSenElement>& aElementArray,
00291                                         const TDesC8& aNsUri,
00292                                         const TDesC8& aLocalName);
00293         
00305         IMPORT_C virtual TInt ElementsL(RPointerArray<CSenElement>& aElementArray,
00306                                         const TDesC8& aLocalName);
00307 
00314         IMPORT_C virtual RPointerArray<CSenElement>& ElementsL();
00315 
00321         IMPORT_C virtual RPointerArray<CSenBaseAttribute>& AttributesL();
00322 
00328         IMPORT_C virtual RPointerArray<CSenNamespace>& NamespacesL();
00329 
00336         IMPORT_C virtual const TDesC8* AttrValue(const TDesC8& aName);
00337         
00342         IMPORT_C virtual void AddAttrL(const TDesC8& aName, const TDesC8& aValue);
00343 
00349         IMPORT_C virtual CSenElement* Parent();
00350 
00358         IMPORT_C virtual CSenElement* SetParent(CSenElement* apParent);
00359 
00364         IMPORT_C virtual MSenElement& Root();
00365 
00372         IMPORT_C virtual CSenElement* Element(const TDesC8& aLocalName);
00373 
00379         IMPORT_C virtual CSenElement* Element(const TDesC8& aNsUri,
00380                                               const TDesC8& aLocalName);
00381 
00394         IMPORT_C virtual CSenElement* CreateElementL(const TDesC8& aNsPrefix,
00395                                                      const TDesC8& aLocalName);
00396 
00409         IMPORT_C virtual CSenElement& InsertElementL(CSenElement& aElement,
00410                                                      const CSenElement& aBeforeElement);
00411 
00418         IMPORT_C virtual CSenElement& AddElementL(CSenElement& aElement);
00419 
00430         IMPORT_C virtual CSenElement& AddElementL(const TDesC8& aNsUri,
00431                                                   const TDesC8& aLocalName);
00432 
00445         IMPORT_C virtual CSenElement& AddElementL(const TDesC8& aNsUri,
00446                                                   const TDesC8& aLocalName,
00447                                                   const TDesC8& aQName);
00448 
00461         IMPORT_C virtual CSenElement& AddElementL(const TDesC8& aLocalName);
00462 
00470         IMPORT_C virtual CSenElement* RemoveElement(CSenElement& aElement);
00471 
00480         IMPORT_C virtual CSenElement* RemoveElement(const TDesC8& aNsUri,
00481                                                     const TDesC8& aLocalName);
00482 
00490         IMPORT_C virtual CSenElement* RemoveElement(const TDesC8& aLocalName);
00491 
00502         IMPORT_C virtual CSenElement* ReplaceElementL(CSenElement& aElement);
00503 
00508         IMPORT_C virtual HBufC8* AsXmlL();
00509 
00515         IMPORT_C virtual HBufC* AsXmlUnicodeL();
00516 
00521         IMPORT_C virtual void WriteAsXMLToL(RWriteStream& aWriteStream);
00522 
00528         IMPORT_C virtual void WriteNamespacesToL(RWriteStream& aWriteStream);
00529 
00536         IMPORT_C virtual MSenElement* AsElement();
00537 
00543         IMPORT_C void CopyFromL(CSenElement& aSource);
00544 
00552         IMPORT_C virtual CSenElement* DetachL();
00553 
00560         IMPORT_C virtual CSenElement* Child(TInt aIndex);
00561 
00572         IMPORT_C virtual void Set(const TDesC8& aNsUri,
00573                                   const TDesC8& aLocalName,
00574                                   const TDesC8& aQName);
00575 
00580         IMPORT_C virtual void AddAttributesL(const RAttributeArray& apAttrs);
00581 
00582         void Compress();
00583         
00584     protected:  // New functions
00585     
00589         IMPORT_C CSenXmlElement();
00590 
00596         IMPORT_C void BaseConstructL(const TDesC8& aLocalName);
00597 
00598         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00599                                      const TDesC8& aLocalName);
00600         
00601         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00602                                      const TDesC8& aLocalName,
00603                                      const TDesC8& aQName);
00604 
00605         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00606                                      const TDesC8& aLocalName,
00607                                      const TDesC8& aQName,
00608                                      const RAttributeArray& apAttrs);
00609 
00610         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00611                                      const TDesC8& aLocalName,
00612                                      const TDesC8& aQName,
00613                                      const RAttributeArray& apAttrs,
00614                                      CSenElement& aParent);
00615     
00622         IMPORT_C virtual CSenBaseAttribute* FindAttr(const TDesC8& aName);
00623 
00631         IMPORT_C virtual TInt IndexOfElement(const TDesC8& aNsUri,
00632                                              const TDesC8& aLocalName) const;
00633         
00638         IMPORT_C virtual void WriteAttrsToL(RWriteStream& aWriteStream);
00639 
00646         IMPORT_C virtual void WriteAttrToL(RWriteStream& aWriteStream,
00647                                            const TDesC8& aName,
00648                                            const TDesC8& aValue);
00649 
00654         IMPORT_C virtual void WriteElementsToL(RWriteStream& aWriteStream);
00655 
00660         IMPORT_C virtual void WriteContentToL(RWriteStream& aWriteStream);
00661 
00674         IMPORT_C virtual const TDesC8& AddAttributeL(const TDesC8& aQName,
00675                                                      const TDesC8& aLocalName,
00676                                                      const TDesC8& aValue);
00677 
00689         IMPORT_C virtual const TDesC8& AddAttributeL(const TDesC8& aAttrName,
00690                                                      const TDesC8& aValue);
00691 
00698         IMPORT_C const TDesC8& AddAttributeL(CSenBaseAttribute* apAttribute);
00699 
00703         IMPORT_C virtual void AllocContentBufL();
00704         
00710         IMPORT_C virtual TPtrC8 WriteToBufL(CBufBase& aBuf);
00711 
00712     private:
00713         void AddNamespaceMissingFromL(RPointerArray<CSenNamespace>& aNamespaces);
00714 
00715     private:    // Data
00716          
00717         HBufC8* ipLocalName;                            // Owned
00718 
00719         CBufFlat* ipContentBuf;                         // Owned
00720 
00721         RBufWriteStream* ipContentWriteStream;          // Owned
00722 
00723         RPointerArray<CSenBaseAttribute>* ipAttrs;      // Elements owned
00724 
00725         RPointerArray<CSenElement>* ipElements;         // Elements owned
00726 
00727         RPointerArray<CSenNamespace>* ipNamespaces;     // Elements owned
00728 
00729         CSenElement*    ipParent;                       // Not owned
00730 
00731         CSenNamespace*  ipNamespace;                    // Not Owned (deleted in upper level array)
00732         
00733     };
00734 
00735 #endif // SEN_XML_ELEMENT_H
00736 
00737 // End of File
00738 

Copyright © Nokia Corporation 2001-2007
Back to top