00001 // directory.h 00002 // 00003 // Copyright (C) 2002, Chris Laurel <claurel@shatters.net> 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 00010 #ifndef _CELUTIL_DIRECTORY_H_ 00011 #define _CELUTIL_DIRECTORY_H_ 00012 00013 #include <string> 00014 #include <vector> 00015 00016 class EnumFilesHandler 00017 { 00018 public: 00019 EnumFilesHandler(); 00020 virtual ~EnumFilesHandler() {}; 00021 00022 void pushDir(const std::string&); 00023 void popDir(); 00024 const std::string& getPath() const; 00025 00026 virtual bool process(const std::string& filename) = 0; 00027 00028 private: 00029 std::vector<std::string> dirStack; 00030 }; 00031 00032 class Directory 00033 { 00034 public: 00035 Directory() {}; 00036 virtual ~Directory() {}; 00037 00038 virtual bool nextFile(std::string&) = 0; 00039 00040 virtual bool enumFiles(EnumFilesHandler& handler, bool deep); 00041 }; 00042 00043 extern std::string WordExp(const std::string&); 00044 extern Directory* OpenDirectory(const std::string&); 00045 extern bool IsDirectory(const std::string&); 00046 00047 00048 #endif // _CELUTIL_DIRECTORY_H_
1.4.1