1 // File: LDOM_NodeList.cxx
2 // Created: 28.06.01 15:05:19
3 // Author: Alexander GRIGORIEV
4 // Copyright: OpenCascade 2001
7 #include <LDOM_DeclareSequence.hxx>
8 #include <LDOM_NodeList.hxx>
9 #include <LDOM_BasicNode.hxx>
11 typedef const LDOM_BasicNode * LDOM_BasicNodePtr;
13 DECLARE_SEQUENCE (LDOM_BasicNodeSequence, LDOM_BasicNodePtr)
14 IMPLEMENT_SEQUENCE (LDOM_BasicNodeSequence, LDOM_BasicNodePtr)
16 //=======================================================================
17 //function : LDOM_NodeList()
18 //purpose : Constructor
19 //=======================================================================
21 LDOM_NodeList::LDOM_NodeList ( )
23 mySeq = new LDOM_BasicNodeSequence;
26 //=======================================================================
27 //function : LDOM_NodeList
29 //=======================================================================
31 LDOM_NodeList::LDOM_NodeList (const Handle(LDOM_MemManager)& aDoc)
34 mySeq = new LDOM_BasicNodeSequence;
37 //=======================================================================
40 //=======================================================================
42 void LDOM_NodeList::Append (const LDOM_BasicNode& aNode) const
44 mySeq -> Append (&aNode);
47 //=======================================================================
48 //function : LDOM_NodeList
49 //purpose : Copy constructor
50 //=======================================================================
52 LDOM_NodeList::LDOM_NodeList (const LDOM_NodeList& theOther)
54 mySeq = new LDOM_BasicNodeSequence;
55 * mySeq = * theOther.mySeq;
56 myDoc = theOther.myDoc;
59 //=======================================================================
60 //function : ~LDOM_NodeList
61 //purpose : Destructor
62 //=======================================================================
64 LDOM_NodeList::~LDOM_NodeList ()
69 //=======================================================================
70 //function : operator =
71 //purpose : Assignment
72 //=======================================================================
74 LDOM_NodeList& LDOM_NodeList::operator = (const LDOM_NodeList& theOther)
76 myDoc = theOther.myDoc;
77 * mySeq = * theOther.mySeq;
81 //=======================================================================
82 //function : operator =
84 //=======================================================================
86 LDOM_NodeList& LDOM_NodeList::operator = (const LDOM_NullPtr *)
93 //=======================================================================
94 //function : operator ==
96 //=======================================================================
98 Standard_Boolean LDOM_NodeList::operator == (const LDOM_NullPtr *) const
100 return myDoc.IsNull() || mySeq -> Length () == 0;
103 //=======================================================================
104 //function : operator !=
106 //=======================================================================
108 Standard_Boolean LDOM_NodeList::operator != (const LDOM_NullPtr *) const
110 return ! (myDoc.IsNull() || mySeq -> Length () == 0);
113 //=======================================================================
116 //=======================================================================
118 LDOM_Node LDOM_NodeList::item (const Standard_Integer anIndex) const
120 if (myDoc.IsNull() || anIndex < 0 || anIndex >= mySeq -> Length ())
122 return LDOM_Node (* mySeq -> Value(anIndex+1), myDoc);
125 //=======================================================================
126 //function : getLength
128 //=======================================================================
130 Standard_Integer LDOM_NodeList::getLength () const
132 return mySeq -> Length();