MACE  1.0.0
 All Classes Namespaces Files Functions Variables Enumerations Defines
Public Member Functions
mace::reflect::value Class Reference

#include <value.hpp>

Inheritance diagram for mace::reflect::value:
mace::reflect::value_base

List of all members.

Public Member Functions

template<typename T >
 value (const T &v)
 value (value &&v)
template<typename T >
 value (typename boost::remove_reference< T >::type &&v)
 value (const value_cref &)
 value (const value_ref &)
template<typename T >
valueoperator= (const T &v)
template<typename T >
valueoperator= (T &&v)
template<typename T >
valueoperator= (value &&v)
template<typename T >
valueoperator= (const value &v)
template<typename T >
valueoperator= (const value_ref &v)
template<typename T >
valueoperator= (const value_cref &v)
value_cref operator[] (const std::string &field) const
value_ref operator[] (const std::string &field)
value_cref operator[] (uint64_t idx) const
value_ref operator[] (uint64_t idx)

Detailed Description

A value may hold any type and provides polymorphic access to its members by name. In general a value may hold a struct, array, map, number, string, null, bool, or function.

    struct test {
      int num;
      std::string str;
      int print( std::string& );
    };
    value v(test());
    v["num"].as<int>();
    v["num"].as<std::string>();
    v["str"].as<std::string>();
    v["str"].as<int>();
    v["print"]( "hello world" );

Given a value you can iterate over its members and perform actions.

Definition at line 32 of file value.hpp.


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