Mirror reflection library 0.5.13

mirror::enum_value_by_name< Enum > Class Template Reference

A monostate utility class that allows to get enumerated value by its name. More...

#include <mirror/utils/enum_val_by_name.hpp>

List of all members.

Static Public Member Functions

static bool has (const std::string &name)
 Checks if the enumeration has a value with the given name.
static Enum get (const std::string &name)
 Gets the enumerated value by name.
static std::pair< bool, Enum > get_opt (const std::string &name)
 Gets a pair of bool and Enum value by name.

Detailed Description

template<typename Enum>
class mirror::enum_value_by_name< Enum >

A monostate utility class that allows to get enumerated value by its name.


Member Function Documentation

template<typename Enum >
static Enum mirror::enum_value_by_name< Enum >::get ( const std::string &  name) [inline, static]

Gets the enumerated value by name.

The name must be a valid name of one of the values, otherwise this function will assert. To check if the name exists use the has() member function

template<typename Enum >
static std::pair<bool, Enum> mirror::enum_value_by_name< Enum >::get_opt ( const std::string &  name) [inline, static]

Gets a pair of bool and Enum value by name.

The boolean value indicates whether a value with the name passed as argument was found. If true then the second member contains the found value otherwise the value of the second member is unspecified.

See also:
has
get

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

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.