Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/LDOM_BasicElement.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 2001-06-26
0002 // Created by: Alexander GRIGORIEV
0003 // Copyright (c) 2001-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 // AGV 140202: Repl.(const char *) for (LDOMBasicString) => myTagName
0017 
0018 #ifndef LDOM_BasicElement_HeaderFile
0019 #define LDOM_BasicElement_HeaderFile
0020 
0021 #include <LDOM_BasicNode.hxx>
0022 #include <LDOMBasicString.hxx>
0023 #include <LDOM_Node.hxx>
0024 
0025 class LDOM_NodeList;
0026 class LDOM_BasicAttribute;
0027 
0028 //  Class LDOM_BasicElement
0029 //
0030 
0031 class LDOM_BasicElement : public LDOM_BasicNode
0032 {
0033 public:
0034   // ---------- PUBLIC METHODS ----------
0035 
0036   LDOM_BasicElement()
0037       : LDOM_BasicNode(LDOM_Node::UNKNOWN),
0038         myTagName(NULL),
0039         myAttributeMask(0),
0040         myFirstChild(NULL)
0041   {
0042   }
0043 
0044   //    Empty constructor
0045 
0046   static LDOM_BasicElement& Create(const char*                    aName,
0047                                    const Standard_Integer         aLength,
0048                                    const Handle(LDOM_MemManager)& aDoc);
0049 
0050   //  Standard_EXPORT LDOM_BasicElement (const LDOM_BasicElement& theOther);
0051   //    Copy constructor
0052 
0053   Standard_EXPORT LDOM_BasicElement& operator=(const LDOM_NullPtr* aNull);
0054   //    Nullify
0055 
0056   Standard_EXPORT ~LDOM_BasicElement();
0057 
0058   //    Destructor
0059 
0060   const char* GetTagName() const { return myTagName; }
0061 
0062   const LDOM_BasicNode* GetFirstChild() const { return myFirstChild; }
0063 
0064   Standard_EXPORT const LDOM_BasicNode* GetLastChild() const;
0065 
0066   Standard_EXPORT const LDOM_BasicAttribute& GetAttribute(const LDOMBasicString& aName,
0067                                                           const LDOM_BasicNode*  aLastCh) const;
0068   //    Search for attribute name, using or setting myFirstAttribute
0069 
0070 protected:
0071   // ---------- PROTECTED METHODS ----------
0072 
0073   //  LDOM_BasicElement (const LDOM_Element& anElement);
0074   //    Constructor
0075 
0076   Standard_EXPORT const LDOM_BasicNode* AddAttribute(const LDOMBasicString&         anAttrName,
0077                                                      const LDOMBasicString&         anAttrValue,
0078                                                      const Handle(LDOM_MemManager)& aDoc,
0079                                                      const LDOM_BasicNode*          aLastCh);
0080   //    add or replace an attribute to the element
0081 
0082   Standard_EXPORT const LDOM_BasicNode* RemoveAttribute(const LDOMBasicString& aName,
0083                                                         const LDOM_BasicNode*  aLastCh) const;
0084 
0085   Standard_EXPORT void RemoveChild(const LDOM_BasicNode* aChild) const;
0086   //    remove a child element
0087 
0088   Standard_EXPORT void AppendChild(const LDOM_BasicNode*  aChild,
0089                                    const LDOM_BasicNode*& aLastCh) const;
0090   //    append a child node to the end of the list
0091 
0092 private:
0093   friend class LDOMParser;
0094   friend class LDOM_XmlReader;
0095   friend class LDOM_Document;
0096   friend class LDOM_Element;
0097   friend class LDOM_Node;
0098   // ---------- PRIVATE METHODS ----------
0099 
0100   const LDOM_BasicAttribute* GetFirstAttribute(const LDOM_BasicNode*&  aLastCh,
0101                                                const LDOM_BasicNode**& thePrN) const;
0102 
0103   void RemoveNodes();
0104 
0105   void ReplaceElement(const LDOM_BasicElement& anOther, const Handle(LDOM_MemManager)& aDoc);
0106   //    remark: recursive
0107 
0108   void AddElementsByTagName(LDOM_NodeList& aList, const LDOMBasicString& aTagName) const;
0109   //    remark: recursive
0110 
0111   void AddAttributes(LDOM_NodeList& aList, const LDOM_BasicNode* aLastCh) const;
0112   //    add attributes to list
0113 
0114 private:
0115   // ---------- PRIVATE FIELDS ----------
0116 
0117   //  LDOMBasicString       myTagName;
0118   const char*     myTagName;
0119   unsigned long   myAttributeMask;
0120   LDOM_BasicNode* myFirstChild;
0121 };
0122 
0123 #endif