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_env_h)
00024 #define octave_env_h 1
00025
00026 #include <string>
00027
00028 class
00029 octave_env
00030 {
00031 protected:
00032
00033 octave_env (void);
00034
00035 public:
00036
00037 static std::string polite_directory_format (const std::string& name);
00038
00039 static bool absolute_pathname (const std::string& s);
00040
00041 static std::string base_pathname (const std::string& s);
00042
00043 static std::string make_absolute (const std::string& s,
00044 const std::string& dot_path);
00045
00046 static std::string getcwd (void);
00047
00048 static std::string get_home_directory (void);
00049
00050 static std::string get_program_name (void);
00051
00052 static std::string get_program_invocation_name (void);
00053
00054 static std::string get_user_name (void);
00055
00056 static std::string get_host_name (void);
00057
00058 static std::string getenv (const std::string& name);
00059
00060 static void putenv (const std::string& name, const std::string& value);
00061
00062 static bool chdir (const std::string& newdir);
00063
00064 static void set_program_name (const std::string& s);
00065
00066 private:
00067
00068 static bool instance_ok (void);
00069
00070 std::string do_polite_directory_format (const std::string& name) const;
00071
00072 bool do_absolute_pathname (const std::string& s) const;
00073
00074 std::string do_base_pathname (const std::string& s) const;
00075
00076 std::string do_make_absolute (const std::string& s,
00077 const std::string& dot_path) const;
00078
00079 std::string do_getcwd (void) const;
00080
00081 std::string do_get_home_directory (void) const;
00082
00083 std::string do_get_user_name (void) const;
00084
00085 std::string do_get_host_name (void) const;
00086
00087 std::string do_getenv (const std::string& name) const;
00088
00089 void do_putenv (const std::string& name, const std::string& value) const;
00090
00091 bool do_chdir (const std::string& newdir);
00092
00093 void do_set_program_name (const std::string& s) const;
00094
00095 void pathname_backup (std::string& path, int n) const;
00096
00097 void error (int) const;
00098
00099 void error (const std::string&) const;
00100
00101
00102
00103 octave_env (const octave_env&);
00104
00105 octave_env& operator = (const octave_env&);
00106
00107
00108 static octave_env *instance;
00109
00110
00111
00112 bool follow_symbolic_links;
00113
00114
00115
00116 bool verbatim_pwd;
00117
00118
00119 mutable std::string current_directory;
00120
00121
00122 mutable std::string program_name;
00123
00124 mutable std::string program_invocation_name;
00125
00126 mutable std::string user_name;
00127
00128 mutable std::string host_name;
00129 };
00130
00131 #endif
00132
00133
00134
00135
00136
00137