1 // Created on: 2007-05-29
2 // Created by: Vlad Romashko
3 // Copyright (c) 2007-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.
17 #include <Standard_GUID.hxx>
18 #include <Standard_Type.hxx>
19 #include <TDataStd_BooleanList.hxx>
20 #include <TDataStd_ListIteratorOfListOfByte.hxx>
21 #include <TDF_Attribute.hxx>
22 #include <TDF_Label.hxx>
23 #include <TDF_RelocationTable.hxx>
25 //=======================================================================
28 //=======================================================================
29 const Standard_GUID& TDataStd_BooleanList::GetID()
31 static Standard_GUID TDataStd_BooleanListID ("23A9D60E-A033-44d8-96EE-015587A41BBC");
32 return TDataStd_BooleanListID;
35 //=======================================================================
36 //function : TDataStd_BooleanList
37 //purpose : Empty Constructor
38 //=======================================================================
39 TDataStd_BooleanList::TDataStd_BooleanList()
44 //=======================================================================
47 //=======================================================================
48 Handle(TDataStd_BooleanList) TDataStd_BooleanList::Set(const TDF_Label& label)
50 Handle(TDataStd_BooleanList) A;
51 if (!label.FindAttribute (TDataStd_BooleanList::GetID(), A))
53 A = new TDataStd_BooleanList;
54 label.AddAttribute(A);
59 //=======================================================================
62 //=======================================================================
63 Standard_Boolean TDataStd_BooleanList::IsEmpty() const
65 return myList.IsEmpty();
68 //=======================================================================
71 //=======================================================================
72 Standard_Integer TDataStd_BooleanList::Extent() const
74 return myList.Extent();
77 //=======================================================================
80 //=======================================================================
81 void TDataStd_BooleanList::Prepend(const Standard_Boolean value)
84 myList.Prepend( value ? 1 : 0 );
87 //=======================================================================
90 //=======================================================================
91 void TDataStd_BooleanList::Append(const Standard_Boolean value)
94 myList.Append( value ? 1 : 0 );
97 //=======================================================================
100 //=======================================================================
101 void TDataStd_BooleanList::Clear()
107 //=======================================================================
110 //=======================================================================
111 Standard_Boolean TDataStd_BooleanList::First() const
113 return myList.First() == 1;
116 //=======================================================================
119 //=======================================================================
120 Standard_Boolean TDataStd_BooleanList::Last() const
122 return myList.Last() == 1;
125 //=======================================================================
128 //=======================================================================
129 const TDataStd_ListOfByte& TDataStd_BooleanList::List() const
134 //=======================================================================
137 //=======================================================================
138 const Standard_GUID& TDataStd_BooleanList::ID () const
143 //=======================================================================
144 //function : NewEmpty
146 //=======================================================================
147 Handle(TDF_Attribute) TDataStd_BooleanList::NewEmpty () const
149 return new TDataStd_BooleanList();
152 //=======================================================================
155 //=======================================================================
156 void TDataStd_BooleanList::Restore(const Handle(TDF_Attribute)& With)
159 Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(With);
160 TDataStd_ListIteratorOfListOfByte itr(aList->List());
161 for (; itr.More(); itr.Next())
163 myList.Append(itr.Value());
167 //=======================================================================
170 //=======================================================================
171 void TDataStd_BooleanList::Paste (const Handle(TDF_Attribute)& Into,
172 const Handle(TDF_RelocationTable)& ) const
174 Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(Into);
176 TDataStd_ListIteratorOfListOfByte itr(myList);
177 for (; itr.More(); itr.Next())
179 aList->Append(itr.Value());
183 //=======================================================================
186 //=======================================================================
187 Standard_OStream& TDataStd_BooleanList::Dump (Standard_OStream& anOS) const
189 anOS << "BooleanList";