Lightweight 0.20260617.0
Loading...
Searching...
No Matches
Lightweight::SqlDynamicBinary< N > Class Template Referencefinal

#include <SqlDynamicBinary.hpp>

Public Types

using value_type = uint8_t
 The element type of the binary data.
 
using ByteView = std::span< value_type const >
 

Public Member Functions

LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinary () noexcept=default
 Default constructor, creates an empty object.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinary (SqlDynamicBinary const &) noexcept=default
 Defaulted copy constructor.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinaryoperator= (SqlDynamicBinary const &) noexcept=default
 Defaulted copy assignment operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinary (SqlDynamicBinary &&) noexcept=default
 Defaulted move constructor.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinaryoperator= (SqlDynamicBinary &&) noexcept=default
 Defaulted move assignment operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ~SqlDynamicBinary () noexcept=default
 Defaulted destructor.
 
template<std::size_t SourceSize>
constexpr LIGHTWEIGHT_FORCE_INLINE SqlDynamicBinary (value_type const (&text)[SourceSize])
 Constructs a fixed-size string from a string literal.
 
template<std::size_t SourceSize>
constexpr LIGHTWEIGHT_FORCE_INLINE SqlDynamicBinary (std::initializer_list< value_type > data)
 Constructs the object from an initializer list of bytes.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinary (value_type const *s, value_type const *e) noexcept
 Constructs a fixed-size string from a string pointer and end pointer.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicBinary (ByteView s) noexcept
 Constructs the binary payload from a contiguous view of bytes.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ByteView Bytes () const noexcept
 Retrieves a read-only view over the stored bytes.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ByteView ToStringView () const noexcept
 
constexpr auto operator<=> (SqlDynamicBinary< N > const &other) const noexcept
 
constexpr bool operator== (SqlDynamicBinary< N > const &other) const noexcept
 Equality operator derived from the spaceship comparison above.
 
LIGHTWEIGHT_FORCE_INLINE constexpr std::size_t size () const noexcept
 Retrieves the size of the string.
 
void LIGHTWEIGHT_FORCE_INLINE resize (std::size_t newSize)
 Resizes the underlying data storage to the given size.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool empty () const noexcept
 Tests if the stored data is empty.
 
LIGHTWEIGHT_FORCE_INLINE constexpr decltype(auto) data (this auto &&self) noexcept
 Retrieves the pointer to the string data.
 
LIGHTWEIGHT_FORCE_INLINE void clear () noexcept
 Clears the storad data.
 

Static Public Attributes

static constexpr auto ColumnType = SqlColumnTypeDefinitions::VarBinary { N }
 The SQL column type definition for this binary type.
 
static constexpr std::size_t DynamicCapacity = N
 The maximum size of the underlying data storage.
 

Detailed Description

template<std::size_t N>
class Lightweight::SqlDynamicBinary< N >

SQL dynamic-capacity string that mimicks standard library string.

The underlying memory is allocated dynamically and the string can grow up to the maximum size of a SQL column.

Definition at line 23 of file SqlDynamicBinary.hpp.

Member Typedef Documentation

◆ value_type

template<std::size_t N>
using Lightweight::SqlDynamicBinary< N >::value_type = uint8_t

The element type of the binary data.

Definition at line 29 of file SqlDynamicBinary.hpp.

◆ ByteView

template<std::size_t N>
using Lightweight::SqlDynamicBinary< N >::ByteView = std::span<value_type const>

Read-only view over the stored bytes.

MSVC's STL is pinned to std::basic_string_view here: its std::span reverse iterator drags the legacy std::iter_move into overload resolution, which is then ambiguous with std::ranges::enumerate_view's own iter_move in any translation unit that uses both. Other standard libraries keep std::span because std::basic_string_view<uint8_t> is ill-formed there (no std::char_traits<unsigned char>).

Definition at line 41 of file SqlDynamicBinary.hpp.

Constructor & Destructor Documentation

◆ SqlDynamicBinary() [1/4]

template<std::size_t N>
template<std::size_t SourceSize>
constexpr LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlDynamicBinary< N >::SqlDynamicBinary ( value_type const (&)  text[SourceSize])
inlineconstexpr

Constructs a fixed-size string from a string literal.

