/usr/include/oce/XmlObjMgt_Array1.gxx is in liboce-ocaf-lite-dev 0.9.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | // File: XmlObjMgt_Array1.gxx
// Created: 01.08.01 16:05:40
// Author: Julia DOROVSKIKH
// Copyright: Open Cascade 2001
// History: AGV 130202: Changed prototype LDOM_Node::getOwnerDocument()
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_DOMString.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_DOMSTRING (LowerString, "lower")
IMPLEMENT_DOMSTRING (UpperString, "upper")
IMPLEMENT_DOMSTRING (IndString, "index")
//=======================================================================
//function : XmlObjMgt_Array1
//purpose : Constructor
//=======================================================================
XmlObjMgt_Array1::XmlObjMgt_Array1 (const XmlObjMgt_Element& theParent,
const XmlObjMgt_DOMString& theName)
: myElement (XmlObjMgt::FindChildByName (theParent, theName)),
myFirst (1),
myLast (0)
{
if (myElement != NULL) {
if (!myElement.getAttribute(::LowerString()).GetInteger(myFirst))
myFirst = 1;
if (!myElement.getAttribute(::UpperString()).GetInteger (myLast))
myLast = 1;
}
}
//=======================================================================
//function : XmlObjMgt_Array1
//purpose : Constructor
//=======================================================================
XmlObjMgt_Array1::XmlObjMgt_Array1 (const Standard_Integer aFirst,
const Standard_Integer aLast)
: myFirst (aFirst), myLast (aLast)
{}
//=======================================================================
//function : CreateArrayElement
//purpose : Create DOM_Element representing the array, under 'theParent'
//=======================================================================
void XmlObjMgt_Array1::CreateArrayElement (XmlObjMgt_Element& theParent,
const XmlObjMgt_DOMString& theName)
{
if (myLast > 0)
{
//AGV XmlObjMgt_Document& anOwnerDoc =
//AGV (XmlObjMgt_Document&)theParent.getOwnerDocument();
XmlObjMgt_Document anOwnerDoc =
XmlObjMgt_Document (theParent.getOwnerDocument());
myElement = anOwnerDoc.createElement (theName);
theParent.appendChild (myElement);
if (myLast > 1) {
myElement.setAttribute (::UpperString(), myLast);
if (myFirst != 1)
myElement.setAttribute (::LowerString(), myFirst);
}
}
}
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
void XmlObjMgt_Array1::SetValue
(const Standard_Integer theIndex, XmlObjMgt_Element& theValue)
{
myElement.appendChild (theValue);
theValue.setAttribute(::IndString(), theIndex);
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
XmlObjMgt_Element XmlObjMgt_Array1::Value(const Standard_Integer theIndex) const
{
XmlObjMgt_Element anElem;
if (theIndex >= myFirst && theIndex <= myLast)
{
Standard_Integer ind;
LDOM_Node aNode = myElement.getFirstChild();
while (!aNode.isNull())
{
if (aNode.getNodeType() == LDOM_Node::ELEMENT_NODE)
{
anElem = (XmlObjMgt_Element &) aNode;
if (anElem.getAttribute(::IndString()).GetInteger(ind))
if (ind == theIndex)
break;
}
aNode = aNode.getNextSibling();
}
}
return anElem;
}
|