0027772: Foundation Classes - define Standard_Boolean using C++ type "bool" instead...
[occt.git] / src / OSD / OSD_DirectoryIterator.hxx
... / ...
CommitLineData
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
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _OSD_DirectoryIterator_HeaderFile
18#define _OSD_DirectoryIterator_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
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>
30class OSD_OSDError;
31class OSD_Path;
32class TCollection_AsciiString;
33class OSD_Directory;
34
35
36//! Manages a breadth-only search for sub-directories in the specified
37//! Path.
38//! There is no specific order of results.
39class OSD_DirectoryIterator
40{
41public:
42
43 DEFINE_STANDARD_ALLOC
44
45
46 //! Instantiates Object as empty Iterator;
47 Standard_EXPORT OSD_DirectoryIterator();
48
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);
53
54 Standard_EXPORT void Destroy();
55~OSD_DirectoryIterator()
56{
57 Destroy();
58}
59
60 //! Initializes the current File Directory
61 Standard_EXPORT void Initialize (const OSD_Path& where, const TCollection_AsciiString& Mask);
62
63 //! Returns TRUE if other items are found while
64 //! using the 'Tree' method.
65 Standard_EXPORT Standard_Boolean More();
66
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();
71
72 //! Returns the next item found .
73 Standard_EXPORT OSD_Directory Values();
74
75 //! Returns TRUE if an error occurs
76 Standard_EXPORT Standard_Boolean Failed() const;
77
78 //! Resets error counter to zero
79 Standard_EXPORT void Reset();
80
81 //! Raises OSD_Error
82 Standard_EXPORT void Perror();
83
84 //! Returns error number if 'Failed' is TRUE.
85 Standard_EXPORT Standard_Integer Error() const;
86
87private:
88 OSD_Directory TheIterator;
89 Standard_Boolean myFlag;
90 TCollection_AsciiString myMask;
91 TCollection_AsciiString myPlace;
92 OSD_Error myError;
93
94 // platform-specific fields
95#ifdef _WIN32
96 Standard_Address myHandle;
97 Standard_Address myData;
98 Standard_Boolean myFirstCall;
99#else
100 Standard_Address myDescr;
101 Standard_Address myEntry;
102 Standard_Integer myInit;
103#endif
104};
105
106#endif // _OSD_DirectoryIterator_HeaderFile