Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE bool ExecutionEnvironment::
18has_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 */
26INLINE std::string ExecutionEnvironment::
27get_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 */
34INLINE void ExecutionEnvironment::
35set_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 */
46shadow_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 */
55clear_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 */
63INLINE size_t ExecutionEnvironment::
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 */
73INLINE std::string ExecutionEnvironment::
74get_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 */
82INLINE std::string ExecutionEnvironment::
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 */
91INLINE std::string ExecutionEnvironment::
93 return get_ptr()->ns_get_dtool_name();
94}
95
96/**
97 * Do not use.
98 */
99INLINE void ExecutionEnvironment::
100set_binary_name(const std::string &name) {
101 get_ptr()->_binary_name = name;
102}
103
104/**
105 * Do not use.
106 */
107INLINE void ExecutionEnvironment::
108set_dtool_name(const std::string &name) {
109 get_ptr()->_dtool_name = name;
110}
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...
get_dtool_name
Returns the name of the libdtool DLL that is used in this program, if it can be determined.
set_environment_variable
Changes the definition of the indicated environment variable.
get_num_args
Returns the number of command-line arguments available, not counting arg 0, the binary name.
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...
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 ...
get_binary_name
Returns the name of the binary executable that started this program, if it can be determined.
get_arg
Returns the nth command-line argument.