OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
OpenAB::Variant Class Reference

Variant class that can contains different types of data. More...

#include <Variant.hpp>

Public Types

enum  DataType {
  INVALID, CHAR, BOOL, INTEGER,
  DOUBLE, STRING, SECURE_STRING, POINTER
}
 

Public Member Functions

 Variant ()
 Constructor. Creates invalid Variant. More...
 
 Variant (char value)
 Constructor. More...
 
 Variant (bool value)
 Constructor. More...
 
 Variant (u_int32_t value)
 Constructor. More...
 
 Variant (int32_t value)
 Constructor. More...
 
 Variant (double value)
 Constructor. More...
 
 Variant (const std::string &value)
 Constructor. More...
 
 Variant (void *value)
 Constructor. More...
 
 Variant (const char *value)
 Constructor. More...
 
 Variant (const OpenAB::SecureString &value)
 Constructor. More...
 
 Variant (Variant const &other)
 Copy constructor. More...
 
virtual ~Variant ()
 Destructor, virtual by default. More...
 
Variantoperator= (Variant const &other)
 Assignment operator. More...
 
bool operator== (Variant const &other)
 Compare operator. More...
 
void set (char value)
 
void set (bool value)
 
void set (int32_t value)
 
void set (u_int32_t value)
 
void set (double value)
 
void set (const std::string &value)
 
void set (const OpenAB::SecureString &value)
 
void set (void *value)
 
void set (const char *value)
 
char getChar () const
 
bool getBool () const
 
int32_t getInt () const
 
double getDouble () const
 
std::string getString () const
 
OpenAB::SecureString getSecureString () const
 
void * getPointer () const
 
DataType getType () const
 
bool invalid () const
 

Detailed Description

Variant class that can contains different types of data.

Member Enumeration Documentation

Enumerator
INVALID 

invalid type, used to indicate that Variant is not initialized

CHAR 

char type

BOOL 

bool type

INTEGER 

4-bytes signed integer type

DOUBLE 

double type

STRING 

string type

SECURE_STRING 

secure string eg. holding password

POINTER 

pointer type

Constructor & Destructor Documentation

OpenAB::Variant::Variant ( )

Constructor. Creates invalid Variant.

OpenAB::Variant::Variant ( char  value)

Constructor.

Parameters
[in]valuechar value to be stored in Variant
OpenAB::Variant::Variant ( bool  value)

Constructor.

Parameters
[in]valuebool value to be stored in Variant
OpenAB::Variant::Variant ( u_int32_t  value)

Constructor.

Parameters
[in]value4-bytes unsigned integer value to be stored in Variant
OpenAB::Variant::Variant ( int32_t  value)

Constructor.

Parameters
[in]value4-byte signed integer value to be stored in Variant
OpenAB::Variant::Variant ( double  value)

Constructor.

Parameters
[in]valuedouble value to be stored in Variant
OpenAB::Variant::Variant ( const std::string &  value)

Constructor.

Parameters
[in]valuestd::string value to be stored in Variant
OpenAB::Variant::Variant ( void *  value)

Constructor.

Parameters
[in]valuepointer value to be stored in Variant
OpenAB::Variant::Variant ( const char *  value)

Constructor.

Parameters
[in]valueconst pointer value to be stored in Variant
OpenAB::Variant::Variant ( const OpenAB::SecureString value)

Constructor.

Parameters
[in]valueOpenAB::SecureString value to be stored in Variant
OpenAB::Variant::Variant ( Variant const &  other)

Copy constructor.

OpenAB::Variant::~Variant ( )
virtual

Destructor, virtual by default.

Member Function Documentation

bool OpenAB::Variant::getBool ( ) const

Returns Variant::BOOL value stored in Variant

Returns
value stored in Variant, or false if Variant does not contain Variant::BOOL value
char OpenAB::Variant::getChar ( ) const

Returns Variant::CHAR value stored in Variant

Returns
value stored in Variant, or 0 if Variant does not contain Variant::CHAR value
double OpenAB::Variant::getDouble ( ) const

Returns Variant::DOUBLE value stored in Variant

Returns
value stored in Variant, or 0.0 if Variant does not contain Variant::DOUBLE value
int32_t OpenAB::Variant::getInt ( ) const

Returns Variant::INTEGER value stored in Variant

Returns
value stored in Variant, or 0 if Variant does not contain Variant::INTEGER value
void * OpenAB::Variant::getPointer ( ) const

Returns Variant::POINTER value stored in Variant

Returns
value stored in Variant, or NULL if Variant does not contain Variant::POINTER value
OpenAB::SecureString OpenAB::Variant::getSecureString ( ) const

Returns Variant::SECURE_STRING value stored in Variant

Returns
value stored in Variant, or empty OpenAB::SecureString if Variant does not contain Variant::SECURE_STRING value
std::string OpenAB::Variant::getString ( ) const

Returns Variant::STRING value stored in Variant

Returns
value stored in Variant, or empty string if Variant does not contain Variant::STRING value
Variant::DataType OpenAB::Variant::getType ( ) const

Returns data type stored by Variant

Returns
data type stored by Variant
bool OpenAB::Variant::invalid ( ) const

Checks if Variant was not initialized

Returns
true if Variant is not initialized, false otherwise
Variant & OpenAB::Variant::operator= ( Variant const &  other)

Assignment operator.

bool OpenAB::Variant::operator== ( Variant const &  other)

Compare operator.

void OpenAB::Variant::set ( char  value)

Sets char value to be stored in Variant.

Parameters
[in]valuechar value to be stored in Variant.
void OpenAB::Variant::set ( bool  value)

Sets bool value to be stored in Variant.

Parameters
[in]valuebool value to be stored in Variant.
void OpenAB::Variant::set ( int32_t  value)

Sets 4-bytes signed integer value to be stored in Variant.

Parameters
[in]value4-bytes signed integer value to be stored in Variant.
void OpenAB::Variant::set ( u_int32_t  value)

Sets 4-bytes unsigned integer value to be stored in Variant.

Parameters
[in]value4-bytes unsigned integer value to be stored in Variant.
void OpenAB::Variant::set ( double  value)

Sets double value to be stored in Variant.

Parameters
[in]valuedouble value to be stored in Variant.
void OpenAB::Variant::set ( const std::string &  value)

Sets string value to be stored in Variant.

Parameters
[in]valuestring value to be stored in Variant.
void OpenAB::Variant::set ( const OpenAB::SecureString value)

Sets OpenAB::SecureString value to be stored in Variant.

Parameters
[in]valueOpenAB::SecureString value to be stored in Variant.
void OpenAB::Variant::set ( void *  value)

Sets pointer value to be stored in Variant.

Parameters
[in]valuepointer value to be stored in Variant.
void OpenAB::Variant::set ( const char *  value)

Sets pointer value to be stored in Variant.

Parameters
[in]valuepointer value to be stored in Variant.

Member Data Documentation

bool OpenAB::Variant::b
char OpenAB::Variant::c
double OpenAB::Variant::d
int32_t OpenAB::Variant::i
void* OpenAB::Variant::p

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