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.
16 #include <TDataStd_BooleanList.ixx>
17 #include <TDataStd_ListIteratorOfListOfByte.hxx>
19 //=======================================================================
22 //=======================================================================
23 const Standard_GUID& TDataStd_BooleanList::GetID()
25 static Standard_GUID TDataStd_BooleanListID ("23A9D60E-A033-44d8-96EE-015587A41BBC");
26 return TDataStd_BooleanListID;
29 //=======================================================================
30 //function : TDataStd_BooleanList
31 //purpose : Empty Constructor
32 //=======================================================================
33 TDataStd_BooleanList::TDataStd_BooleanList()
38 //=======================================================================
41 //=======================================================================
42 Handle(TDataStd_BooleanList) TDataStd_BooleanList::Set(const TDF_Label& label)
44 Handle(TDataStd_BooleanList) A;
45 if (!label.FindAttribute (TDataStd_BooleanList::GetID(), A))
47 A = new TDataStd_BooleanList;
48 label.AddAttribute(A);
53 //=======================================================================
56 //=======================================================================
57 Standard_Boolean TDataStd_BooleanList::IsEmpty() const
59 return myList.IsEmpty();
62 //=======================================================================
65 //=======================================================================
66 Standard_Integer TDataStd_BooleanList::Extent() const
68 return myList.Extent();
71 //=======================================================================
74 //=======================================================================
75 void TDataStd_BooleanList::Prepend(const Standard_Boolean value)
78 myList.Prepend( value ? 1 : 0 );
81 //=======================================================================
84 //=======================================================================
85 void TDataStd_BooleanList::Append(const Standard_Boolean value)
88 myList.Append( value ? 1 : 0 );
91 //=======================================================================
94 //=======================================================================
95 void TDataStd_BooleanList::Clear()
101 //=======================================================================
104 //=======================================================================
105 Standard_Boolean TDataStd_BooleanList::First() const
107 return myList.First() == 1;
110 //=======================================================================
113 //=======================================================================
114 Standard_Boolean TDataStd_BooleanList::Last() const
116 return myList.Last() == 1;
119 //=======================================================================
122 //=======================================================================
123 const TDataStd_ListOfByte& TDataStd_BooleanList::List() const
128 //=======================================================================
131 //=======================================================================
132 const Standard_GUID& TDataStd_BooleanList::ID () const
137 //=======================================================================
138 //function : NewEmpty
140 //=======================================================================
141 Handle(TDF_Attribute) TDataStd_BooleanList::NewEmpty () const
143 return new TDataStd_BooleanList();
146 //=======================================================================
149 //=======================================================================
150 void TDataStd_BooleanList::Restore(const Handle(TDF_Attribute)& With)
153 Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(With);
154 TDataStd_ListIteratorOfListOfByte itr(aList->List());
155 for (; itr.More(); itr.Next())
157 myList.Append(itr.Value());
161 //=======================================================================
164 //=======================================================================
165 void TDataStd_BooleanList::Paste (const Handle(TDF_Attribute)& Into,
166 const Handle(TDF_RelocationTable)& ) const
168 Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(Into);
170 TDataStd_ListIteratorOfListOfByte itr(myList);
171 for (; itr.More(); itr.Next())
173 aList->Append(itr.Value());
177 //=======================================================================
180 //=======================================================================
181 Standard_OStream& TDataStd_BooleanList::Dump (Standard_OStream& anOS) const
183 anOS << "BooleanList";