StormByte-Database 2.0.0
C++26 database module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Database::Row Class Reference

One result row: ordered NamedValues with lookup by column name. More...

#include <StormByte/database/row.hxx>

Public Types

using value_type = NamedValue
 Column value type.
 
using size_type = StormByte::Size
 Column count and index type.
 
using reference = NamedValue &
 Mutable column reference.
 
using const_reference = const NamedValue &
 Read-only column reference.
 
using pointer = NamedValue *
 Mutable column pointer.
 
using const_pointer = const NamedValue *
 Read-only column pointer.
 
using iterator = pointer
 Mutable pointer iterator.
 
using const_iterator = const_pointer
 Read-only pointer iterator.
 
using reverse_iterator = std::reverse_iterator< iterator >
 Mutable reverse iterator.
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 Read-only reverse iterator.
 

Public Member Functions

 Row () noexcept
 Default constructor.
 
 Row (const Row &other)
 Copy constructor.
 
 Row (Row &&other) noexcept
 Move constructor.
 
 ~Row () noexcept
 Destructor.
 
Row & operator= (const Row &other)
 Copy assignment.
 
Row & operator= (Row &&other) noexcept
 Move assignment.
 
bool operator== (const Row &other) const
 Equality of the ordered columns.
 
bool operator!= (const Row &other) const
 Inequality of the ordered columns.
 
iterator begin () noexcept
 Mutable begin pointer.
 
const_iterator begin () const noexcept
 Read-only begin pointer.
 
iterator end () noexcept
 Mutable end pointer.
 
const_iterator end () const noexcept
 Read-only end pointer.
 
const_iterator cbegin () const noexcept
 Read-only begin pointer.
 
const_iterator cend () const noexcept
 Read-only end pointer.
 
reverse_iterator rbegin () noexcept
 Mutable reverse begin.
 
reverse_iterator rend () noexcept
 Mutable reverse end.
 
const_reverse_iterator rbegin () const noexcept
 Read-only reverse begin.
 
const_reverse_iterator rend () const noexcept
 Read-only reverse end.
 
const_reverse_iterator crbegin () const noexcept
 Read-only reverse begin.
 
const_reverse_iterator crend () const noexcept
 Read-only reverse end.
 
StormByte::Size size () const noexcept
 Number of columns.
 
bool empty () const noexcept
 Whether the row has no columns.
 
const Value & operator[] (std::string_view columnName) const &
 Access by column name (const lvalue).
 
Value & operator[] (std::string_view columnName) &
 Access by column name (lvalue).
 
Value operator[] (std::string_view columnName) &&
 Access by column name (rvalue).
 
const NamedValue & operator[] (StormByte::Size index) const &
 Access a column by zero-based index (const lvalue).
 
template<StormByte::Type::Integral T>
const NamedValue & operator[] (T index) const &
 Access a column by integral zero-based index (const lvalue).
 
NamedValue & operator[] (StormByte::Size index) &
 Access a column by zero-based index (lvalue).
 
template<StormByte::Type::Integral T>
NamedValue & operator[] (T index) &
 Access a column by integral zero-based index (lvalue).
 
NamedValue operator[] (StormByte::Size index) &&
 Access a column by zero-based index (rvalue).
 
template<StormByte::Type::Integral T>
NamedValue operator[] (T index) &&
 Access a column by integral zero-based index (rvalue).
 
void add (std::string_view columnName, Value &&value)
 Append a named column.
 
void add (NamedValue value)
 Append a named value.
 
bool has_item (const NamedValue &value) const
 Search for an equal named value.
 
StormByte::Size Count () const noexcept
 Number of columns.
 

Detailed Description

One result row: ordered NamedValues with lookup by column name.

Member Typedef Documentation

◆ const_iterator

Read-only pointer iterator.

◆ const_pointer

Read-only column pointer.

◆ const_reference

Read-only column reference.

◆ const_reverse_iterator

Read-only reverse iterator.

◆ iterator

Mutable pointer iterator.

◆ pointer

Mutable column pointer.

◆ reference

Mutable column reference.

◆ reverse_iterator

using StormByte::Database::Row::reverse_iterator = std::reverse_iterator<iterator>

Mutable reverse iterator.

◆ size_type

Column count and index type.

◆ value_type

Constructor & Destructor Documentation

◆ Row() [1/3]

StormByte::Database::Row::Row ( )
noexcept

Default constructor.

◆ Row() [2/3]

StormByte::Database::Row::Row ( const Row &  other)

Copy constructor.

Parameters
otherSource row.

◆ Row() [3/3]

StormByte::Database::Row::Row ( Row &&  other)
noexcept

Move constructor.

◆ ~Row()

StormByte::Database::Row::~Row ( )
noexcept

Destructor.

Member Function Documentation

◆ add() [1/2]

void StormByte::Database::Row::add ( NamedValue  value)

Append a named value.

Parameters
valueNamed value to store.

◆ add() [2/2]

void StormByte::Database::Row::add ( std::string_view  columnName,
Value &&  value 
)

Append a named column.

Parameters
columnNameColumn name.
valueValue to store.

◆ begin() [1/2]

const_iterator StormByte::Database::Row::begin ( ) const
noexcept

Read-only begin pointer.

Returns
Pointer to the first column or null when empty.

◆ begin() [2/2]

iterator StormByte::Database::Row::begin ( )
noexcept

Mutable begin pointer.

Returns
Pointer to the first column or null when empty.

◆ cbegin()

