libsl3 1.2.41002
A C++ interface for SQLite
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
sl3::Value Class Reference

This class models the duck typing sqlite uses. It supports int, real, text, blob and null values. More...

#include <sl3/value.hpp>

Public Member Functions

 Value () noexcept
 Constructor.
 
 Value (int val) noexcept
 Constructor.
 
 Value (int64_t val) noexcept
 Constructor.
 
 Value (std::string val) noexcept
 Constructor.
 
 Value (const char *val)
 Constructor.
 
 Value (double val) noexcept
 Constructor.
 
 Value (Blob val) noexcept
 Constructor.
 
 ~Value () noexcept
 Destructor.
 
 Value (const Value &) noexcept
 Copy constructor.
 
 Value (Value &&) noexcept
 Move constructor.
 
Valueoperator= (const Value &val)
 Assignment.
 
Valueoperator= (Value &&val)
 Assignment.
 
Valueoperator= (int val)
 Assignment.
 
Valueoperator= (const int64_t &val)
 Assignment.
 
Valueoperator= (const double &val)
 Assignment.
 
Valueoperator= (const std::string &val)
 Assignment.
 
Valueoperator= (const Blob &val)
 Assignment.
 
 operator int () const
 Implicit conversion operator.
 
 operator int64_t () const
 Implicit conversion operator.
 
 operator double () const
 Implicit conversion operator.
 
 operator const std::string & () const
 Implicit conversion operator.
 
 operator const Blob & () const
 Implicit conversion operator.
 
const int64_t & int64 () const
 Access the value.
 
const double & real () const
 Access the value.
 
const std::string & text () const
 Access the value.
 
const Blobblob () const
 Access the value.
 
std::string ejectText ()
 Moves the current value into the return value.
 
Blob ejectBlob ()
 Moves the current value into the return value.
 
void setNull () noexcept
 Set to NULL.
 
bool isNull () const noexcept
 Check Null.
 
Type getType () const noexcept
 The Type of the value.
 
void swap (Value &other) noexcept
 swap function
 

Detailed Description

This class models the duck typing sqlite uses. It supports int, real, text, blob and null values.

The class has the current type info availalbe.

Constructor & Destructor Documentation

◆ Value() [1/9]

sl3::Value::Value ( )
noexcept

Constructor.

Creates a Null Value

◆ Value() [2/9]

sl3::Value::Value ( int  val)
explicitnoexcept

Constructor.

This constructor wiht an initialization value

Parameters
valinitial value

◆ Value() [3/9]

sl3::Value::Value ( int64_t  val)
explicitnoexcept

Constructor.

This constructor wiht an initialization value

Parameters
valinitial value

◆ Value() [4/9]

sl3::Value::Value ( std::string  val)
explicitnoexcept

Constructor.

This constructor wiht an initialization value

Parameters
valinitial value

◆ Value() [5/9]

sl3::Value::Value ( const char *  val)
explicit

Constructor.

This constructor wiht an initialization value

Parameters
valinitial value

◆ Value() [6/9]

sl3::Value::Value ( double  val)
explicitnoexcept

Constructor.

This constructor wiht an initialization value

Parameters
valinitial value

◆ Value() [7/9]

sl3::Value::Value ( Blob  val)
explicitnoexcept

Constructor.

This constructor wiht an initialization value

Parameters
valinitial value

◆ ~Value()

sl3::Value::~Value ( )
noexcept

Destructor.

◆ Value() [8/9]

sl3::Value::Value ( const Value )
noexcept

Copy constructor.

◆ Value() [9/9]

sl3::Value::Value ( Value &&  )
noexcept

Move constructor.

Member Function Documentation

◆ blob()

const Blob & sl3::Value::blob ( ) const

Access the value.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif the current value has a different type.
Returns
reference to the value

◆ ejectBlob()

Blob sl3::Value::ejectBlob ( )

Moves the current value into the return value.

After calling this function the value will be Null.

Exceptions
sl3::ErrTypeMisMatchin case of wrong type.
Returns
The value

◆ ejectText()

std::string sl3::Value::ejectText ( )

Moves the current value into the return value.

After calling this function the value will be Null.

Exceptions
sl3::ErrTypeMisMatchin case of wrong type.
Returns
The value

◆ getType()

Type sl3::Value::getType ( ) const
noexcept

The Type of the value.

Returns
the type

◆ int64()

const int64_t & sl3::Value::int64 ( ) const

Access the value.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif the current value has a different type.
Returns
reference to the value

◆ isNull()

bool sl3::Value::isNull ( ) const
noexcept

Check Null.

Returns
if the value is null

◆ operator const Blob &()

sl3::Value::operator const Blob & ( ) const
explicit

Implicit conversion operator.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif getType is incompatible
Returns
the value

◆ operator const std::string &()

sl3::Value::operator const std::string & ( ) const
explicit

Implicit conversion operator.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif getType is incompatible
Returns
the value

◆ operator double()

sl3::Value::operator double ( ) const
explicit

Implicit conversion operator.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif getType is incompatible
sl3::ErrOutOfRangeis the stored value is an int64_t and out of the min or max double range.
Returns
the value

◆ operator int()

sl3::Value::operator int ( ) const
explicit

Implicit conversion operator.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif getType is incompatible
sl3::ErrOutOfRangeis the stored value is an int64_t
Returns
the value

◆ operator int64_t()

sl3::Value::operator int64_t ( ) const
explicit

Implicit conversion operator.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif getType is incompatible
Returns
the value

◆ operator=() [1/7]

Value & sl3::Value::operator= ( const Blob val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ operator=() [2/7]

Value & sl3::Value::operator= ( const double &  val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ operator=() [3/7]

Value & sl3::Value::operator= ( const int64_t &  val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ operator=() [4/7]

Value & sl3::Value::operator= ( const std::string &  val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ operator=() [5/7]

Value & sl3::Value::operator= ( const Value val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ operator=() [6/7]

Value & sl3::Value::operator= ( int  val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ operator=() [7/7]

Value & sl3::Value::operator= ( Value &&  val)

Assignment.

Exceptions
sl3::ErrTypeMisMatchif getType is incompatible
Note
, only value assignment happens here, the type does not change, the storage type might change in case of type is a variant.
Parameters
valnew value
Returns
reference to this

◆ real()

const double & sl3::Value::real ( ) const

Access the value.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif the current value has a different type.
Returns
reference to the value

◆ setNull()

void sl3::Value::setNull ( )
noexcept

Set to NULL.

◆ swap()

void sl3::Value::swap ( Value other)
noexcept

swap function

Independent of the type, a Value is always swapable.

Parameters
othervalue to swap with

◆ text()

const std::string & sl3::Value::text ( ) const

Access the value.

Exceptions
sl3::ErrNullValueAccessif value is null.
sl3::ErrTypeMisMatchif the current value has a different type.
Returns
reference to the value

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