0024157: Parallelization of assembly part of BO
[occt.git] / src / XmlObjMgt / XmlObjMgt_Persistent.cxx
CommitLineData
b311480e 1// Created on: 2001-07-17
2// Created by: Julia DOROVSKIKH
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 130202: Changed prototype LDOM_Node::getOwnerDocument()
7fd59977 21
22#include <XmlObjMgt_Persistent.ixx>
23#include <XmlObjMgt_Document.hxx>
24#include <XmlObjMgt.hxx>
25#include <TCollection_AsciiString.hxx>
26
27//=======================================================================
28//function : XmlObjMgt_Persistent
29//purpose : empty constructor
30//=======================================================================
31
32XmlObjMgt_Persistent::XmlObjMgt_Persistent ()
33 : myID (0)
34{}
35
36//=======================================================================
37//function : XmlObjMgt_Persistent
38//purpose :
39//=======================================================================
40XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement)
41 : myElement (theElement), myID (0)
42{
43 if (theElement != NULL)
44 theElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
45}
46
47//=======================================================================
48//function : XmlObjMgt_Persistent
49//purpose :
50//=======================================================================
51XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement,
52 const XmlObjMgt_DOMString& theRef)
53 : myID (0)
54{
55 if (theElement != NULL) {
56 Standard_Integer aRefID;
57 if (theElement.getAttribute (theRef).GetInteger (aRefID)) {
58 myElement = XmlObjMgt::FindChildElement (theElement, aRefID);
59 if (myElement != NULL)
60 myElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
61 }
62 }
63}
64
65//=======================================================================
66//function : CreateElement
67//purpose : <theType id="theID"/>
68//=======================================================================
69void XmlObjMgt_Persistent::CreateElement (XmlObjMgt_Element& theParent,
70 const XmlObjMgt_DOMString& theType,
71 const Standard_Integer theID)
72{
73//AGV XmlObjMgt_Document& anOwnerDoc =
74//AGV (XmlObjMgt_Document&)theParent.getOwnerDocument();
75 XmlObjMgt_Document anOwnerDoc =
76 XmlObjMgt_Document (theParent.getOwnerDocument());
77 myElement = anOwnerDoc.createElement (theType);
78 theParent.appendChild (myElement);
79 SetId (theID);
80}
81
82//=======================================================================
83//function : SetId
84//purpose :
85//=======================================================================
86void XmlObjMgt_Persistent::SetId(const Standard_Integer theId)
87{
88 myID = theId;
89 myElement.setAttribute (XmlObjMgt::IdString(), theId);
90}