1 /* Header for environment manipulation library.
2 Copyright (C) 1989-2017 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #if !defined (ENVIRON_H)
22 /* Class that represents the environment variables as seen by the
28 /* Regular constructor and destructor. */
31 /* Make sure that the vector contains at least a NULL element.
32 If/when we add more variables to it, NULL will always be the
34 m_environ_vector
.push_back (NULL
);
42 /* Move constructor. */
43 gdb_environ (gdb_environ
&&e
)
44 : m_environ_vector (std::move (e
.m_environ_vector
))
46 /* Make sure that the moved-from vector is left at a valid
47 state (only one NULL element). */
48 e
.m_environ_vector
.clear ();
49 e
.m_environ_vector
.push_back (NULL
);
52 /* Move assignment. */
53 gdb_environ
&operator= (gdb_environ
&&e
);
55 /* Create a gdb_environ object using the host's environment
57 static gdb_environ
from_host_environ ();
59 /* Clear the environment variables stored in the object. */
62 /* Return the value in the environment for the variable VAR. The
63 returned pointer is only valid as long as the gdb_environ object
65 const char *get (const char *var
) const;
67 /* Store VAR=VALUE in the environment. */
68 void set (const char *var
, const char *value
);
70 /* Unset VAR in environment. */
71 void unset (const char *var
);
73 /* Return the environment vector represented as a 'char **'. */
77 /* A vector containing the environment variables. */
78 std::vector
<char *> m_environ_vector
;
81 #endif /* defined (ENVIRON_H) */
This page took 0.02987 seconds and 4 git commands to generate.