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