Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template basic_native_environment

boost::process::basic_native_environment — Definition of the environment for the current process.

Synopsis

// 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 &);
};

Description

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/destruct

  1. basic_native_environment();
    Default constructor.
  2. basic_native_environment(basic_native_environment &&);
    Move constructor.
  3. basic_native_environment & operator=(basic_native_environment &&);
    Move assignment.

basic_native_environment public member functions

  1. iterator begin();
    Returns an iterator to the beginning.
  2. const_iterator begin() const;
    Returns an iterator to the beginning.
  3. const_iterator cbegin() const;
    Returns an iterator to the beginning.
  4. iterator end();
    Returns an iterator to the end.
  5. const_iterator end() const;
    Returns an iterator to the end.
  6. const_iterator cend() const;
    Returns an iterator to the end.
  7. iterator find(const string_type & key);
    Find a variable by its name.
  8. const_iterator find(const string_type & key) const;
    Find a variable by its name.
  9. std::size_t count(const string_type & st) const;
    Number of variables.
  10. void erase(const string_type & id);

    Erase variable by id.

  11. std::pair< iterator, bool > 
    emplace(const string_type & id, const string_type & value);
    Emplace an environment variable.
  12. bool empty();
    Check if environment has entries.
  13. std::size_t size() const;
    Get the number of variables.
  14. entry_type at(const string_type & key);
    Get the entry with the key. Throws if it does not exist.
  15. const_entry_type at(const string_type & key) const;
    Get the entry with the key. Throws if it does not exist.
  16. entry_type operator[](const string_type & key);
    Get the entry with the given key. It creates the entry if it doesn't exist.

PrevUpHomeNext