00001 /*========================================================================== 00002 * Copyright (c) 2004 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 // 00014 // DirectoryIterator 00015 // 00016 // 26 May 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_DIRECTORYITERATOR_HPP 00020 #define INDRI_DIRECTORYITERATOR_HPP 00021 00022 #include <string> 00023 namespace indri 00024 { 00025 namespace file 00026 { 00027 00030 class DirectoryIterator { 00031 private: 00032 static DirectoryIterator _end; 00033 00034 bool _relative; 00035 std::string _current; 00036 void* _platform; 00037 std::string _path; 00038 00039 void _copyCurrent(); 00040 void _next(); 00041 00042 public: 00043 DirectoryIterator(); 00044 00049 DirectoryIterator( const std::string& path, bool relative = true ); 00050 ~DirectoryIterator(); 00051 00053 void operator ++ (int); 00055 void operator ++ (); 00056 00059 bool operator == ( const DirectoryIterator& other ); 00060 00064 const std::string& operator* (); 00065 00068 const std::string& base() const; 00069 00071 void close(); 00072 00075 static const DirectoryIterator& end(); 00076 }; 00077 } 00078 } 00079 00080 #endif // INDRI_DIRECTORYITERATOR_HPP 00081