0024087: Eliminate compiler warning C4244 in MSVC++ with warning level 4
[occt.git] / src / LDOM / LDOM_BasicElement.hxx
1 // Created on: 2001-06-26
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20 //AGV 140202: Repl.(const char *) for (LDOMBasicString) => myTagName
21
22 #ifndef LDOM_BasicElement_HeaderFile
23 #define LDOM_BasicElement_HeaderFile
24
25 #include <LDOM_BasicNode.hxx>
26 #include <LDOMBasicString.hxx>
27 #include <LDOM_Node.hxx>
28
29 class LDOM_XmlReader;
30 class LDOMParser;
31 class LDOM_NodeList;
32 class LDOM_Element;
33 class LDOM_BasicAttribute;
34
35 //  Class LDOM_BasicElement
36 //
37
38 class LDOM_BasicElement : public LDOM_BasicNode
39 {
40  public:
41  
42   // ---------- PUBLIC METHODS ----------
43
44   LDOM_BasicElement ()
45     : LDOM_BasicNode    (LDOM_Node::UNKNOWN),
46       myTagName         (NULL),
47       myAttributeMask   (0),
48       myFirstChild      (NULL) {}
49   //    Empty constructor
50
51   static LDOM_BasicElement& Create (const char                     * aName,
52                                     const Standard_Integer         aLength,
53                                     const Handle(LDOM_MemManager)& aDoc);
54
55 //  Standard_EXPORT LDOM_BasicElement (const LDOM_BasicElement& theOther);
56   //    Copy constructor
57
58   Standard_EXPORT LDOM_BasicElement&
59                 operator =              (const LDOM_NullPtr * aNull);
60   //    Nullify
61
62   Standard_EXPORT ~LDOM_BasicElement ();
63   //    Destructor
64
65   const char *  GetTagName              () const { return myTagName; }
66
67   const LDOM_BasicNode *
68                 GetFirstChild           () const { return myFirstChild; }
69
70   Standard_EXPORT const LDOM_BasicNode *
71                 GetLastChild            () const;
72
73   Standard_EXPORT const LDOM_BasicAttribute&
74                 GetAttribute            (const LDOMBasicString& aName,
75                                          const LDOM_BasicNode * aLastCh) const;
76   //    Search for attribute name, using or setting myFirstAttribute
77
78  protected:
79   // ---------- PROTECTED METHODS ----------
80
81 //  LDOM_BasicElement (const LDOM_Element& anElement);
82   //    Constructor
83
84   Standard_EXPORT const LDOM_BasicNode *
85                 AddAttribute            (const LDOMBasicString&   anAttrName,
86                                          const LDOMBasicString&   anAttrValue,
87                                          const Handle(LDOM_MemManager)& aDoc,
88                                          const LDOM_BasicNode     * aLastCh);
89   //    add or replace an attribute to the element
90
91   Standard_EXPORT const LDOM_BasicNode *
92                 RemoveAttribute         (const LDOMBasicString& aName,
93                                          const LDOM_BasicNode * aLastCh) const;
94
95   Standard_EXPORT void
96                 RemoveChild             (const LDOM_BasicNode * aChild) const;
97   //    remove a child element
98
99   Standard_EXPORT void
100                 AppendChild             (const LDOM_BasicNode *  aChild,
101                                          const LDOM_BasicNode *& aLastCh) const;
102   //    append a child node to the end of the list
103
104  private:
105   friend class LDOMParser;
106   friend class LDOM_XmlReader;
107   friend class LDOM_Document;
108   friend class LDOM_Element;
109   friend class LDOM_Node;
110   // ---------- PRIVATE METHODS ----------
111
112   const LDOM_BasicAttribute *
113                 GetFirstAttribute       (const LDOM_BasicNode *& aLastCh,
114                                          const LDOM_BasicNode **& thePrN) const;
115
116   void          RemoveNodes             ();
117
118   void          ReplaceElement          (const LDOM_BasicElement&       anOther,
119                                          const Handle(LDOM_MemManager)& aDoc);
120   //    remark: recursive
121
122   void          AddElementsByTagName    (LDOM_NodeList&         aList,
123                                          const LDOMBasicString& aTagName) const;
124   //    remark: recursive
125
126   void          AddAttributes           (LDOM_NodeList&         aList,
127                                          const LDOM_BasicNode * aLastCh) const;
128   //    add attributes to list
129
130  private:
131   // ---------- PRIVATE FIELDS ----------
132
133 //  LDOMBasicString       myTagName;
134   const char            * myTagName;
135   unsigned long         myAttributeMask;
136   LDOM_BasicNode        * myFirstChild;
137 };
138
139 #endif