1 // Created on: 1997-08-07
2 // Created by: Jean-Louis Frenkel
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <CDF_Directory.ixx>
24 #include <CDM_ListIteratorOfListOfDocument.hxx>
25 #include <Standard_NoSuchObject.hxx>
26 CDF_Directory::CDF_Directory () {}
28 void CDF_Directory::Add(const Handle(CDM_Document)& aDocument) {
29 if(!Contains(aDocument)) myDocuments.Append(aDocument);
32 void CDF_Directory::Remove(const Handle(CDM_Document)& aDocument) {
34 CDM_ListIteratorOfListOfDocument it(myDocuments);
36 Standard_Boolean found = Standard_False;
37 for (; it.More() && !found;) {
38 found = aDocument == it.Value();
40 myDocuments.Remove(it);
47 Standard_Boolean CDF_Directory::Contains(const Handle(CDM_Document)& aDocument) const {
49 CDM_ListIteratorOfListOfDocument it(myDocuments);
50 Standard_Boolean found = Standard_False;
51 for (; it.More() && !found; it.Next()) {
52 found = aDocument == it.Value();
58 Standard_Integer CDF_Directory::Length() const {
59 return myDocuments.Extent();
62 const CDM_ListOfDocument& CDF_Directory::List() const {
68 Standard_Boolean CDF_Directory::IsEmpty() const {
69 return myDocuments.IsEmpty();
71 Handle(CDM_Document) CDF_Directory::Last() {
72 Standard_NoSuchObject_Raise_if(IsEmpty(),"CDF_Directory::Last: the directory does not contain any document");
73 return myDocuments.Last();