Panda3D
 All Classes Functions Variables Enumerations
executionEnvironment.I
1 // Filename: executionEnvironment.I
2 // Created by: drose (15May00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ExecutionEnvironment::has_environment_variable
18 // Access: Public, Static
19 // Description: Returns true if the indicated environment variable
20 // is defined.
21 ////////////////////////////////////////////////////////////////////
22 INLINE bool ExecutionEnvironment::
23 has_environment_variable(const string &var) {
24  return get_ptr()->ns_has_environment_variable(var);
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: ExecutionEnvironment::get_environment_variable
29 // Access: Public, Static
30 // Description: Returns the definition of the indicated environment
31 // variable, or the empty string if the variable is
32 // undefined.
33 ////////////////////////////////////////////////////////////////////
34 INLINE string ExecutionEnvironment::
35 get_environment_variable(const string &var) {
36  return get_ptr()->ns_get_environment_variable(var);
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: ExecutionEnvironment::set_environment_variable
41 // Access: Public, Static
42 // Description: Changes the definition of the indicated environment
43 // variable.
44 ////////////////////////////////////////////////////////////////////
45 INLINE void ExecutionEnvironment::
46 set_environment_variable(const string &var, const string &value) {
47  get_ptr()->ns_set_environment_variable(var, value);
48 }
49 
50 ////////////////////////////////////////////////////////////////////
51 // Function: ExecutionEnvironment::shadow_environment_variable
52 // Access: Public, Static
53 // Description: Changes the apparent definition of the indicated
54 // environment variable by masking it within this class
55 // with a new value. This does not change the actual
56 // environment variable, but future calls to
57 // get_environment_variable() will return this new
58 // value.
59 ////////////////////////////////////////////////////////////////////
60 INLINE void ExecutionEnvironment::
61 shadow_environment_variable(const string &var, const string &value) {
62  get_ptr()->ns_shadow_environment_variable(var, value);
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: ExecutionEnvironment::clear_shadow
67 // Access: Public, Static
68 // Description: Removes a value set by a previous call to
69 // shadow_environment_variable(), and lets the actual
70 // value of the variable show again.
71 ////////////////////////////////////////////////////////////////////
72 INLINE void ExecutionEnvironment::
73 clear_shadow(const string &var) {
74  get_ptr()->ns_clear_shadow(var);
75 }
76 
77 ////////////////////////////////////////////////////////////////////
78 // Function: ExecutionEnvironment::get_num_args
79 // Access: Public, Static
80 // Description: Returns the number of command-line arguments
81 // available, not counting arg 0, the binary name.
82 ////////////////////////////////////////////////////////////////////
83 INLINE int ExecutionEnvironment::
85  return get_ptr()->ns_get_num_args();
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: ExecutionEnvironment::get_arg
90 // Access: Public, Static
91 // Description: Returns the nth command-line argument. The index n
92 // must be in the range [0 .. get_num_args()). The
93 // first parameter, n == 0, is the first actual
94 // parameter, not the binary name.
95 ////////////////////////////////////////////////////////////////////
96 INLINE string ExecutionEnvironment::
97 get_arg(int n) {
98  return get_ptr()->ns_get_arg(n);
99 }
100 
101 ////////////////////////////////////////////////////////////////////
102 // Function: ExecutionEnvironment::get_binary_name
103 // Access: Public, Static
104 // Description: Returns the name of the binary executable that
105 // started this program, if it can be determined.
106 ////////////////////////////////////////////////////////////////////
107 INLINE string ExecutionEnvironment::
109  return get_ptr()->ns_get_binary_name();
110 }
111 
112 ////////////////////////////////////////////////////////////////////
113 // Function: ExecutionEnvironment::get_dtool_name
114 // Access: Public, Static
115 // Description: Returns the name of the libdtool DLL that
116 // is used in this program, if it can be determined.
117 ////////////////////////////////////////////////////////////////////
118 INLINE string ExecutionEnvironment::
120  return get_ptr()->ns_get_dtool_name();
121 }
122 
123 ////////////////////////////////////////////////////////////////////
124 // Function: ExecutionEnvironment::set_binary_name
125 // Access: Public, Static
126 // Description: Do not use.
127 ////////////////////////////////////////////////////////////////////
128 INLINE void ExecutionEnvironment::
129 set_binary_name(const string &name) {
130  get_ptr()->_binary_name = name;
131 }
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: ExecutionEnvironment::set_dtool_name
135 // Access: Public, Static
136 // Description: Do not use.
137 ////////////////////////////////////////////////////////////////////
138 INLINE void ExecutionEnvironment::
139 set_dtool_name(const string &name) {
140  get_ptr()->_dtool_name = name;
141 }
static string get_binary_name()
Returns the name of the binary executable that started this program, if it can be determined...
static void set_dtool_name(const string &name)
Do not use.
static bool has_environment_variable(const string &var)
Returns true if the indicated environment variable is defined.
static string get_dtool_name()
Returns the name of the libdtool DLL that is used in this program, if it can be determined.
static string get_environment_variable(const string &var)
Returns the definition of the indicated environment variable, or the empty string if the variable is ...
static void clear_shadow(const string &var)
Removes a value set by a previous call to shadow_environment_variable(), and lets the actual value of...
static void set_environment_variable(const string &var, const string &value)
Changes the definition of the indicated environment variable.
static string get_arg(int n)
Returns the nth command-line argument.
static int get_num_args()
Returns the number of command-line arguments available, not counting arg 0, the binary name...
static void set_binary_name(const string &name)
Do not use.
static void shadow_environment_variable(const string &var, const string &value)
Changes the apparent definition of the indicated environment variable by masking it within this class...