Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:36

0001 // Created on: 1992-03-18
0002 // Created by: Stephan GARNAUD
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _OSD_FileIterator_HeaderFile
0018 #define _OSD_FileIterator_HeaderFile
0019 
0020 #include <OSD_File.hxx>
0021 #include <OSD_Error.hxx>
0022 #include <TCollection_AsciiString.hxx>
0023 
0024 class OSD_Path;
0025 
0026 //! Manages a breadth-only search for files in the specified Path.
0027 //! There is no specific order of results.
0028 class OSD_FileIterator 
0029 {
0030 public:
0031 
0032   DEFINE_STANDARD_ALLOC
0033 
0034   
0035   //! Instantiates Object as empty Iterator;
0036   Standard_EXPORT OSD_FileIterator();
0037   
0038   //! Instantiates Object as Iterator;
0039   //! Wild-card "*" can be used in Mask the same way it
0040   //! is used by unix shell for file names
0041   Standard_EXPORT OSD_FileIterator(const OSD_Path& where, const TCollection_AsciiString& Mask);
0042   
0043   Standard_EXPORT void Destroy();
0044 ~OSD_FileIterator()
0045 {
0046   Destroy();
0047 }
0048   
0049   //! Initializes the current File Iterator
0050   Standard_EXPORT void Initialize (const OSD_Path& where, const TCollection_AsciiString& Mask);
0051   
0052   //! Returns TRUE if there are other items using the 'Tree'
0053   //! method.
0054   Standard_EXPORT Standard_Boolean More();
0055   
0056   //! Sets the iterator to the next item.
0057   //! Returns the item value corresponding to the current
0058   //! position of the iterator.
0059   Standard_EXPORT void Next();
0060   
0061   //! Returns the next file found .
0062   Standard_EXPORT OSD_File Values();
0063   
0064   //! Returns TRUE if an error occurs
0065   Standard_EXPORT Standard_Boolean Failed() const;
0066   
0067   //! Resets error counter to zero
0068   Standard_EXPORT void Reset();
0069   
0070   //! Raises OSD_Error
0071   Standard_EXPORT void Perror();
0072   
0073   //! Returns error number if 'Failed' is TRUE.
0074   Standard_EXPORT Standard_Integer Error() const;
0075 
0076 private:
0077 
0078   OSD_File TheIterator;
0079   Standard_Boolean myFlag;
0080   TCollection_AsciiString myMask;
0081   TCollection_AsciiString myPlace;
0082   OSD_Error myError;
0083 
0084   // platform-specific fields
0085 #ifdef _WIN32
0086   Standard_Address myHandle;
0087   Standard_Address myData;
0088   Standard_Boolean myFirstCall;
0089 #else
0090   Standard_Address myDescr;
0091   Standard_Address myEntry;
0092   Standard_Integer myInit;
0093 #endif
0094 };
0095 
0096 #endif // _OSD_FileIterator_HeaderFile