crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Data::Value Struct Reference

A generic value. More...

#include <Data.hpp>

Public Types

enum  _if_too_large { _error, _trim, _empty, _null }
 Enumeration for the action that will be performed if a string is too large for the database. More...
 

Public Member Functions

 Value ()=default
 Default constructor initializing a null value. More...
 
 Value (bool value)
 Constructor initializing a boolean value. More...
 
 Value (std::int32_t value)
 Constructor initializing a 32-bit integer. More...
 
 Value (std::uint32_t value)
 Constructor initializing an unsigned 32-bit integer. More...
 
 Value (std::int64_t value)
 Constructor initializing a 64-bit integer. More...
 
 Value (std::uint64_t value)
 Constructor initializing an unsigned 64-bit integer. More...
 
 Value (double value)
 Constructor initializing a floating point value (with double precision). More...
 
 Value (const std::string &value)
 Constructor initializing a string value. More...
 
void clear ()
 Clears the current value and re-initializes it as null value. More...
 

Public Attributes

union {
   bool   _b
 Boolean value. More...
 
   std::int32_t   _i32
 32-bit integer value. More...
 
   std::uint32_t   _ui32
 Unsigned 32-bit integer value. More...
 
   std::int64_t   _i64
 64-bit integer value. More...
 
   std::uint64_t   _ui64 {}
 Unsigned 64-bit integer value. More...
 
   double   _d
 Floating point value (with double precision). More...
 
}; 
 Union for numeric (including boolean) values. More...
 
std::string _s
 String value. More...
 
bool _isnull {true}
 Null value. More...
 
enum crawlservpp::Data::Value::_if_too_large _error
 Action that will be performed if a string is too large for the database. More...
 

Detailed Description

A generic value.

The value can be boolean, numeric, null or a string.

Member Enumeration Documentation

◆ _if_too_large

Enumeration for the action that will be performed if a string is too large for the database.

Enumerator
_error 

Throw a Database::Exception.

_trim 

Trim the string to an acceptable size.

_empty 

Use an empty string instead.

_null 

Use a null value instead.

Constructor & Destructor Documentation

◆ Value() [1/8]

crawlservpp::Data::Value::Value ( )
default

Default constructor initializing a null value.

Referenced by clear().

◆ Value() [2/8]

crawlservpp::Data::Value::Value ( bool  value)
inlineexplicit

Constructor initializing a boolean value.

Parameters
valueThe boolean value to be set.

◆ Value() [3/8]

crawlservpp::Data::Value::Value ( std::int32_t  value)
inlineexplicit

Constructor initializing a 32-bit integer.

Parameters
valueThe 32-bit integer value to be set.

◆ Value() [4/8]

crawlservpp::Data::Value::Value ( std::uint32_t  value)
inlineexplicit

Constructor initializing an unsigned 32-bit integer.

Parameters
valueThe unsigned 32-bit integer value to be set.

◆ Value() [5/8]

crawlservpp::Data::Value::Value ( std::int64_t  value)
inlineexplicit

Constructor initializing a 64-bit integer.

Parameters
valueThe 64-bit integer value to be set.

◆ Value() [6/8]

crawlservpp::Data::Value::Value ( std::uint64_t  value)
inlineexplicit

Constructor initializing an unsigned 64-bit integer.

Parameters
valueThe unsigned 64-bit integer value to be set.

◆ Value() [7/8]

crawlservpp::Data::Value::Value ( double  value)
inlineexplicit

Constructor initializing a floating point value (with double precision).

Parameters
valueThe floating point value to be set.

◆ Value() [8/8]

crawlservpp::Data::Value::Value ( const std::string &  value)
inlineexplicit

Constructor initializing a string value.

Parameters
valueConstant reference to a string containing the string value to be set.

Member Function Documentation

◆ clear()

void crawlservpp::Data::Value::clear ( )
inline

Clears the current value and re-initializes it as null value.

References Value().

Member Data Documentation

◆ @1

union { ... }

Union for numeric (including boolean) values.

◆ _b

bool crawlservpp::Data::Value::_b

◆ _d

double crawlservpp::Data::Value::_d

Floating point value (with double precision).

Referenced by crawlservpp::Main::Database::insertCustomData(), and crawlservpp::Main::Database::updateCustomData().

◆ _error

enum crawlservpp::Data::Value::_if_too_large crawlservpp::Data::Value::_error

Action that will be performed if a string is too large for the database.

On default, a Database::Exception will be thrown.

◆ _i32

std::int32_t crawlservpp::Data::Value::_i32

◆ _i64

std::int64_t crawlservpp::Data::Value::_i64

◆ _isnull

bool crawlservpp::Data::Value::_isnull {true}

◆ _s

std::string crawlservpp::Data::Value::_s

◆ _ui32

std::uint32_t crawlservpp::Data::Value::_ui32

◆ _ui64

std::uint64_t crawlservpp::Data::Value::_ui64 {}

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