00001 // Filename: executionEnvironment.I 00002 // Created by: drose (15May00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ExecutionEnvironment::has_environment_variable 00018 // Access: Public, Static 00019 // Description: Returns true if the indicated environment variable 00020 // is defined. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE bool ExecutionEnvironment:: 00023 has_environment_variable(const string &var) { 00024 return get_ptr()->ns_has_environment_variable(var); 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: ExecutionEnvironment::get_environment_variable 00029 // Access: Public, Static 00030 // Description: Returns the definition of the indicated environment 00031 // variable, or the empty string if the variable is 00032 // undefined. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE string ExecutionEnvironment:: 00035 get_environment_variable(const string &var) { 00036 return get_ptr()->ns_get_environment_variable(var); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ExecutionEnvironment::set_environment_variable 00041 // Access: Public, Static 00042 // Description: Changes the definition of the indicated environment 00043 // variable. 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE void ExecutionEnvironment:: 00046 set_environment_variable(const string &var, const string &value) { 00047 get_ptr()->ns_set_environment_variable(var, value); 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: ExecutionEnvironment::shadow_environment_variable 00052 // Access: Public, Static 00053 // Description: Changes the apparent definition of the indicated 00054 // environment variable by masking it within this class 00055 // with a new value. This does not change the actual 00056 // environment variable, but future calls to 00057 // get_environment_variable() will return this new 00058 // value. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void ExecutionEnvironment:: 00061 shadow_environment_variable(const string &var, const string &value) { 00062 get_ptr()->ns_shadow_environment_variable(var, value); 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: ExecutionEnvironment::clear_shadow 00067 // Access: Public, Static 00068 // Description: Removes a value set by a previous call to 00069 // shadow_environment_variable(), and lets the actual 00070 // value of the variable show again. 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE void ExecutionEnvironment:: 00073 clear_shadow(const string &var) { 00074 get_ptr()->ns_clear_shadow(var); 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: ExecutionEnvironment::get_num_args 00079 // Access: Public, Static 00080 // Description: Returns the number of command-line arguments 00081 // available, not counting arg 0, the binary name. 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE int ExecutionEnvironment:: 00084 get_num_args() { 00085 return get_ptr()->ns_get_num_args(); 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: ExecutionEnvironment::get_arg 00090 // Access: Public, Static 00091 // Description: Returns the nth command-line argument. The index n 00092 // must be in the range [0 .. get_num_args()). The 00093 // first parameter, n == 0, is the first actual 00094 // parameter, not the binary name. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE string ExecutionEnvironment:: 00097 get_arg(int n) { 00098 return get_ptr()->ns_get_arg(n); 00099 } 00100 00101 //////////////////////////////////////////////////////////////////// 00102 // Function: ExecutionEnvironment::get_binary_name 00103 // Access: Public, Static 00104 // Description: Returns the name of the binary executable that 00105 // started this program, if it can be determined. 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE string ExecutionEnvironment:: 00108 get_binary_name() { 00109 return get_ptr()->ns_get_binary_name(); 00110 } 00111 00112 //////////////////////////////////////////////////////////////////// 00113 // Function: ExecutionEnvironment::get_dtool_name 00114 // Access: Public, Static 00115 // Description: Returns the name of the libdtool DLL that 00116 // is used in this program, if it can be determined. 00117 //////////////////////////////////////////////////////////////////// 00118 INLINE string ExecutionEnvironment:: 00119 get_dtool_name() { 00120 return get_ptr()->ns_get_dtool_name(); 00121 }