00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PANDASEARCHPATH_H
00020 #define PANDASEARCHPATH_H
00021
00022 #include "dtoolbase.h"
00023
00024 #include "filename.h"
00025 #include "pvector.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_DTOOL DSearchPath {
00037 public:
00038 class EXPCL_DTOOL Results {
00039 PUBLISHED:
00040 Results();
00041 Results(const Results ©);
00042 void operator = (const Results ©);
00043 ~Results();
00044
00045 void clear();
00046 int get_num_files() const;
00047 const Filename &get_file(int n) const;
00048
00049 public:
00050 void add_file(const Filename &file);
00051
00052 private:
00053 typedef pvector<Filename> Files;
00054 Files _files;
00055 };
00056
00057 PUBLISHED:
00058 DSearchPath();
00059 DSearchPath(const string &path, const string &delimiters = ": \n\t");
00060 DSearchPath(const DSearchPath ©);
00061 void operator = (const DSearchPath ©);
00062 ~DSearchPath();
00063
00064 void clear();
00065 void append_directory(const Filename &directory);
00066 void prepend_directory(const Filename &directory);
00067 void append_path(const string &path,
00068 const string &delimiters = ": \n\t");
00069 void append_path(const DSearchPath &path);
00070 void prepend_path(const DSearchPath &path);
00071
00072 bool is_empty() const;
00073 int get_num_directories() const;
00074 const Filename &get_directory(int n) const;
00075
00076 Filename find_file(const Filename &filename) const;
00077 int find_all_files(const Filename &filename, Results &results) const;
00078
00079 INLINE static Filename
00080 search_path(const Filename &filename, const string &path,
00081 const string &delimiters = ": \n\t");
00082
00083 void output(ostream &out, const string &separator = ":") const;
00084 void write(ostream &out, int indent_level = 0) const;
00085
00086 private:
00087 typedef pvector<Filename> Directories;
00088 Directories _directories;
00089 };
00090
00091 INLINE ostream &operator << (ostream &out, const DSearchPath &sp) {
00092 sp.output(out);
00093 return out;
00094 }
00095
00096 #include "dSearchPath.I"
00097
00098 #endif