Lightweight 0.20260303.0
Loading...
Searching...
No Matches
Lightweight::SqlDynamicString< N, T > Class Template Reference

#include <SqlDynamicString.hpp>

Public Types

using value_type = T
 The element type of the string.
 
using string_type = std::basic_string< T >
 String type used for the internal storage of the string.
 
using iterator = string_type::iterator
 Iterator type for the string.
 
using const_iterator = string_type::const_iterator
 Const iterator type for the string.
 
using pointer_type = T *
 Pointer type for the string.
 
using const_pointer_type = T const *
 Const pointer type for the string.
 

Public Member Functions

template<std::size_t SourceSize>
constexpr LIGHTWEIGHT_FORCE_INLINE SqlDynamicString (T const (&text)[SourceSize])
 Constructs a fixed-size string from a string literal.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicString (T const *s, T const *e) noexcept
 Constructs a fixed-size string from a string pointer and end pointer.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicString () noexcept=default
 Defaulted default constructor.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicString (SqlDynamicString const &) noexcept=default
 Defaulted copy constructor.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicStringoperator= (SqlDynamicString const &) noexcept=default
 Defaulted copy assignment operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicString (SqlDynamicString &&) noexcept=default
 Defaulted move constructor.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicStringoperator= (SqlDynamicString &&) noexcept=default
 Defaulted move assignment operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ~SqlDynamicString () noexcept=default
 Defaulted destructor.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicString (std::basic_string_view< T > s) noexcept
 Constructs a fixed-size string from a string view.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlDynamicString (std::basic_string< T > const &s) noexcept
 Constructs a fixed-size string from a string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr std::basic_string_view< T > str () const noexcept
 Returns a string view of the string.
 
LIGHTWEIGHT_FORCE_INLINE string_type const & value () const noexcept
 Retrieves the string's inner value (std::basic_string<T>).
 
LIGHTWEIGHT_FORCE_INLINE string_typevalue () noexcept
 Retrieves the string's inner value (std::basic_string<T>).
 
LIGHTWEIGHT_FORCE_INLINE T const * data () const noexcept
 Retrieves the string's inner value (as T const*).
 
LIGHTWEIGHT_FORCE_INLINE T * data () noexcept
 Retrieves the string's inner value (as T*).
 
LIGHTWEIGHT_FORCE_INLINE T const * c_str () const noexcept
 Retrieves the string's inner value (as T const*).
 
LIGHTWEIGHT_FORCE_INLINE std::size_t capacity () const noexcept
 Retrieves the string's capacity.
 
LIGHTWEIGHT_FORCE_INLINE std::size_t size () const noexcept
 Retrieves the string's size.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool empty () const noexcept
 Tests if the string is empty.
 
LIGHTWEIGHT_FORCE_INLINE constexpr void clear () noexcept
 Clears the string.
 
LIGHTWEIGHT_FORCE_INLINE void reserve (std::size_t capacity)
 Reserves capacity for at least the given number of characters.
 
LIGHTWEIGHT_FORCE_INLINE constexpr void push_back (T c) noexcept
 Appends a character to the end of the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr void pop_back () noexcept
 Removes the last character from the string.
 
LIGHTWEIGHT_FORCE_INLINE void setsize (std::size_t n) noexcept
 
LIGHTWEIGHT_FORCE_INLINE constexpr void resize (std::size_t n) noexcept
 Resizes the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr std::basic_string_view< T > substr (std::size_t offset=0, std::size_t count=(std::numeric_limits< std::size_t >::max)()) const noexcept
 Retrieves a string view of the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr string_type ToString () const noexcept
 Retrieves the string as a string_type.
 
LIGHTWEIGHT_FORCE_INLINE constexpr std::basic_string_view< T > ToStringView () const noexcept
 Retrieves a string view of the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr T & operator[] (std::size_t index) noexcept
 Element access operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr T const & operator[] (std::size_t index) const noexcept
 Const qulified element access operator.
 
template<std::size_t OtherSize>
LIGHTWEIGHT_FORCE_INLINE std::weak_ordering operator<=> (SqlDynamicString< OtherSize, T > const &other) const noexcept
 Three-way comparison operator for comparing with another SqlDynamicString of possibly different capacity.
 
