...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::process::basic_native_environment — Definition of the environment for the current process.
// In header: <boost/process/environment.hpp> template<typename Char> class basic_native_environment { public: // types typedef std::basic_string< Char > string_type; typedef boost::transform_iterator< entry_maker, Char ** > iterator; typedef boost::transform_iterator< const_entry_maker, Char ** > const_iterator; typedef std::size_t size_type; typedef unspecified native_handle; typedef unspecified base_type; // member classes/structs/unions template<typename Char, typename Environment> struct const_entry_type { // types typedef Char value_type; typedef const value_type * pointer; typedef std::basic_string< value_type > string_type; typedef boost::iterator_range< pointer > range; typedef Environment environment_t; // construct/copy/destruct const_entry & operator=(const const_entry &) = default; // public member functions std::vector< string_type > to_vector() const; const_entry(const const_entry &) = default; bool empty() const; }; template<typename Char, typename Environment> struct entry_type { // types typedef Char value_type; typedef const value_type * pointer; typedef std::basic_string< value_type > string_type; typedef boost::iterator_range< pointer > range; typedef Environment environment_t; // construct/copy/destruct entry & operator=(const entry &) = default; entry & operator=(const string_type &); entry & operator=(const std::vector< string_type > &); // public member functions std::vector< string_type > to_vector() const; entry(const entry &) = default; bool empty() const; void assign(const string_type &); void assign(const std::vector< string_type > &); void append(const string_type &); void clear(); entry & operator+=(const string_type &); }; // construct/copy/destruct basic_native_environment(); basic_native_environment(basic_native_environment &&); basic_native_environment & operator=(basic_native_environment &&); // public member functions iterator begin(); const_iterator begin() const; const_iterator cbegin() const; iterator end(); const_iterator end() const; const_iterator cend() const; iterator find(const string_type &); const_iterator find(const string_type &) const; std::size_t count(const string_type &) const; void erase(const string_type &); std::pair< iterator, bool > emplace(const string_type &, const string_type &); bool empty(); std::size_t size() const; entry_type at(const string_type &); const_entry_type at(const string_type &) const; entry_type operator[](const string_type &); };
Template representation of the environment of this process. It takes a template as template parameter to implement the environment. All instances of this class refer to the same environment, but might not get updated if another one makes changes.
basic_native_environment
public
construct/copy/destructbasic_native_environment();Default constructor.
basic_native_environment(basic_native_environment &&);Move constructor.
basic_native_environment & operator=(basic_native_environment &&);Move assignment.
basic_native_environment
public member functionsiterator begin();Returns an iterator to the beginning.
const_iterator begin() const;Returns an iterator to the beginning.
const_iterator cbegin() const;Returns an iterator to the beginning.
iterator end();Returns an iterator to the end.
const_iterator end() const;Returns an iterator to the end.
const_iterator cend() const;Returns an iterator to the end.
iterator find(const string_type & key);Find a variable by its name.
const_iterator find(const string_type & key) const;Find a variable by its name.
std::size_t count(const string_type & st) const;Number of variables.
void erase(const string_type & id);
Erase variable by id.
std::pair< iterator, bool > emplace(const string_type & id, const string_type & value);Emplace an environment variable.
bool empty();Check if environment has entries.
std::size_t size() const;Get the number of variables.
entry_type at(const string_type & key);Get the entry with the key. Throws if it does not exist.
const_entry_type at(const string_type & key) const;Get the entry with the key. Throws if it does not exist.
entry_type operator[](const string_type & key);Get the entry with the given key. It creates the entry if it doesn't exist.