SenBaseElement.h

Go to the documentation of this file.
00001 /*
00002 * ==============================================================================
00003 *  Name        : SenBaseElement.h
00004 *  Part of     : Web Services Xml
00005 *  Interface   : 
00006 *  Description : Implementation of an XML element functionality
00007 *  Version     : 
00008 *
00009 *  Copyright © 2002-2005 Nokia. All rights reserved.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia. All rights are reserved. Copying, including 
00013 *  reproducing, storing, adapting or translating, any 
00014 *  or all of this material requires the prior written consent of 
00015 *  Nokia. This material also contains confidential 
00016 *  information which may not be disclosed to others without the 
00017 *  prior written consent of Nokia.
00018 * ==============================================================================
00019 */
00020 
00021 #ifndef SEN_BASE_ELEMENT_H
00022 #define SEN_BASE_ELEMENT_H
00023 
00024 //  INCLUDES
00025 #include <s32mem.h>
00026 #include <SenElement.h>
00027 #include <SenNamespace.h>
00028 #include <SenBaseAttribute.h>
00029 
00030 // CLASS DECLARATION
00031 
00044 class CSenBaseElement : public CSenElement
00045     {
00046     public:  // Constructors and destructor
00047 
00056         IMPORT_C static CSenBaseElement* NewL(const TDesC8& aLocalName);
00065         IMPORT_C static CSenBaseElement* NewL(const TDesC8& aNsUri,
00066                                               const TDesC8& aLocalName);
00067 
00078         IMPORT_C static CSenBaseElement* NewL(const TDesC8& aNsUri,
00079                                               const TDesC8& aLocalName,
00080                                               const TDesC8& aQName);
00081 
00093         IMPORT_C static CSenBaseElement* NewL(const TDesC8& aNsUri,
00094                                               const TDesC8& aLocalName,
00095                                               const TDesC8& aQName,
00096                                               const RAttributeArray& apAttrs);
00097 
00110         IMPORT_C static CSenBaseElement* NewL(const TDesC8& aNsUri,
00111                                               const TDesC8& aLocalName,
00112                                               const TDesC8& aQName,
00113                                               const RAttributeArray& apAttrs,
00114                                               CSenElement& aParent);
00115 
00119         IMPORT_C virtual ~CSenBaseElement();
00120 
00121         // New functions
00122     
00128         IMPORT_C virtual void SetAttributesL(const RAttributeArray& apAttrs);
00129     
00130         // Functions from base classes
00131     
00132         // From CSenElement
00133     
00138         IMPORT_C virtual const TDesC8& LocalName() const;
00139 
00144         IMPORT_C virtual const TDesC8& NamespaceURI() const;
00145 
00150         IMPORT_C virtual const TDesC8& NsPrefix() const;
00151 
00156         IMPORT_C virtual void SetPrefixL(const TDesC8& aPrefix);
00157 
00162         IMPORT_C virtual TBool HasContent() const;
00163 
00168         IMPORT_C virtual TPtrC8 Content() const;
00169 
00174         IMPORT_C virtual HBufC* ContentUnicodeL() const;
00175 
00181         IMPORT_C virtual TPtrC8 SetContentL(const TDesC8& aContent);
00182 
00189         IMPORT_C virtual RWriteStream& ContentWriteStreamL();
00190 
00201         IMPORT_C virtual TBool ConsistsOfL(MSenElement& aCandidate);
00202 
00207         IMPORT_C virtual void SetNamespaceL(const TDesC8& aNsUri);
00208 
00214         IMPORT_C virtual void SetNamespaceL(const TDesC8& aNsPrefix,
00215                                             const TDesC8& aNsUri);
00216 
00226         IMPORT_C virtual const CSenNamespace* AddNamespaceL(
00227                                             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 
00250         IMPORT_C virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix);
00251 
00262         IMPORT_C virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix,
00263                                                         const TBool aCheckInParent);
00264 
00272         IMPORT_C virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix,
00273                                                         const TDesC8& aUri);
00274 
00286         IMPORT_C virtual TInt ElementsL(RPointerArray<CSenElement>& aElementArray,
00287                                         const TDesC8& aNsUri,
00288                                         const TDesC8& aLocalName);
00289         
00301         IMPORT_C virtual TInt ElementsL(RPointerArray<CSenElement>& aElementArray,
00302                                         const TDesC8& aLocalName);
00303 
00310         IMPORT_C virtual RPointerArray<CSenElement>& ElementsL();
00311 
00317         IMPORT_C virtual RPointerArray<CSenBaseAttribute>& AttributesL();
00318 
00324         IMPORT_C virtual RPointerArray<CSenNamespace>& NamespacesL();
00325 
00332         IMPORT_C virtual const TDesC8* AttrValue(const TDesC8& aName);
00333         
00338         IMPORT_C virtual void AddAttrL(const TDesC8& aName, const TDesC8& aValue);
00339 
00345         IMPORT_C virtual CSenElement* Parent();
00346 
00354         IMPORT_C virtual CSenElement* SetParent(CSenElement* apParent);
00355 
00360         IMPORT_C virtual MSenElement& Root();
00361 
00368         IMPORT_C virtual CSenElement* Element(const TDesC8& aLocalName);
00369 
00375         IMPORT_C virtual CSenElement* Element(  const TDesC8& aNsUri,
00376                                                 const TDesC8& aLocalName);
00377 
00390         IMPORT_C virtual CSenElement* CreateElementL(const TDesC8& aNsPrefix,
00391                                                      const TDesC8& aLocalName);
00392 
00405         IMPORT_C virtual CSenElement& InsertElementL(CSenElement& aElement,
00406                                                      const CSenElement& aBeforeElement);
00407 
00414         IMPORT_C virtual CSenElement& AddElementL(CSenElement& aElement);
00415 
00426         IMPORT_C virtual CSenElement& AddElementL(  const TDesC8& aNsUri,
00427                                                     const TDesC8& aLocalName);
00428 
00441         IMPORT_C virtual CSenElement& AddElementL(const TDesC8& aNsUri,
00442                                                   const TDesC8& aLocalName,
00443                                                   const TDesC8& aQName);
00444 
00457         IMPORT_C virtual CSenElement& AddElementL(const TDesC8& aLocalName);
00458 
00466         IMPORT_C virtual CSenElement* RemoveElement(CSenElement& aElement);
00467 
00476         IMPORT_C virtual CSenElement* RemoveElement(const TDesC8& aNsUri,
00477                                                     const TDesC8& aLocalName);
00478 
00486         IMPORT_C virtual CSenElement* RemoveElement(const TDesC8& aLocalName);
00487 
00498         IMPORT_C virtual CSenElement* ReplaceElementL(CSenElement& aElement);
00499 
00504         IMPORT_C virtual HBufC8* AsXmlL();
00505 
00511         IMPORT_C virtual HBufC* AsXmlUnicodeL();
00512 
00517         IMPORT_C virtual void WriteAsXMLToL(RWriteStream& aWriteStream);
00518 
00524         IMPORT_C virtual void WriteNamespacesToL(RWriteStream& aWriteStream);
00525 
00532         IMPORT_C virtual MSenElement* AsElement();
00533 
00539         IMPORT_C void CopyFromL(CSenElement& aSource);
00540 
00548         IMPORT_C virtual CSenElement* DetachL();
00549 
00556         IMPORT_C virtual CSenElement* Child(TInt aIndex);
00557 
00568         IMPORT_C virtual void Set(const TDesC8& aNsUri, 
00569                                   const TDesC8& aLocalName,
00570                                     const TDesC8& aQName);
00571 
00576         IMPORT_C virtual void AddAttributesL(const RAttributeArray& apAttrs);
00577 
00578     protected:  
00579     
00583         IMPORT_C CSenBaseElement();
00584 
00590         IMPORT_C void BaseConstructL(   const TDesC8& aLocalName);
00591         
00592         IMPORT_C void BaseConstructL(   const TDesC8& aNsUri,
00593                                         const TDesC8& aLocalName);
00594         
00595         IMPORT_C void BaseConstructL(   const TDesC8& aNsUri,
00596                                         const TDesC8& aLocalName,
00597                                         const TDesC8& aQName);
00598 
00599         IMPORT_C void BaseConstructL(   const TDesC8& aNsUri,
00600                                         const TDesC8& aLocalName,
00601                                         const TDesC8& aQName,
00602                                         const RAttributeArray& apAttrs);
00603 
00604         IMPORT_C void BaseConstructL(   const TDesC8& aNsUri,
00605                                         const TDesC8& aLocalName,
00606                                         const TDesC8& aQName,
00607                                         const RAttributeArray& apAttrs,
00608                                         CSenElement& aParent);
00609     
00610         // New functions
00611         
00618         IMPORT_C virtual CSenBaseAttribute* FindAttr(const TDesC8& aName);
00619 
00627         IMPORT_C virtual TInt IndexOfElement(const TDesC8& aNsUri,
00628                                              const TDesC8& aLocalName) const;
00629         
00634         IMPORT_C virtual void WriteAttrsToL(RWriteStream& aWriteStream);
00635 
00642         IMPORT_C virtual void WriteAttrToL(RWriteStream& aWriteStream,
00643                                            const TDesC8& aName,
00644                                            const TDesC8& aValue);
00645 
00650         IMPORT_C virtual void WriteElementsToL(RWriteStream& aWriteStream);
00651 
00656         IMPORT_C virtual void WriteContentToL(RWriteStream& aWriteStream);
00657 
00670         IMPORT_C virtual const TDesC8& AddAttributeL(const TDesC8& aQName,
00671                                                      const TDesC8& aLocalName,
00672                                                      const TDesC8& aValue);
00673 
00685         IMPORT_C virtual const TDesC8& AddAttributeL(const TDesC8& aAttrName,
00686                                                      const TDesC8& aValue);
00687 
00694         IMPORT_C const TDesC8& AddAttributeL(CSenBaseAttribute* apAttribute);
00695 
00699         IMPORT_C virtual void AllocContentBufL();
00700         
00706         IMPORT_C virtual TPtrC8 WriteToBufL(CBufBase& aBuf);
00707 
00708     private: // New functions
00709             
00710         void AddNamespaceMissingFromL(RPointerArray<CSenNamespace>& aNamespaces);
00711 
00712     private: // Data
00713         HBufC8* ipLocalName; // Owned
00714         HBufC8* iNotUsed;   // Not used (kept for binary compatibility)
00715         CBufFlat* ipContentBuf; // Owned
00716         RBufWriteStream iContentWriteStream;
00717         RPointerArray<CSenBaseAttribute> iAttrs;    // Elements owned
00718         RPointerArray<CSenElement> iElements;       // Elements owned
00719         RPointerArray<CSenNamespace> iNamespaces;   // Elements owned
00720         CSenElement*    ipParent;                   // Not owned
00721         CSenNamespace*  ipNamespace;                // Not Owned (deleted in upper level array)
00722     };
00723 
00724 #endif // SEN_BASE_ELEMENT_H
00725 
00726 // End of File
00727 

Copyright © Nokia Corporation 2001-2007
Back to top