Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:12

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  
0035   // ---------- PUBLIC METHODS ----------
0036 
0037   LDOM_BasicElement ()
0038     : LDOM_BasicNode    (LDOM_Node::UNKNOWN),
0039       myTagName         (NULL),
0040       myAttributeMask   (0),
0041       myFirstChild      (NULL) {}
0042   //    Empty constructor
0043 
0044   static LDOM_BasicElement& Create (const char                     * aName,
0045                                     const Standard_Integer         aLength,
0046                                     const Handle(LDOM_MemManager)& aDoc);
0047 
0048 //  Standard_EXPORT LDOM_BasicElement (const LDOM_BasicElement& theOther);
0049   //    Copy constructor
0050 
0051   Standard_EXPORT LDOM_BasicElement&
0052                 operator =              (const LDOM_NullPtr * aNull);
0053   //    Nullify
0054 
0055   Standard_EXPORT ~LDOM_BasicElement ();
0056   //    Destructor
0057 
0058   const char *  GetTagName              () const { return myTagName; }
0059 
0060   const LDOM_BasicNode *
0061                 GetFirstChild           () const { return myFirstChild; }
0062 
0063   Standard_EXPORT const LDOM_BasicNode *
0064                 GetLastChild            () const;
0065 
0066   Standard_EXPORT const LDOM_BasicAttribute&
0067                 GetAttribute            (const LDOMBasicString& aName,
0068                                          const LDOM_BasicNode * aLastCh) const;
0069   //    Search for attribute name, using or setting myFirstAttribute
0070 
0071  protected:
0072   // ---------- PROTECTED METHODS ----------
0073 
0074 //  LDOM_BasicElement (const LDOM_Element& anElement);
0075   //    Constructor
0076 
0077   Standard_EXPORT const LDOM_BasicNode *
0078                 AddAttribute            (const LDOMBasicString&   anAttrName,
0079                                          const LDOMBasicString&   anAttrValue,
0080                                          const Handle(LDOM_MemManager)& aDoc,
0081                                          const LDOM_BasicNode     * aLastCh);
0082   //    add or replace an attribute to the element
0083 
0084   Standard_EXPORT const LDOM_BasicNode *
0085                 RemoveAttribute         (const LDOMBasicString& aName,
0086                                          const LDOM_BasicNode * aLastCh) const;
0087 
0088   Standard_EXPORT void
0089                 RemoveChild             (const LDOM_BasicNode * aChild) const;
0090   //    remove a child element
0091 
0092   Standard_EXPORT void
0093                 AppendChild             (const LDOM_BasicNode *  aChild,
0094                                          const LDOM_BasicNode *& aLastCh) const;
0095   //    append a child node to the end of the list
0096 
0097  private:
0098   friend class LDOMParser;
0099   friend class LDOM_XmlReader;
0100   friend class LDOM_Document;
0101   friend class LDOM_Element;
0102   friend class LDOM_Node;
0103   // ---------- PRIVATE METHODS ----------
0104 
0105   const LDOM_BasicAttribute *
0106                 GetFirstAttribute       (const LDOM_BasicNode *& aLastCh,
0107                                          const LDOM_BasicNode **& thePrN) const;
0108 
0109   void          RemoveNodes             ();
0110 
0111   void          ReplaceElement          (const LDOM_BasicElement&       anOther,
0112                                          const Handle(LDOM_MemManager)& aDoc);
0113   //    remark: recursive
0114 
0115   void          AddElementsByTagName    (LDOM_NodeList&         aList,
0116                                          const LDOMBasicString& aTagName) const;
0117   //    remark: recursive
0118 
0119   void          AddAttributes           (LDOM_NodeList&         aList,
0120                                          const LDOM_BasicNode * aLastCh) const;
0121   //    add attributes to list
0122 
0123  private:
0124   // ---------- PRIVATE FIELDS ----------
0125 
0126 //  LDOMBasicString       myTagName;
0127   const char            * myTagName;
0128   unsigned long         myAttributeMask;
0129   LDOM_BasicNode        * myFirstChild;
0130 };
0131 
0132 #endif