1 // Created on: 2001-06-28
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
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.
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.
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.
21 #include <LDOM_DeclareSequence.hxx>
22 #include <LDOM_NodeList.hxx>
23 #include <LDOM_BasicNode.hxx>
25 typedef const LDOM_BasicNode * LDOM_BasicNodePtr;
27 DECLARE_SEQUENCE (LDOM_BasicNodeSequence, LDOM_BasicNodePtr)
28 IMPLEMENT_SEQUENCE (LDOM_BasicNodeSequence, LDOM_BasicNodePtr)
30 //=======================================================================
31 //function : LDOM_NodeList()
32 //purpose : Constructor
33 //=======================================================================
35 LDOM_NodeList::LDOM_NodeList ( )
37 mySeq = new LDOM_BasicNodeSequence;
40 //=======================================================================
41 //function : LDOM_NodeList
43 //=======================================================================
45 LDOM_NodeList::LDOM_NodeList (const Handle(LDOM_MemManager)& aDoc)
48 mySeq = new LDOM_BasicNodeSequence;
51 //=======================================================================
54 //=======================================================================
56 void LDOM_NodeList::Append (const LDOM_BasicNode& aNode) const
58 mySeq -> Append (&aNode);
61 //=======================================================================
62 //function : LDOM_NodeList
63 //purpose : Copy constructor
64 //=======================================================================
66 LDOM_NodeList::LDOM_NodeList (const LDOM_NodeList& theOther)
68 mySeq = new LDOM_BasicNodeSequence;
69 * mySeq = * theOther.mySeq;
70 myDoc = theOther.myDoc;
73 //=======================================================================
74 //function : ~LDOM_NodeList
75 //purpose : Destructor
76 //=======================================================================
78 LDOM_NodeList::~LDOM_NodeList ()
83 //=======================================================================
84 //function : operator =
85 //purpose : Assignment
86 //=======================================================================
88 LDOM_NodeList& LDOM_NodeList::operator = (const LDOM_NodeList& theOther)
90 myDoc = theOther.myDoc;
91 * mySeq = * theOther.mySeq;
95 //=======================================================================
96 //function : operator =
98 //=======================================================================
100 LDOM_NodeList& LDOM_NodeList::operator = (const LDOM_NullPtr *)
107 //=======================================================================
108 //function : operator ==
110 //=======================================================================
112 Standard_Boolean LDOM_NodeList::operator == (const LDOM_NullPtr *) const
114 return myDoc.IsNull() || mySeq -> Length () == 0;
117 //=======================================================================
118 //function : operator !=
120 //=======================================================================
122 Standard_Boolean LDOM_NodeList::operator != (const LDOM_NullPtr *) const
124 return ! (myDoc.IsNull() || mySeq -> Length () == 0);
127 //=======================================================================
130 //=======================================================================
132 LDOM_Node LDOM_NodeList::item (const Standard_Integer anIndex) const
134 if (myDoc.IsNull() || anIndex < 0 || anIndex >= mySeq -> Length ())
136 return LDOM_Node (* mySeq -> Value(anIndex+1), myDoc);
139 //=======================================================================
140 //function : getLength
142 //=======================================================================
144 Standard_Integer LDOM_NodeList::getLength () const
146 return mySeq -> Length();