Definition at line 70 of file SqlDynamicBinary.hpp.

◆ SqlDynamicBinary() [2/4]

template<std::size_t N>
template<std::size_t SourceSize>
constexpr LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlDynamicBinary< N >::SqlDynamicBinary ( std::initializer_list< value_type data)
inlineconstexpr

Constructs the object from an initializer list of bytes.

Definition at line 78 of file SqlDynamicBinary.hpp.

◆ SqlDynamicBinary() [3/4]

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlDynamicBinary< N >::SqlDynamicBinary ( value_type const *  s,
value_type const *  e 
)
inlineconstexprnoexcept

Constructs a fixed-size string from a string pointer and end pointer.

Definition at line 85 of file SqlDynamicBinary.hpp.

◆ SqlDynamicBinary() [4/4]

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlDynamicBinary< N >::SqlDynamicBinary ( ByteView  s)
inlineconstexprnoexcept

Constructs the binary payload from a contiguous view of bytes.

Definition at line 91 of file SqlDynamicBinary.hpp.

Member Function Documentation

◆ Bytes()

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr ByteView Lightweight::SqlDynamicBinary< N >::Bytes ( ) const
inlineconstexprnoexcept

Retrieves a read-only view over the stored bytes.

Definition at line 97 of file SqlDynamicBinary.hpp.

Referenced by Lightweight::SqlDynamicBinary< N >::ToStringView().

◆ ToStringView()

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr ByteView Lightweight::SqlDynamicBinary< N >::ToStringView ( ) const
inlineconstexprnoexcept
Deprecated:
Use Bytes(). Alias kept for source compatibility; the name is a misnomer since this type holds raw bytes, not text.

Definition at line 105 of file SqlDynamicBinary.hpp.

References Lightweight::SqlDynamicBinary< N >::Bytes().

◆ operator<=>()

template<std::size_t N>
constexpr auto Lightweight::SqlDynamicBinary< N >::operator<=> ( SqlDynamicBinary< N > const &  other) const
inlineconstexprnoexcept

Three-way comparison operator. Compares the byte payload only — the private _indicator member is ODBC bookkeeping and must not influence equality.

Definition at line 113 of file SqlDynamicBinary.hpp.

◆ operator==()

template<std::size_t N>
constexpr bool Lightweight::SqlDynamicBinary< N >::operator== ( SqlDynamicBinary< N > const &  other) const
inlineconstexprnoexcept

Equality operator derived from the spaceship comparison above.

Definition at line 119 of file SqlDynamicBinary.hpp.

◆ size()

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr std::size_t Lightweight::SqlDynamicBinary< N >::size ( ) const
inlineconstexprnoexcept

Retrieves the size of the string.

Definition at line 125 of file SqlDynamicBinary.hpp.

◆ resize()

template<std::size_t N>
void LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlDynamicBinary< N >::resize ( std::size_t  newSize)
inline

Resizes the underlying data storage to the given size.

Definition at line 131 of file SqlDynamicBinary.hpp.

◆ empty()

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDynamicBinary< N >::empty ( ) const
inlineconstexprnoexcept

Tests if the stored data is empty.

Definition at line 137 of file SqlDynamicBinary.hpp.

◆ data()

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE constexpr decltype(auto) Lightweight::SqlDynamicBinary< N >::data ( this auto &&  self)
inlineconstexprnoexcept

Retrieves the pointer to the string data.

Definition at line 143 of file SqlDynamicBinary.hpp.

◆ clear()

template<std::size_t N>
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlDynamicBinary< N >::clear ( )
inlinenoexcept

Clears the storad data.

Definition at line 150 of file SqlDynamicBinary.hpp.

Member Data Documentation

◆ ColumnType

template<std::size_t N>
constexpr auto Lightweight::SqlDynamicBinary< N >::ColumnType = SqlColumnTypeDefinitions::VarBinary { N }
staticconstexpr

The SQL column type definition for this binary type.

Definition at line 45 of file SqlDynamicBinary.hpp.

◆ DynamicCapacity

template<std::size_t N>
constexpr std::size_t Lightweight::SqlDynamicBinary< N >::DynamicCapacity = N
staticconstexpr

The maximum size of the underlying data storage.

Definition at line 48 of file SqlDynamicBinary.hpp.


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