environment_map Class Reference

#include <platformstl/system/environment_map.hpp>

Inheritance diagram for environment_map:

stl_collection_tag collection_tag

List of all members.


Detailed Description

Provides an associative STL-collection interface to the current process's system environment.

Note:
The design and implementation of this class is documented in Part 2 of the forthcoming book Extended STL.

Member Types

typedef string_type first_type
 The string type used for variable name, and lookup.
typedef string_type second_type
 The string type used for variable value, and retrieval.
typedef std::pair< const
first_type, second_type
value_type
 Value type of the class: a pair of first_type and second_type.
typedef size_t size_type
 The size type.
typedef ss_ptrdiff_t difference_type
 The difference type.
typedef const value_type const_reference
 The non-mutating (const) reference type.
typedef environment_map class_type
 The type of the class.

Public Member Functions

Construction
 environment_map ()
 Constructs an instance of the type.
Element Access
second_type operator[] (char const *name) const
 Returns the value of the given environment variable, or throws std::out_of_range if it does not exist.
second_type operator[] (first_type const &name) const
 Returns the value of the given environment variable, or throws std::out_of_range if it does not exist.
bool lookup (char const *name, second_type &value) const
 Looks for the variable of the given name in the current process environment.
bool lookup (first_type const &name, second_type &value) const
 Looks for the variable of the given name in the current process environment.
Operations
void refresh ()
 Discard any current enumeration snapshots.

Classes

class  snapshot

Member Typedef Documentation

typedef string_type first_type

The string type used for variable name, and lookup.

Note:
This is the association "key" type

typedef string_type second_type

The string type used for variable value, and retrieval.

Note:
This is the association "value" type

typedef std::pair< const first_type , second_type > value_type

Value type of the class: a pair of first_type and second_type.

typedef size_t size_type

The size type.

typedef ss_ptrdiff_t difference_type

The difference type.

typedef const value_type const_reference

The non-mutating (const) reference type.

The type of the class.


Constructor & Destructor Documentation

environment_map (  ) 

Constructs an instance of the type.

Note:
This instance does not store a snapshot of the environment at the time of its construction. All lookup and iteration is carried out 'live' at the time of invocation.


Member Function Documentation

second_type operator[] ( char const *  name  )  const

Returns the value of the given environment variable, or throws std::out_of_range if it does not exist.

Parameters:
name The name of the environment variable whose value is to be retrieved
Exceptions:
std::out_of_range If no variable exists with the given name

second_type operator[] ( first_type const &  name  )  const

Returns the value of the given environment variable, or throws std::out_of_range if it does not exist.

Parameters:
name The name of the environment variable whose value is to be retrieved
Exceptions:
std::out_of_range If no variable exists with the given name

bool lookup ( char const *  name,
second_type value 
) const

Looks for the variable of the given name in the current process environment.

Returns:
A Boolean value indicating whether the variable was found

bool lookup ( first_type const &  name,
second_type value 
) const

Looks for the variable of the given name in the current process environment.

Returns:
A Boolean value indicating whether the variable was found

void refresh (  ) 

Discard any current enumeration snapshots.

Used to force the collection instance to discard any currently snapshotd snapshot it may be holding on behalf of extant iterator instances, so that new iterator instances will receive a refreshed view of the underlying environment.


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

Generated on Thu Jun 10 08:58:33 2010 for STLSoft by  doxygen 1.5.6