1 // Created on: 2007-05-29
2 // Created by: Vlad Romashko
3 // Copyright (c) 2007-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 <TDataStd_BooleanList.ixx>
22 #include <TDataStd_ListIteratorOfListOfByte.hxx>
24 //=======================================================================
27 //=======================================================================
28 const Standard_GUID& TDataStd_BooleanList::GetID()
30 static Standard_GUID TDataStd_BooleanListID ("23A9D60E-A033-44d8-96EE-015587A41BBC");
31 return TDataStd_BooleanListID;
34 //=======================================================================
35 //function : TDataStd_BooleanList
36 //purpose : Empty Constructor
37 //=======================================================================
38 TDataStd_BooleanList::TDataStd_BooleanList()
43 //=======================================================================
46 //=======================================================================
47 Handle(TDataStd_BooleanList) TDataStd_BooleanList::Set(const TDF_Label& label)
49 Handle(TDataStd_BooleanList) A;
50 if (!label.FindAttribute (TDataStd_BooleanList::GetID(), A))
52 A = new TDataStd_BooleanList;
53 label.AddAttribute(A);
58 //=======================================================================
61 //=======================================================================
62 Standard_Boolean TDataStd_BooleanList::IsEmpty() const
64 return myList.IsEmpty();
67 //=======================================================================
70 //=======================================================================
71 Standard_Integer TDataStd_BooleanList::Extent() const
73 return myList.Extent();
76 //=======================================================================
79 //=======================================================================
80 void TDataStd_BooleanList::Prepend(const Standard_Boolean value)
83 myList.Prepend( value ? 1 : 0 );
86 //=======================================================================
89 //=======================================================================
90 void TDataStd_BooleanList::Append(const Standard_Boolean value)
93 myList.Append( value ? 1 : 0 );
96 //=======================================================================
99 //=======================================================================
100 void TDataStd_BooleanList::Clear()
106 //=======================================================================
109 //=======================================================================
110 Standard_Boolean TDataStd_BooleanList::First() const
112 return myList.First() == 1;
115 //=======================================================================
118 //=======================================================================
119 Standard_Boolean TDataStd_BooleanList::Last() const
121 return myList.Last() == 1;
124 //=======================================================================
127 //=======================================================================
128 const TDataStd_ListOfByte& TDataStd_BooleanList::List() const
133 //=======================================================================
136 //=======================================================================
137 const Standard_GUID& TDataStd_BooleanList::ID () const
142 //=======================================================================
143 //function : NewEmpty
145 //=======================================================================
146 Handle(TDF_Attribute) TDataStd_BooleanList::NewEmpty () const
148 return new TDataStd_BooleanList();
151 //=======================================================================
154 //=======================================================================
155 void TDataStd_BooleanList::Restore(const Handle(TDF_Attribute)& With)
158 Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(With);
159 TDataStd_ListIteratorOfListOfByte itr(aList->List());
160 for (; itr.More(); itr.Next())
162 myList.Append(itr.Value());
166 //=======================================================================
169 //=======================================================================
170 void TDataStd_BooleanList::Paste (const Handle(TDF_Attribute)& Into,
171 const Handle(TDF_RelocationTable)& ) const
173 Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(Into);
175 TDataStd_ListIteratorOfListOfByte itr(myList);
176 for (; itr.More(); itr.Next())
178 aList->Append(itr.Value());
182 //=======================================================================
185 //=======================================================================
186 Standard_OStream& TDataStd_BooleanList::Dump (Standard_OStream& anOS) const
188 anOS << "BooleanList";