#include <winstl/system/environment_block.hpp>
It is used as follows:
winstl::environment_block env; env.push_back("Name1", "Value1"); // Insert separate name and value env.push_back("Name2=Value2"); // Insert composite name and value ::CreateProcess( . . . // application name , . . . // command line , . . . // process attributes , . . . // thread attributes , . . . // handle inherit boolean , . . . // creation flags , const_cast<void*>(env.base()) // The environment , . . . // current directory , . . . // statup info , . . . // process info);
Public Types | |
Types | |
| typedef C | value_type |
| The value type. | |
| typedef C | char_type |
| The char type. | |
| typedef T | traits_type |
| The traits type. | |
| typedef A | allocator_type |
| The allocator type. | |
| typedef basic_environment_block< C, T, A > | class_type |
| The current parameterisation of the type. | |
| typedef size_t | size_type |
| The size type. | |
Public Member Functions | |
Construction | |
| basic_environment_block () | |
| Constructs an empty block. | |
| basic_environment_block (class_type const &rhs) | |
| Constructs the block with a copy of the given instance. | |
| class_type & | operator= (class_type const &rhs) |
| Copies the contents of the given instance. | |
Operations | |
| bool | push_back (char_type const *variable, size_t cch) |
| Append a full NAME=VALUE environment variable. | |
| template<typename S> | |
| bool | push_back (S const &variable) |
| Append a NAME= environment variable. | |
| bool | push_back (char_type const *name, size_t cchName, char_type const *value, size_t cchValue) |
| Append a full NAME=VALUE environment pair. | |
| template<typename S1, typename S2> | |
| bool | push_back (S1 const &name, S2 const &value) |
| Append a full NAME=VALUE environment pair. | |
| void | clear () |
| Empties the block of all variables. | |
| void | swap (class_type &rhs) throw () |
| Swaps the contents of the two instances. | |
Accessors | |
| void const * | base () const |
| Returns a pointer to the block contents. | |
| size_type | size () const |
| The number of characters in the block. | |
| size_type | length () const |
| The number of characters in the block. | |
| typedef C value_type |
The value type.
| typedef C char_type |
The char type.
| typedef T traits_type |
The traits type.
| typedef A allocator_type |
The allocator type.
| typedef basic_environment_block<C, T, A> class_type |
The current parameterisation of the type.
| typedef size_t size_type |
The size type.
| basic_environment_block | ( | ) | [inline] |
Constructs an empty block.
| basic_environment_block | ( | class_type const & | rhs | ) | [inline] |
Constructs the block with a copy of the given instance.
References basic_environment_block::m_buffer, and stlsoft::pod_copy_n().
| class_type& operator= | ( | class_type const & | rhs | ) | [inline] |
Copies the contents of the given instance.
| std::bad_alloc | When compiling with exception support, this will throw std::bad_alloc if memory cannot be acquired. When compiling absent exception support, failure to acquire memory will leave the instance unchanged. |
References basic_environment_block::m_buffer, and stlsoft::pod_copy_n().
| bool push_back | ( | char_type const * | variable, | |
| size_t | cch | |||
| ) | [inline] |
Append a full NAME=VALUE environment variable.
| variable | The variable | |
| cch | The length of the variable |
| std::bad_alloc | When compiling with exception support, this will throw std::bad_alloc if memory cannot be acquired. When compiling absent exception support, failure to acquire memory will cause the method to return false. |
References WINSTL_ASSERT.
| bool push_back | ( | S const & | variable | ) | [inline] |
Append a NAME= environment variable.
| variable | The variable |
| std::bad_alloc | When compiling with exception support, this will throw std::bad_alloc if memory cannot be acquired. When compiling absent exception support, failure to acquire memory will cause the method to return false. |
References stlsoft_ns_qual.
| bool push_back | ( | char_type const * | name, | |
| size_t | cchName, | |||
| char_type const * | value, | |||
| size_t | cchValue | |||
| ) | [inline] |
Append a full NAME=VALUE environment pair.
| name | The variable name | |
| cchName | The length of the variable name | |
| value | The variable value | |
| cchValue | The length of the variable value |
| std::bad_alloc | When compiling with exception support, this will throw std::bad_alloc if memory cannot be acquired. When compiling absent exception support, failure to acquire memory will cause the method to return false. |
References WINSTL_ASSERT.
| bool push_back | ( | S1 const & | name, | |
| S2 const & | value | |||
| ) | [inline] |
Append a full NAME=VALUE environment pair.
| name | The variable name | |
| value | The variable value |
| std::bad_alloc | When compiling with exception support, this will throw std::bad_alloc if memory cannot be acquired. When compiling absent exception support, failure to acquire memory will cause the method to return false. |
References stlsoft_ns_qual.
| void clear | ( | ) | [inline] |
Empties the block of all variables.
| void swap | ( | class_type & | rhs | ) | throw () [inline] |
Swaps the contents of the two instances.
| void const* base | ( | ) | const [inline] |
Returns a pointer to the block contents.
| size_type size | ( | ) | const [inline] |
The number of characters in the block.
| size_type length | ( | ) | const [inline] |
1.5.6