00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_pathsearch_h)
00024 #define octave_pathsearch_h 1
00025
00026 #include <string>
00027
00028 #include "str-vec.h"
00029
00030 class
00031 dir_path
00032 {
00033 public:
00034
00035 dir_path (const std::string& s = std::string (),
00036 const std::string& d = std::string ())
00037 : p_orig (s), p_default (d), initialized (false)
00038 {
00039 if (! p_orig.empty ())
00040 init ();
00041 }
00042
00043 dir_path (const dir_path& dp)
00044 : p_orig (dp.p_orig), p_default (dp.p_default),
00045 initialized (dp.initialized), p (dp.p), pv (dp.pv)
00046 { }
00047
00048 dir_path& operator = (const dir_path& dp)
00049 {
00050 p_orig = dp.p_orig;
00051 p_default = dp.p_default;
00052 initialized = dp.initialized;
00053 p = dp.p;
00054 pv = dp.pv;
00055 return *this;
00056 }
00057
00058 ~dir_path (void) { }
00059
00060 void set (const std::string& s)
00061 {
00062 initialized = false;
00063 p_orig = s;
00064 init ();
00065 }
00066
00067 string_vector elements (void);
00068 string_vector all_directories (void);
00069
00070 std::string find_first (const std::string&);
00071 std::string find (const std::string& nm) { return find_first (nm); }
00072
00073 string_vector find_all (const std::string&);
00074
00075 std::string find_first_of (const string_vector& names);
00076 string_vector find_all_first_of (const string_vector& names);
00077
00078 void rehash (void)
00079 {
00080 initialized = false;
00081 init ();
00082 }
00083
00084 private:
00085
00086
00087 std::string p_orig;
00088
00089
00090
00091 std::string p_default;
00092
00093
00094 bool initialized;
00095
00096
00097
00098 std::string p;
00099
00100
00101 string_vector pv;
00102
00103 void init (void);
00104 };
00105
00106 #endif
00107
00108
00109
00110
00111
00112