ed
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ed::io::Variant Class Reference

#include <variant.h>

Public Member Functions

bool getValue (bool &v) const
 
bool getValue (double &v) const
 
bool getValue (float &v) const
 
bool getValue (int &v) const
 
bool getValue (std::string &v) const
 
bool isString () const
 
bool valid () const
 
 Variant ()
 
 Variant (const char *s)
 
 Variant (const double &d)
 
 Variant (const std::string &s)
 
 Variant (int i)
 

Private Member Functions

template<typename T >
bool checkAndGet (const T &v, char type, T &out) const
 

Private Attributes

union {
   double   d_
 
   int   i_
 
}; 
 
std::string s_
 
char type_
 

Friends

std::ostreamoperator<< (std::ostream &out, const Variant &v)
 

Detailed Description

Definition at line 15 of file io/variant.h.

Constructor & Destructor Documentation

◆ Variant() [1/5]

ed::io::Variant::Variant ( )
inline

Definition at line 20 of file io/variant.h.

◆ Variant() [2/5]

ed::io::Variant::Variant ( const double &  d)
inline

Definition at line 22 of file io/variant.h.

◆ Variant() [3/5]

ed::io::Variant::Variant ( int  i)
inline

Definition at line 23 of file io/variant.h.

◆ Variant() [4/5]

ed::io::Variant::Variant ( const std::string s)
inline

Definition at line 24 of file io/variant.h.

◆ Variant() [5/5]

ed::io::Variant::Variant ( const char *  s)
inline

Definition at line 25 of file io/variant.h.

Member Function Documentation

◆ checkAndGet()

template<typename T >
bool ed::io::Variant::checkAndGet ( const T &  v,
char  type,
T &  out 
) const
inlineprivate

Definition at line 57 of file io/variant.h.

◆ getValue() [1/5]

bool ed::io::Variant::getValue ( bool &  v) const
inline

Definition at line 32 of file io/variant.h.

◆ getValue() [2/5]

bool ed::io::Variant::getValue ( double &  v) const
inline

Definition at line 28 of file io/variant.h.

◆ getValue() [3/5]

bool ed::io::Variant::getValue ( float &  v) const
inline

Definition at line 29 of file io/variant.h.

◆ getValue() [4/5]

bool ed::io::Variant::getValue ( int &  v) const
inline

Definition at line 27 of file io/variant.h.

◆ getValue() [5/5]

bool ed::io::Variant::getValue ( std::string v) const
inline

Definition at line 30 of file io/variant.h.

◆ isString()

bool ed::io::Variant::isString ( ) const
inline

Definition at line 41 of file io/variant.h.

◆ valid()

bool ed::io::Variant::valid ( ) const
inline

Definition at line 43 of file io/variant.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream out,
const Variant v 
)
friend

Definition at line 65 of file io/variant.h.

Member Data Documentation

◆ @1

union { ... }

◆ d_

double ed::io::Variant::d_

Definition at line 51 of file io/variant.h.

◆ i_

int ed::io::Variant::i_

Definition at line 50 of file io/variant.h.

◆ s_

std::string ed::io::Variant::s_
private

Definition at line 54 of file io/variant.h.

◆ type_

char ed::io::Variant::type_
private

Definition at line 47 of file io/variant.h.


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