00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef EXECUTIONENVIRONMENT_H
00020 #define EXECUTIONENVIRONMENT_H
00021
00022 #include <dtoolbase.h>
00023
00024 #include "vector_string.h"
00025 #include "filename.h"
00026
00027 #include <map>
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class EXPCL_DTOOL ExecutionEnvironment {
00038 private:
00039 ExecutionEnvironment();
00040
00041 public:
00042 INLINE static bool has_environment_variable(const string &var);
00043 INLINE static string get_environment_variable(const string &var);
00044 INLINE static void set_environment_variable(const string &var, const string &value);
00045
00046 static string expand_string(const string &str);
00047
00048 INLINE static int get_num_args();
00049 INLINE static string get_arg(int n);
00050
00051 INLINE static string get_binary_name();
00052
00053 static Filename get_cwd();
00054
00055 private:
00056 bool ns_has_environment_variable(const string &var) const;
00057 string ns_get_environment_variable(const string &var) const;
00058 void ns_set_environment_variable(const string &var, const string &value);
00059
00060 int ns_get_num_args() const;
00061 string ns_get_arg(int n) const;
00062
00063 string ns_get_binary_name() const;
00064
00065 static ExecutionEnvironment *get_ptr();
00066
00067 void read_environment_variables();
00068 void read_args();
00069
00070 private:
00071 typedef map<string, string> EnvironmentVariables;
00072 EnvironmentVariables _variables;
00073
00074 typedef vector_string CommandArguments;
00075 CommandArguments _args;
00076
00077 string _binary_name;
00078
00079 static ExecutionEnvironment *_global_ptr;
00080 };
00081
00082 #include "executionEnvironment.I"
00083
00084 #endif