tntdb::Value Class Reference

The class Value represents a value, which is fetched from the database. More...

`#include <value.h>`

## Public Member Functions

| Value (IValue *value=0)
bool | isNull () const
| Explicit data-access.
bool | getBool () const
| return true, when value represents boolean true.
short | getShort () const
| tries to convert value into an short.
int | getInt () const
| tries to convert value into an int.
long | getLong () const
| tries to convert value into an long.
unsigned short | getUnsignedShort () const
| tries to convert value into an unsigned short.
unsigned | getUnsigned () const
| tries to convert value into an unsigned.
unsigned long | getUnsignedLong () const
| tries to convert value into an unsigned long.
int32_t | getInt32 () const
| tries to convert value into an int32_t.
uint32_t | getUnsigned32 () const
| tries to convert value into an uint32_t.
int64_t | getInt64 () const
| tries to convert value into an int64_t.
uint64_t | getUnsigned64 () const
| tries to convert value into an uint64_t.
Decimal | getDecimal () const
| tries to convert value into a Decimal.
float | getFloat () const
| tries to convert value into an float.
double | getDouble () const
| tries to convert value into an double.
char | getChar () const
| returns the first character of the text-representation.
std::string | getString () const
| returns the value as a string.
void | getString (std::string &ret) const
| fills the passed string with the value.
cxxtools::String | getUString () const
| returns the value as a unicode string.
void | getUString (cxxtools::String &ret) const
Blob | getBlob () const
| Returns the value as a blob.
void | getBlob (Blob &blob) const
| Returns the value as a blob.
Date | getDate () const
| returns the value as a Date.
Time | getTime () const
| returns the value as a Time.
Datetime | getDatetime () const
| returns the value as a Datetime.
template<typename T >
bool | getValue (T &ret) const
| Explicit data-access.
template<typename T >
bool | get (T &ret) const
| Shorter name for getValue.
bool | operator! () const
| Returns true, if this class is not connected to a actual statement.
const IValue * | getImpl () const
| Returns the actual implementation-class.

## Detailed Description

The class Value represents a value, which is fetched from the database.

## Member Function Documentation

## get()

template<typename T >

bool tntdb::Value::get | ( | T & | ret | ) | const

inline

Shorter name for getValue.

## getBlob() [1/2]

Blob tntdb::Value::getBlob | ( |  | ) | const

inline

Returns the value as a blob.

This is more or less an alias to getString just to stress, that the data is truly binary and not some text value.

## getBlob() [2/2]

void tntdb::Value::getBlob | ( | Blob & | blob | ) | const

inline

Returns the value as a blob.

## getBool()

bool tntdb::Value::getBool | ( |  | ) | const

inline

return true, when value represents boolean true.

## getChar()

char tntdb::Value::getChar | ( |  | ) | const

inline

returns the first character of the text-representation.

## getDate()

Date tntdb::Value::getDate | ( |  | ) | const

inline

returns the value as a Date.

## getDatetime()

Datetime tntdb::Value::getDatetime | ( |  | ) | const

inline

returns the value as a Datetime.

## getDecimal()

Decimal tntdb::Value::getDecimal | ( |  | ) | const

inline

tries to convert value into a Decimal.

## getDouble()

double tntdb::Value::getDouble | ( |  | ) | const

inline

tries to convert value into an double.

## getFloat()

float tntdb::Value::getFloat | ( |  | ) | const

inline

tries to convert value into an float.

## getImpl()

const IValue * tntdb::Value::getImpl | ( |  | ) | const

inline

Returns the actual implementation-class.

## getInt()

int tntdb::Value::getInt | ( |  | ) | const

inline

tries to convert value into an int.

## getInt32()

int32_t tntdb::Value::getInt32 | ( |  | ) | const

inline

tries to convert value into an int32_t.

## getInt64()

int64_t tntdb::Value::getInt64 | ( |  | ) | const

inline

tries to convert value into an int64_t.

## getLong()

long tntdb::Value::getLong | ( |  | ) | const

inline

tries to convert value into an long.

## getShort()

short tntdb::Value::getShort | ( |  | ) | const

inline

tries to convert value into an short.

## getString() [1/2]

std::string tntdb::Value::getString | ( |  | ) | const

inline

returns the value as a string.

## getString() [2/2]

void tntdb::Value::getString | ( | std::string & | ret | ) | const

inline

fills the passed string with the value.

this might be slightly more efficient than just returning a new string since one copy is saved.

## getTime()

Time tntdb::Value::getTime | ( |  | ) | const

inline

returns the value as a Time.

## getUnsigned()

unsigned tntdb::Value::getUnsigned | ( |  | ) | const

inline

tries to convert value into an unsigned.

## getUnsigned32()

uint32_t tntdb::Value::getUnsigned32 | ( |  | ) | const

inline

tries to convert value into an uint32_t.

## getUnsigned64()

uint64_t tntdb::Value::getUnsigned64 | ( |  | ) | const

inline

tries to convert value into an uint64_t.

## getUnsignedLong()

unsigned long tntdb::Value::getUnsignedLong | ( |  | ) | const

inline

tries to convert value into an unsigned long.

## getUnsignedShort()

unsigned short tntdb::Value::getUnsignedShort | ( |  | ) | const

inline

tries to convert value into an unsigned short.

## getUString()

cxxtools::String tntdb::Value::getUString | ( |  | ) | const

inline

returns the value as a unicode string.

## getValue()

template<typename T >

bool tntdb::Value::getValue | ( | T & | ret | ) | const

inline

Explicit data-access.

The get-template return false if the value is null. Otherwise the passed reference is filled with the value. If the value can't be converted to the requested type, a exception of type tntdb::TypeError is thrown.

In contrast to the getXXX-methods the type is not specified explictely but determined by the passed reference.

The extraction is actually done using the operator>> with a l-value of const Value& and a r-value of a reference to the actual type. This operator is defined for standard types and may be defined for user defined types.

## isNull()

bool tntdb::Value::isNull | ( |  | ) | const

inline

Explicit data-access.

The getXXX-methods return the value in the requested type. If the value can't be converted to the requested type, a exception of type tntdb::TypeError is thrown. return true, when value is null

## operator!()

bool tntdb::Value::operator! | ( |  | ) | const

inline

Returns true, if this class is not connected to a actual statement.

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

- tntdb/bits/value.h