template<std::size_t OtherSize>
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator== (SqlDynamicString< OtherSize, T > const &other) const noexcept
 Equality comparison operator for comparing with another SqlDynamicString of possibly different capacity.
 
template<std::size_t OtherSize>
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator!= (SqlDynamicString< OtherSize, T > const &other) const noexcept
 Inequality comparison operator for comparing with another SqlDynamicString of possibly different capacity.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator== (std::basic_string_view< T > other) const noexcept
 Equality comparison operator for comparing with a string view.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator!= (std::basic_string_view< T > other) const noexcept
 Inequality comparison operator for comparing with a string view.
 
LIGHTWEIGHT_FORCE_INLINE constexpr iterator begin () noexcept
 Retrieves an iterator to the beginning of the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr iterator end () noexcept
 Retrieves an iterator to the end of the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr const_iterator begin () const noexcept
 Retrieves a const iterator to the beginning of the string.
 
LIGHTWEIGHT_FORCE_INLINE constexpr const_iterator end () const noexcept
 Retrieves a const iterator to the end of the string.
 

Static Public Attributes

static constexpr std::size_t DynamicCapacity = N
 constexpr variable with the capacity of the string.
 

Detailed Description

template<std::size_t N, typename T = char>
class Lightweight::SqlDynamicString< N, T >

SQL dynamic-capacity string that mimmicks standard library string.

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

Definition at line 26 of file SqlDynamicString.hpp.

Member Typedef Documentation

◆ value_type

template<std::size_t N, typename T = char>
using Lightweight::SqlDynamicString< N, T >::value_type = T

The element type of the string.

Definition at line 33 of file SqlDynamicString.hpp.

◆ string_type

template<std::size_t N, typename T = char>
using Lightweight::SqlDynamicString< N, T >::string_type = std::basic_string<T>

String type used for the internal storage of the string.

Definition at line 36 of file SqlDynamicString.hpp.

◆ iterator

template<std::size_t N, typename T = char>
using Lightweight::SqlDynamicString< N, T >::iterator = string_type::iterator

Iterator type for the string.

Definition at line 39 of file SqlDynamicString.hpp.

◆ const_iterator

template<std::size_t N, typename T = char>
using Lightweight::SqlDynamicString< N, T >::const_iterator = string_type::const_iterator

Const iterator type for the string.

Definition at line 41 of file SqlDynamicString.hpp.

◆ pointer_type

template<std::size_t N, typename T = char>
using Lightweight::SqlDynamicString< N, T >::pointer_type = T*

Pointer type for the string.

Definition at line 43 of file SqlDynamicString.hpp.

◆ const_pointer_type

template<std::size_t N, typename T = char>
using Lightweight::SqlDynamicString< N, T >::const_pointer_type = T const*

Const pointer type for the string.

Definition at line 45 of file SqlDynamicString.hpp.

Constructor & Destructor Documentation

◆ SqlDynamicString() [1/4]

template<std::size_t N, typename T = char>
template<std::size_t SourceSize>
constexpr LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlDynamicString< N, T >::SqlDynamicString ( T const (&)  text[SourceSize])
inlineconstexpr

Constructs a fixed-size string from a string literal.

Definition at line 49 of file SqlDynamicString.hpp.

◆ SqlDynamicString() [2/4]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlDynamicString< N, T >::SqlDynamicString ( T const *  s,
T const *  e 
)
inlineconstexprnoexcept

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

Definition at line 56 of file SqlDynamicString.hpp.

◆ SqlDynamicString() [3/4]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlDynamicString< N, T >::SqlDynamicString ( std::basic_string_view< T >  s)
inlineconstexprnoexcept

Constructs a fixed-size string from a string view.

Definition at line 80 of file SqlDynamicString.hpp.

◆ SqlDynamicString() [4/4]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlDynamicString< N, T >::SqlDynamicString ( std::basic_string< T > const &  s)
inlineconstexprnoexcept

Constructs a fixed-size string from a string.

Definition at line 86 of file SqlDynamicString.hpp.

Member Function Documentation

◆ str()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr std::basic_string_view< T > Lightweight::SqlDynamicString< N, T >::str ( ) const
inlineconstexprnoexcept

