matador::row Class Reference

Row representation. More...

#include <row.hpp>

Public Types

using column_ptr = std::shared_ptr< column >
 

Public Member Functions

 row (const row &r)=default
 
 row (row &&r) noexcept=default
 
rowoperator= (const row &r)=default
 
rowoperator= (row &&r)=default
 
bool add_column (const std::string &column)
 
bool add_column (const column_ptr &col)
 
bool has_column (const std::string &column) const
 Checks if the row has a column of the given name.
 
template<class Operator >
void process (Operator &op)
 Serializes the row with the given serializer.
 
template<class T >
void set (size_t index, const T &val)
 
template<class T >
void set (const std::string &column, const T &val)
 
void set (const std::string &column, const std::shared_ptr< value > &value)
 Sets the given value to the column with given name.
 
template<class T >
at (size_t pos)
 
template<class T >
at (const std::string &column)
 
void clear ()
 Clear the row.
 

Detailed Description

Row representation.

Constructor & Destructor Documentation

◆ row() [1/2]

matador::row::row ( const row r)
default

Copy constructs a row from a given row

Parameters
rThe roe to copy from

◆ row() [2/2]

matador::row::row ( row &&  r)
defaultnoexcept

Copy moves a row from a given row

Parameters
rThe row to move from

Member Function Documentation

◆ add_column() [1/2]

bool matador::row::add_column ( const column_ptr &  col)

Add a column to the row. If column already exists

Parameters
colColumn to add
Returns
True if column was added, false if column already exists

◆ add_column() [2/2]

bool matador::row::add_column ( const std::string &  column)

Add a column to the row. If column already exists

Parameters
columnName of the column
Returns
True if column was added, false if column already exists

◆ at() [1/2]

template<class T >
T matador::row::at ( const std::string &  column)
inline

Get value of column identified by name

Template Parameters
TType of column
Parameters
columnColumn name
Returns
The value of the requested column.

◆ at() [2/2]

template<class T >
T matador::row::at ( size_t  pos)
inline

Get value of column position

Template Parameters
TType of column
Parameters
posColumn index
Returns
The value of the requested column.

◆ clear()

void matador::row::clear ( )

Clear the row.

Clear the row and all its columns

◆ has_column()

bool matador::row::has_column ( const std::string &  column) const

Checks if the row has a column of the given name.

Parameters
columnThe name of the column to be checked
Returns
True if the column exists

◆ operator=() [1/2]

row & matador::row::operator= ( const row r)
default

Copy assigns a row with a given row

Parameters
rRow to copy assign from
Returns
Reference to assigned row

◆ operator=() [2/2]

row & matador::row::operator= ( row &&  r)
default

Copy moves a row with a given row

Parameters
rRow to copy moves from
Returns
Reference to moved row

◆ process()

template<class Operator >
void matador::row::process ( Operator &  op)
inline

Serializes the row with the given serializer.

Template Parameters
SerializerThe type of the used serializer object
Parameters
serializerThe serializer to be used

◆ set() [1/3]

void matador::row::set ( const std::string &  column,
const std::shared_ptr< value > &  value 
)

Sets the given value to the column with given name.

Parameters
columnThe name of the column to be set
valueThe new value of the column

◆ set() [2/3]

template<class T >
void matador::row::set ( const std::string &  column,
const T &  val 
)
inline

Set a value for a column identified by its name

Exceptions
out_of_boundexception
Template Parameters
Typeof value
Parameters
columnName of column to set value for
valValue to set

◆ set() [3/3]

template<class T >
void matador::row::set ( size_t  index,
const T &  val 
)
inline

Set a value for a column at given index

Exceptions
out_of_boundexception
Template Parameters
Typeof value
Parameters
indexIndex of column to set value for
valValue to set

The documentation for this class was generated from the following file:
  • matador/sql/row.hpp