1 // Created on: 2001-06-28
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <LDOM_DeclareSequence.hxx>
17 #include <LDOM_NodeList.hxx>
18 #include <LDOM_BasicNode.hxx>
20 typedef const LDOM_BasicNode * LDOM_BasicNodePtr;
22 DECLARE_SEQUENCE (LDOM_BasicNodeSequence, LDOM_BasicNodePtr)
23 IMPLEMENT_SEQUENCE (LDOM_BasicNodeSequence, LDOM_BasicNodePtr)
25 //=======================================================================
26 //function : LDOM_NodeList()
27 //purpose : Constructor
28 //=======================================================================
30 LDOM_NodeList::LDOM_NodeList ( )
32 mySeq = new LDOM_BasicNodeSequence;
35 //=======================================================================
36 //function : LDOM_NodeList
38 //=======================================================================
40 LDOM_NodeList::LDOM_NodeList (const Handle(LDOM_MemManager)& aDoc)
43 mySeq = new LDOM_BasicNodeSequence;
46 //=======================================================================
49 //=======================================================================
51 void LDOM_NodeList::Append (const LDOM_BasicNode& aNode) const
53 mySeq -> Append (&aNode);
56 //=======================================================================
57 //function : LDOM_NodeList
58 //purpose : Copy constructor
59 //=======================================================================
61 LDOM_NodeList::LDOM_NodeList (const LDOM_NodeList& theOther)
63 mySeq = new LDOM_BasicNodeSequence;
64 * mySeq = * theOther.mySeq;
65 myDoc = theOther.myDoc;
68 //=======================================================================
69 //function : ~LDOM_NodeList
70 //purpose : Destructor
71 //=======================================================================
73 LDOM_NodeList::~LDOM_NodeList ()
78 //=======================================================================
79 //function : operator =
80 //purpose : Assignment
81 //=======================================================================
83 LDOM_NodeList& LDOM_NodeList::operator = (const LDOM_NodeList& theOther)
85 myDoc = theOther.myDoc;
86 * mySeq = * theOther.mySeq;
90 //=======================================================================
91 //function : operator =
93 //=======================================================================
95 LDOM_NodeList& LDOM_NodeList::operator = (const LDOM_NullPtr *)
102 //=======================================================================
103 //function : operator ==
105 //=======================================================================
107 Standard_Boolean LDOM_NodeList::operator == (const LDOM_NullPtr *) const
109 return myDoc.IsNull() || mySeq -> Length () == 0;
112 //=======================================================================
113 //function : operator !=
115 //=======================================================================
117 Standard_Boolean LDOM_NodeList::operator != (const LDOM_NullPtr *) const
119 return ! (myDoc.IsNull() || mySeq -> Length () == 0);
122 //=======================================================================
125 //=======================================================================
127 LDOM_Node LDOM_NodeList::item (const Standard_Integer anIndex) const
129 if (myDoc.IsNull() || anIndex < 0 || anIndex >= mySeq -> Length ())
131 return LDOM_Node (* mySeq -> Value(anIndex+1), myDoc);
134 //=======================================================================
135 //function : getLength
137 //=======================================================================
139 Standard_Integer LDOM_NodeList::getLength () const
141 return mySeq -> Length();