1 // Created on: 1992-05-18
2 // Created by: Stephan GARNAUD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _OSD_DirectoryIterator_HeaderFile
18 #define _OSD_DirectoryIterator_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <OSD_Directory.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TCollection_AsciiString.hxx>
27 #include <Standard_Address.hxx>
28 #include <OSD_Error.hxx>
29 #include <Standard_Boolean.hxx>
32 class TCollection_AsciiString;
36 //! Manages a breadth-only search for sub-directories in the specified
38 //! There is no specific order of results.
39 class OSD_DirectoryIterator
46 //! Instantiates Object as empty Iterator;
47 Standard_EXPORT OSD_DirectoryIterator();
49 //! Instantiates Object as Iterator.
50 //! Wild-card "*" can be used in Mask the same way it
51 //! is used by unix shell for file names
52 Standard_EXPORT OSD_DirectoryIterator(const OSD_Path& where, const TCollection_AsciiString& Mask);
54 Standard_EXPORT void Destroy();
55 ~OSD_DirectoryIterator()
60 //! Initializes the current File Directory
61 Standard_EXPORT void Initialize (const OSD_Path& where, const TCollection_AsciiString& Mask);
63 //! Returns TRUE if other items are found while
64 //! using the 'Tree' method.
65 Standard_EXPORT Standard_Boolean More();
67 //! Sets the iterator to the next item.
68 //! Returns the item value corresponding to the current
69 //! position of the iterator.
70 Standard_EXPORT void Next();
72 //! Returns the next item found .
73 Standard_EXPORT OSD_Directory Values();
75 //! Returns TRUE if an error occurs
76 Standard_EXPORT Standard_Boolean Failed() const;
78 //! Resets error counter to zero
79 Standard_EXPORT void Reset();
82 Standard_EXPORT void Perror();
84 //! Returns error number if 'Failed' is TRUE.
85 Standard_EXPORT Standard_Integer Error() const;
88 OSD_Directory TheIterator;
89 Standard_Boolean myFlag;
90 TCollection_AsciiString myMask;
91 TCollection_AsciiString myPlace;
94 // platform-specific fields
96 Standard_Address myHandle;
97 Standard_Address myData;
98 Standard_Boolean myFirstCall;
100 Standard_Address myDescr;
101 Standard_Address myEntry;
102 Standard_Integer myInit;
106 #endif // _OSD_DirectoryIterator_HeaderFile