19 #ifndef SBUILD_ENVIRONMENT_H
20 #define SBUILD_ENVIRONMENT_H
22 #include <sbuild/log.h>
23 #include <sbuild/parse-value.h>
24 #include <sbuild/regex.h>
30 #include <boost/format.hpp>
41 using std::map<std::string, std::string>::value_type;
85 add (
char **environment);
94 add (
const environment& environment);
103 add (
const value_type& value);
113 add (
const std::string& name,
114 const std::string& value)
116 add(std::make_pair(name, value));
128 add (
const std::string& name,
131 std::ostringstream varstring;
132 varstring.imbue(std::locale::classic());
133 varstring << std::boolalpha << value;
134 add(std::make_pair(name, varstring.str()));
145 add (
const std::string& value);
173 remove (
const std::string& value);
182 remove (
const value_type& value);
192 template <
typename T>
194 get (
const std::string& name,
199 const_iterator pos = find(name);
234 template <
typename T>
248 template <
typename T>
263 template <
typename T>
268 environment ret(lhs);
280 template <
typename T>
285 environment ret(lhs);
297 template <
class charT,
class traits>
299 std::basic_ostream<charT,traits>&
300 operator << (std::basic_ostream<charT,traits>& stream,
301 const environment& rhs)
303 for (
const auto& env : rhs)
305 stream << env.first <<
'=' << env.second <<
'\n';
POSIX extended regular expression.
Definition: regex.h:66
Debian source builder components.
Definition: ctty.cc:31
environment & operator+=(T const &rhs)
Add variables to the environment.
Definition: environment.h:236
void add(const std::string &name, const std::string &value)
Add environment variable.
Definition: environment.h:113
regex filter
Filter regex.
Definition: environment.h:313
Notification messages.
Definition: log.h:31
void add(char **environment)
Add environment variables.
Definition: environment.cc:59
environment()
The constructor.
Definition: environment.cc:30
friend environment operator+(const environment &lhs, T const &rhs)
Add variables to the environment.
Definition: environment.h:265
std::ostream & log_debug(debug_level level)
Log a debug message.
Definition: log.cc:110
Container of environment variables.
Definition: environment.h:38
friend environment operator-(const environment &lhs, T const &rhs)
Remove variables from the environment.
Definition: environment.h:282
regex const & get_filter() const
Get environment filter.
Definition: environment.cc:53
Parse error.
Definition: parse-error.h:34
~environment()
The destructor.
Definition: environment.cc:42
void add(const std::string &name, T const &value)
Add environment variable.
Definition: environment.h:128
char ** get_strv() const
Get the evironment variables as a string vector.
Definition: environment.cc:157
Informational messages.
Definition: log.h:32
environment & operator-=(T const &rhs)
Remove variables from the environment.
Definition: environment.h:250
void parse_value(const std::string &value, bool &parsed_value)
Parse a boolean value.
Definition: parse-value.cc:35
void set_filter(const regex &filter)
Set environment filter.
Definition: environment.cc:47
std::ostream & log_warning()
Log a warning message.
Definition: log.cc:96