StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
StormByte::Database::Row< Value > Class Template Reference

Row class for databases. More...

#include <row.hxx>

Public Types

using NamedValue = std::pair< std::string, std::shared_ptr< Value > >
 Shortcut alias for pair.
 
using Storage = std::vector< NamedValue >
 Shortcut alias for internal storage.
 
using iterator = typename Storage::iterator
 Shortcut alias for iterator.
 
using const_iterator = typename Storage::const_iterator
 Shortcut alias for const iterator.
 

Public Member Functions

 Row () noexcept=default
 
 Row (const Row &)=default
 
 Row (Row &&) noexcept=default
 
Rowoperator= (const Row &)=default
 
Rowoperator= (Row &&) noexcept=default
 
virtual ~Row () noexcept=default
 
Value & operator[] (const std::string &columnName)
 
const Value & operator[] (const std::string &columnName) const
 
Value & operator[] (const size_t &columnIndex)
 
const Value & operator[] (const size_t &columnIndex) const
 
constexpr operator bool () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
std::span< NamedValueValues () noexcept
 
std::span< const NamedValueValues () const noexcept
 
void Add (const std::string &columnName, std::unique_ptr< Value > &&value)
 
constexpr size_t Count () const noexcept
 

Protected Attributes

Storage m_values
 

Detailed Description

template<class Value>
class StormByte::Database::Row< Value >

Row class for databases.

Constructor & Destructor Documentation

◆ Row() [1/3]

template<class Value >
StormByte::Database::Row< Value >::Row ( )
defaultnoexcept

Constructor

◆ Row() [2/3]

template<class Value >
StormByte::Database::Row< Value >::Row ( const Row< Value > &  )
default

Copy Constructor

◆ Row() [3/3]

template<class Value >
StormByte::Database::Row< Value >::Row ( Row< Value > &&  )
defaultnoexcept

Move Constructor

◆ ~Row()

template<class Value >
virtual StormByte::Database::Row< Value >::~Row ( )
virtualdefaultnoexcept

Destructor

Member Function Documentation

◆ Add()

template<class Value >
void StormByte::Database::Row< Value >::Add ( const std::string &  columnName,
std::unique_ptr< Value > &&  value 
)
inline

Adds a value to the row

Parameters
columnNamecolumn name
valuevalue

◆ begin() [1/2]

template<class Value >
const_iterator StormByte::Database::Row< Value >::begin ( ) const
inlinenoexcept

Gets a ConstIterator pointing to the first element

Returns
ConstIterator

◆ begin() [2/2]

template<class Value >
iterator StormByte::Database::Row< Value >::begin ( )
inlinenoexcept

Gets an iterator pointing to the first element

Returns
Iterator

◆ Count()

template<class Value >
constexpr size_t StormByte::Database::Row< Value >::Count ( ) const
inlineconstexprnoexcept

Gets the number of columns

Returns
number of columns

◆ end() [1/2]

template<class Value >
const_iterator StormByte::Database::Row< Value >::end ( ) const
inlinenoexcept

Gets a ConstIterator pointing to past last element

Returns
ConstIterator

◆ end() [2/2]

template<class Value >
iterator StormByte::Database::Row< Value >::end ( )
inlinenoexcept

Gets an iterator pointing to past last element

Returns
Iterator

◆ operator bool()

template<class Value >
constexpr StormByte::Database::Row< Value >::operator bool ( ) const
inlineconstexprnoexcept

Checks if result is empty

◆ operator=() [1/2]

template<class Value >
Row & StormByte::Database::Row< Value >::operator= ( const Row< Value > &  )
default

Assignment operator

◆ operator=() [2/2]

template<class Value >
Row & StormByte::Database::Row< Value >::operator= ( Row< Value > &&  )
defaultnoexcept

Move operator

◆ operator[]() [1/4]

template<class Value >
Value & StormByte::Database::Row< Value >::operator[] ( const size_t &  columnIndex)
inline

Gets value for column by index

Parameters
columnIndexcolumn index
Exceptions
OutOfBoundsif index is out of bounds
Returns
Value

◆ operator[]() [2/4]

template<class Value >
const Value & StormByte::Database::Row< Value >::operator[] ( const size_t &  columnIndex) const
inline

Gets value for column by index

Parameters
columnIndexcolumn index
Exceptions
OutOfBoundsif index is out of bounds
Returns
Value

◆ operator[]() [3/4]

template<class Value >
Value & StormByte::Database::Row< Value >::operator[] ( const std::string &  columnName)
inline

Gets value for column by name

Parameters
columnNamecolumn name
Exceptions
ColumnNotFoundif column is not found
Returns
Value

◆ operator[]() [4/4]

template<class Value >
const Value & StormByte::Database::Row< Value >::operator[] ( const std::string &  columnName) const
inline

Gets value for column by name

Parameters
columnNamecolumn name
Exceptions
ColumnNotFoundif column is not found
Returns
Value

◆ Values() [1/2]

template<class Value >
std::span< const NamedValue > StormByte::Database::Row< Value >::Values ( ) const
inlinenoexcept

Gets a span iterator pointing to the first element

Returns
Span

◆ Values() [2/2]

template<class Value >
std::span< NamedValue > StormByte::Database::Row< Value >::Values ( )
inlinenoexcept

Gets a span iterator pointing to the first element

Returns
Span

Member Data Documentation

◆ m_values

template<class Value >
Storage StormByte::Database::Row< Value >::m_values
protected

Internal storage


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