basic_environment_block Class Template Reference
[System Library]

#include <winstl/system/environment_block.hpp>

List of all members.


Detailed Description

template<typename C, typename T = char_traits<C>, typename A = processheap_allocator<C>>
class winstl::basic_environment_block< C, T, A >

Class used for preparing environment blocks compatible with the Windows CreateProcess() function.

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_typeoperator= (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.

Member Typedef Documentation

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.

The current parameterisation of the type.

typedef size_t size_type

The size type.


Constructor & Destructor Documentation

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().


Member Function Documentation

class_type& operator= ( class_type const &  rhs  )  [inline]

Copies the contents of the given instance.

Exceptions:
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.

Parameters:
variable The variable
cch The length of the variable
Returns:
An indication of success. This will always return true when compiling with exception support.
Note:
The variable must contain an equal sign ('=')
Exceptions:
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.

Parameters:
variable The variable
Returns:
An indication of success. This will always return true when compiling with exception support.
Note:
The variable must contain an equal sign ('=')
Exceptions:
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.

Parameters:
name The variable name
cchName The length of the variable name
value The variable value
cchValue The length of the variable value
Returns:
An indication of success. This will always return true when compiling with exception support.
Exceptions:
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.

Parameters:
name The variable name
value The variable value
Returns:
An indication of success. This will always return true when compiling with exception support.
Exceptions:
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]

The number of characters in the block.

Note:
This method is a synonym for size()


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:59:37 2010 for STLSoft by  doxygen 1.5.6