Returns a string view of the string.

Definition at line 92 of file SqlDynamicString.hpp.

References Lightweight::SqlDynamicString< N, T >::data(), and Lightweight::SqlDynamicString< N, T >::size().

◆ value() [1/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE string_type const & Lightweight::SqlDynamicString< N, T >::value ( ) const
inlinenoexcept

Retrieves the string's inner value (std::basic_string<T>).

Definition at line 98 of file SqlDynamicString.hpp.

◆ value() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE string_type & Lightweight::SqlDynamicString< N, T >::value ( )
inlinenoexcept

Retrieves the string's inner value (std::basic_string<T>).

Definition at line 104 of file SqlDynamicString.hpp.

◆ data() [1/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE T const * Lightweight::SqlDynamicString< N, T >::data ( ) const
inlinenoexcept

Retrieves the string's inner value (as T const*).

Definition at line 110 of file SqlDynamicString.hpp.

Referenced by Lightweight::SqlDynamicString< N, T >::str().

◆ data() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE T * Lightweight::SqlDynamicString< N, T >::data ( )
inlinenoexcept

Retrieves the string's inner value (as T*).

Definition at line 116 of file SqlDynamicString.hpp.

◆ c_str()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE T const * Lightweight::SqlDynamicString< N, T >::c_str ( ) const
inlinenoexcept

Retrieves the string's inner value (as T const*).

Definition at line 122 of file SqlDynamicString.hpp.

◆ capacity()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE std::size_t Lightweight::SqlDynamicString< N, T >::capacity ( ) const
inlinenoexcept

Retrieves the string's capacity.

Definition at line 128 of file SqlDynamicString.hpp.

Referenced by Lightweight::SqlDynamicString< N, T >::reserve().

◆ size()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE std::size_t Lightweight::SqlDynamicString< N, T >::size ( ) const
inlinenoexcept

Retrieves the string's size.

Definition at line 134 of file SqlDynamicString.hpp.

Referenced by Lightweight::SqlDynamicString< N, T >::str().

◆ empty()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDynamicString< N, T >::empty ( ) const
inlineconstexprnoexcept

Tests if the string is empty.

Definition at line 140 of file SqlDynamicString.hpp.

◆ clear()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr void Lightweight::SqlDynamicString< N, T >::clear ( )
inlineconstexprnoexcept

Clears the string.

Definition at line 146 of file SqlDynamicString.hpp.

◆ reserve()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlDynamicString< N, T >::reserve ( std::size_t  capacity)
inline

Reserves capacity for at least the given number of characters.

Definition at line 152 of file SqlDynamicString.hpp.

References Lightweight::SqlDynamicString< N, T >::capacity().

◆ push_back()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr void Lightweight::SqlDynamicString< N, T >::push_back ( c)
inlineconstexprnoexcept

Appends a character to the end of the string.

Definition at line 158 of file SqlDynamicString.hpp.

◆ pop_back()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr void Lightweight::SqlDynamicString< N, T >::pop_back ( )
inlineconstexprnoexcept

Removes the last character from the string.

Definition at line 164 of file SqlDynamicString.hpp.

◆ setsize()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlDynamicString< N, T >::setsize ( std::size_t  n)
inlinenoexcept

Resizes the string to contain at most n characters. If n is less than the current size of the string, the string is reduced to its first n characters. If n is greater than the current size of the string, the string is resized to contain N characters, with the new characters being default-inserted (value-initialized).

Definition at line 173 of file SqlDynamicString.hpp.

◆ resize()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr void Lightweight::SqlDynamicString< N, T >::resize ( std::size_t  n)
inlineconstexprnoexcept

Resizes the string.

Definition at line 180 of file SqlDynamicString.hpp.

◆ substr()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr std::basic_string_view< T > Lightweight::SqlDynamicString< N, T >::substr ( std::size_t  offset = 0,
std::size_t  count = (std::numeric_limits<std::size_t>::max)() 
) const
inlineconstexprnoexcept

Retrieves a string view of the string.

Definition at line 186 of file SqlDynamicString.hpp.

◆ ToString()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr string_type Lightweight::SqlDynamicString< N, T >::ToString ( ) const
inlineconstexprnoexcept

Retrieves the string as a string_type.

Definition at line 197 of file SqlDynamicString.hpp.

◆ ToStringView()

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr std::basic_string_view< T > Lightweight::SqlDynamicString< N, T >::ToStringView ( ) const
inlineconstexprnoexcept

Retrieves a string view of the string.

Definition at line 209 of file SqlDynamicString.hpp.

Referenced by Lightweight::SqlDynamicString< N, T >::operator==().

◆ operator[]() [1/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr T & Lightweight::SqlDynamicString< N, T >::operator[] ( std::size_t  index)
inlineconstexprnoexcept

Element access operator.

Definition at line 215 of file SqlDynamicString.hpp.

◆ operator[]() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr T const & Lightweight::SqlDynamicString< N, T >::operator[] ( std::size_t  index) const
inlineconstexprnoexcept

Const qulified element access operator.

Definition at line 221 of file SqlDynamicString.hpp.

◆ operator<=>()

template<std::size_t N, typename T = char>
template<std::size_t OtherSize>
LIGHTWEIGHT_FORCE_INLINE std::weak_ordering Lightweight::SqlDynamicString< N, T >::operator<=> ( SqlDynamicString< OtherSize, T > const &  other) const
inlinenoexcept

Three-way comparison operator for comparing with another SqlDynamicString of possibly different capacity.

Definition at line 234 of file SqlDynamicString.hpp.

◆ operator==() [1/2]

template<std::size_t N, typename T = char>
template<std::size_t OtherSize>
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDynamicString< N, T >::operator== ( SqlDynamicString< OtherSize, T > const &  other) const
inlineconstexprnoexcept

Equality comparison operator for comparing with another SqlDynamicString of possibly different capacity.

Definition at line 241 of file SqlDynamicString.hpp.

◆ operator!=() [1/2]

template<std::size_t N, typename T = char>
template<std::size_t OtherSize>
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDynamicString< N, T >::operator!= ( SqlDynamicString< OtherSize, T > const &  other) const
inlineconstexprnoexcept

Inequality comparison operator for comparing with another SqlDynamicString of possibly different capacity.

Definition at line 248 of file SqlDynamicString.hpp.

◆ operator==() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDynamicString< N, T >::operator== ( std::basic_string_view< T >  other) const
inlineconstexprnoexcept

Equality comparison operator for comparing with a string view.

Definition at line 254 of file SqlDynamicString.hpp.

References Lightweight::SqlDynamicString< N, T >::ToStringView().

◆ operator!=() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDynamicString< N, T >::operator!= ( std::basic_string_view< T >  other) const
inlineconstexprnoexcept

Inequality comparison operator for comparing with a string view.

Definition at line 260 of file SqlDynamicString.hpp.

◆ begin() [1/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr iterator Lightweight::SqlDynamicString< N, T >::begin ( )
inlineconstexprnoexcept

Retrieves an iterator to the beginning of the string.

Definition at line 266 of file SqlDynamicString.hpp.

◆ end() [1/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr iterator Lightweight::SqlDynamicString< N, T >::end ( )
inlineconstexprnoexcept

Retrieves an iterator to the end of the string.

Definition at line 272 of file SqlDynamicString.hpp.

◆ begin() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr const_iterator Lightweight::SqlDynamicString< N, T >::begin ( ) const
inlineconstexprnoexcept

Retrieves a const iterator to the beginning of the string.

Definition at line 278 of file SqlDynamicString.hpp.

◆ end() [2/2]

template<std::size_t N, typename T = char>
LIGHTWEIGHT_FORCE_INLINE constexpr const_iterator Lightweight::SqlDynamicString< N, T >::end ( ) const
inlineconstexprnoexcept

Retrieves a const iterator to the end of the string.

Definition at line 284 of file SqlDynamicString.hpp.

Member Data Documentation

◆ DynamicCapacity

template<std::size_t N, typename T = char>
constexpr std::size_t Lightweight::SqlDynamicString< N, T >::DynamicCapacity = N
staticconstexpr

constexpr variable with the capacity of the string.

Definition at line 30 of file SqlDynamicString.hpp.


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