MongoDB  2.7.0
Public Member Functions | List of all members
mongo::optionenvironment::Value Class Reference

A simple container interface for storing various C++ values. More...

#include <value.h>

Public Member Functions

 Value (StringVector_t val)
 
 Value (StringMap_t val)
 
 Value (bool val)
 
 Value (double val)
 
 Value (int val)
 
 Value (long val)
 
 Value (std::string val)
 
 Value (unsigned long long val)
 
 Value (unsigned val)
 
Status get (StringVector_t *val) const
 
Status get (StringMap_t *val) const
 
Status get (bool *val) const
 
Status get (double *val) const
 
Status get (int *val) const
 
Status get (long *val) const
 
Status get (string *val) const
 
Status get (unsigned long long *val) const
 
Status get (unsigned *val) const
 
std::string typeToString () const
 Return the value's type as a string.
 
bool isEmpty () const
 Return true if the value was created with the no argument constructor.
 
bool equal (const Value &) const
 Return true if the other Value equals this value, both in type and in contents. More...
 
std::string toString () const
 Return the string representation of this Value. More...
 
template<typename T >
as () const
 The functions below are the legacy interface to be consistent with boost::any during the transition period. More...
 
const std::type_info & type () const
 Return the type_info for this value.
 

Detailed Description

A simple container interface for storing various C++ values.

Usage:

Value intVal(2); Value stringVal("string");

int intContents = 1; Status ret = stringVal.get(&intContents); // ret != Status::OK() // intContents is still 1

ret = intVal.get(&intContents); // ret == Status::OK() // intContents is now 2

Member Function Documentation

template<typename T >
T mongo::optionenvironment::Value::as ( ) const

The functions below are the legacy interface to be consistent with boost::any during the transition period.

Returns the contents of this Value as type T. Throws MsgAssertionException if the type does not match

bool mongo::optionenvironment::Value::equal ( const Value otherVal) const

Return true if the other Value equals this value, both in type and in contents.

Two empty values are equal

std::string mongo::optionenvironment::Value::toString ( ) const

Return the string representation of this Value.

This function is used only for debugging purposes and does not output data in an easily parseable format.


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