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