const_iterator StormByte::Database::Row::cbegin ( ) const
noexcept

Read-only begin pointer.

Returns
Pointer to the first column or null when empty.

◆ cend()

const_iterator StormByte::Database::Row::cend ( ) const
noexcept

Read-only end pointer.

Returns
Pointer past the last column or null when empty.

◆ Count()

StormByte::Size StormByte::Database::Row::Count ( ) const
noexcept

Number of columns.

Returns
Count.

◆ crbegin()

const_reverse_iterator StormByte::Database::Row::crbegin ( ) const
noexcept

Read-only reverse begin.

Returns
Reverse iterator.

◆ crend()

const_reverse_iterator StormByte::Database::Row::crend ( ) const
noexcept

Read-only reverse end.

Returns
Reverse iterator.

◆ empty()

bool StormByte::Database::Row::empty ( ) const
noexcept

Whether the row has no columns.

Returns
True when empty.

◆ end() [1/2]

const_iterator StormByte::Database::Row::end ( ) const
noexcept

Read-only end pointer.

Returns
Pointer past the last column or null when empty.

◆ end() [2/2]

iterator StormByte::Database::Row::end ( )
noexcept

Mutable end pointer.

Returns
Pointer past the last column or null when empty.

◆ has_item()

bool StormByte::Database::Row::has_item ( const NamedValue &  value) const

Search for an equal named value.

Parameters
valueValue to find.
Returns
Whether the value exists in this row.

◆ operator!=()

bool StormByte::Database::Row::operator!= ( const Row &  other) const

Inequality of the ordered columns.

Parameters
otherRow to compare.
Returns
Whether the rows differ.

◆ operator=() [1/2]

Row & StormByte::Database::Row::operator= ( const Row &  other)

Copy assignment.

Parameters
otherSource row.
Returns
*this.

◆ operator=() [2/2]

Row & StormByte::Database::Row::operator= ( Row &&  other)
noexcept

Move assignment.

◆ operator==()

bool StormByte::Database::Row::operator== ( const Row &  other) const

Equality of the ordered columns.

Parameters
otherRow to compare.
Returns
Whether both rows have equal named values.

◆ operator[]() [1/9]

Value & StormByte::Database::Row::operator[] ( std::string_view  columnName) &

Access by column name (lvalue).

Parameters
columnNameColumn name.
Returns
Reference to the value.
Exceptions
ColumnNotFoundif the name is absent.

◆ operator[]() [2/9]

Value StormByte::Database::Row::operator[] ( std::string_view  columnName) &&

Access by column name (rvalue).

Parameters
columnNameColumn name.
Returns
Value (moved).
Exceptions
ColumnNotFoundif the name is absent.

◆ operator[]() [3/9]

const Value & StormByte::Database::Row::operator[] ( std::string_view  columnName) const &

Access by column name (const lvalue).

Parameters
columnNameColumn name.
Returns
Reference to the value.
Exceptions
ColumnNotFoundif the name is absent.

◆ operator[]() [4/9]

NamedValue & StormByte::Database::Row::operator[] ( StormByte::Size  index) &

Access a column by zero-based index (lvalue).

Parameters
indexColumn index.
Returns
Reference to the named value.
Exceptions
OutOfBoundsif index is outside this row.

◆ operator[]() [5/9]

NamedValue StormByte::Database::Row::operator[] ( StormByte::Size  index) &&

Access a column by zero-based index (rvalue).

Parameters
indexColumn index.
Returns
Named value moved from this row.
Exceptions
OutOfBoundsif index is outside this row.

◆ operator[]() [6/9]

const NamedValue & StormByte::Database::Row::operator[] ( StormByte::Size  index) const &

Access a column by zero-based index (const lvalue).

Parameters
indexColumn index.
Returns
Const reference to the named value.
Exceptions
OutOfBoundsif index is outside this row.

◆ operator[]() [7/9]

NamedValue & StormByte::Database::Row::operator[] ( T  index) &
inline

Access a column by integral zero-based index (lvalue).

Template Parameters
TIntegral index type.
Parameters
indexColumn index.
Returns
Mutable reference to the named value.

◆ operator[]() [8/9]

NamedValue StormByte::Database::Row::operator[] ( T  index) &&
inline

Access a column by integral zero-based index (rvalue).

Template Parameters
TIntegral index type.
Parameters
indexColumn index.
Returns
Named value moved from this row.

◆ operator[]() [9/9]

const NamedValue & StormByte::Database::Row::operator[] ( T  index) const &
inline

Access a column by integral zero-based index (const lvalue).

Template Parameters
TIntegral index type.
Parameters
indexColumn index.
Returns
Const reference to the named value.

◆ rbegin() [1/2]

const_reverse_iterator StormByte::Database::Row::rbegin ( ) const
noexcept

Read-only reverse begin.

Returns
Reverse iterator.

◆ rbegin() [2/2]

reverse_iterator StormByte::Database::Row::rbegin ( )
noexcept

Mutable reverse begin.

Returns
Reverse iterator.

◆ rend() [1/2]

const_reverse_iterator StormByte::Database::Row::rend ( ) const
noexcept

Read-only reverse end.

Returns
Reverse iterator.

◆ rend() [2/2]

reverse_iterator StormByte::Database::Row::rend ( )
noexcept

Mutable reverse end.

Returns
Reverse iterator.

◆ size()

StormByte::Size StormByte::Database::Row::size ( ) const
noexcept

Number of columns.

Returns
Column count.

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