tdslite latest
C++ API reference
Loading...
Searching...
No Matches
tdsl::tdsl_field Struct Reference

Non-owning view of a row field. More...

#include <tdslite/detail/tdsl_field.hpp>

Public Types

using element_type = const tdsl::uint8_t
 
using value_type = typename traits::remove_cv< const tdsl::uint8_t >::type
 
using size_type = tdsl::size_t
 
using ssize_type = tdsl::ssize_t
 
using pointer = const tdsl::uint8_t *
 
using const_pointer = const const tdsl::uint8_t *
 
using reference = const tdsl::uint8_t &
 
using const_reference = const const tdsl::uint8_t &
 
using iterator = pointer
 
using const_iterator = const_pointer
 
using self_type = span< element_type >
 

Public Member Functions

template<typename... Args>
 tdsl_field (const tdsl::tds_column_info &col, Args &&... args) noexcept
 
template<typename... Args>
auto operator= (Args &&... args) noexcept -> tdsl_field &
 
template<typename T >
auto as () const noexcept -> T
 Interpret the field's value as type T.
 
bool is_null () const noexcept
 Check if field is NULL.
 
const tdsl::tds_column_info & column_info () const noexcept
 
constexpr bool operator== (const self_type &other) const noexcept
 Equality comparison operator.
 
constexpr auto size_bytes () const noexcept -> size_type
 Get the amount of the bytes in the span.
 
constexpr auto size () const noexcept -> size_type
 Get the amount of the elements in the span.
 
constexpr auto ssize () const noexcept -> ssize_type
 Get the amount of the elements in the span.
 
constexpr auto data () const noexcept -> pointer
 Data pointer.
 
constexpr auto begin () const noexcept -> iterator
 Iterator interface begin() function.
 
constexpr auto end () const noexcept -> iterator
 Iterator interface end() function.
 
constexpr auto cbegin () const noexcept -> const_iterator
 Iterator interface begin() function.
 
constexpr auto cend () const noexcept -> const_iterator
 Iterator interface end() function.
 
auto operator[] (size_type index) const noexcept -> reference
 Subscript operator.
 
 operator bool () const noexcept
 Make span boolable, so it can be used expressions like: span<int> span_v; ... if(span_v){ ..do stuff.
 
constexpr auto rebind_cast () const noexcept -> span< const Q >
 Cast span to another span with new element type.
 

Protected Attributes

size_type element_count
 Size of the span (in element count)
 

Detailed Description

Non-owning view of a row field.

Member Typedef Documentation

◆ element_type

using tdsl::span< const tdsl::uint8_t >::element_type = const tdsl::uint8_t
inherited

◆ value_type

using tdsl::span< const tdsl::uint8_t >::value_type = typename traits::remove_cv<const tdsl::uint8_t >::type
inherited

◆ size_type

using tdsl::span< const tdsl::uint8_t >::size_type = tdsl::size_t
inherited

◆ ssize_type

using tdsl::span< const tdsl::uint8_t >::ssize_type = tdsl::ssize_t
inherited

◆ pointer

using tdsl::span< const tdsl::uint8_t >::pointer = const tdsl::uint8_t *
inherited

◆ const_pointer

using tdsl::span< const tdsl::uint8_t >::const_pointer = const const tdsl::uint8_t *
inherited

◆ reference

using tdsl::span< const tdsl::uint8_t >::reference = const tdsl::uint8_t &
inherited

◆ const_reference

using tdsl::span< const tdsl::uint8_t >::const_reference = const const tdsl::uint8_t &
inherited

◆ iterator

using tdsl::span< const tdsl::uint8_t >::iterator = pointer
inherited

◆ const_iterator

using tdsl::span< const tdsl::uint8_t >::const_iterator = const_pointer
inherited

◆ self_type

using tdsl::span< const tdsl::uint8_t >::self_type = span<element_type>
inherited

Constructor & Destructor Documentation

◆ tdsl_field()

template<typename... Args>
tdsl::tdsl_field::tdsl_field ( const tdsl::tds_column_info &  col,
Args &&...  args 
)
inlineexplicitnoexcept

Member Function Documentation

◆ operator=()

template<typename... Args>
auto tdsl::tdsl_field::operator= ( Args &&...  args) -> tdsl_field &
inlinenoexcept

◆ as()

template<typename T >
auto tdsl::tdsl_field::as ( ) const -> T
inlinenoexcept

Interpret the field's value as type T.

For arithmetic T, returns T{} (zero) if the field is NULL or has fewer bytes than sizeof(T). Check is_null() to tell a NULL value from zero.

◆ is_null()

bool tdsl::tdsl_field::is_null ( ) const
inlinenoexcept

Check if field is NULL.

Note that NULL is not equivalent to value with zero length. In SQL world, these two are separate things.

Returns
true Value is NULL, false otherwise

◆ column_info()

const tdsl::tds_column_info & tdsl::tdsl_field::column_info ( ) const
inlinenoexcept

◆ operator==()

constexpr bool tdsl::span< const tdsl::uint8_t >::operator== ( const self_type &  other) const
inlineconstexprnoexceptinherited

Equality comparison operator.

Two spans are considered equal if they point to same memory

Parameters
[in]otherSpan to compare against
Returns
true Spans are equal
false otherwise

◆ size_bytes()

constexpr auto tdsl::span< const tdsl::uint8_t >::size_bytes ( ) const -> size_type
inlineconstexprnoexceptinherited

Get the amount of the bytes in the span.

Returns
size_type Amount of the bytes in the span

◆ size()

constexpr auto tdsl::span< const tdsl::uint8_t >::size ( ) const -> size_type
inlineconstexprnoexceptinherited

Get the amount of the elements in the span.

Returns
size_type Amount of the element in the span

◆ ssize()

constexpr auto tdsl::span< const tdsl::uint8_t >::ssize ( ) const -> ssize_type
inlineconstexprnoexceptinherited

Get the amount of the elements in the span.

Returns
size_type Amount of the element in the span

◆ data()

constexpr auto tdsl::span< const tdsl::uint8_t >::data ( ) const -> pointer
inlineconstexprnoexceptinherited

Data pointer.

Returns
T* Pointer to the beginning of the span

◆ begin()

constexpr auto tdsl::span< const tdsl::uint8_t >::begin ( ) const -> iterator
inlineconstexprnoexceptinherited

Iterator interface begin() function.

Returns
T* Pointer to the beginning of the span

◆ end()

constexpr auto tdsl::span< const tdsl::uint8_t >::end ( ) const -> iterator
inlineconstexprnoexceptinherited

Iterator interface end() function.

Returns
T* Pointer to the one past last element of the span

◆ cbegin()

constexpr auto tdsl::span< const tdsl::uint8_t >::cbegin ( ) const -> const_iterator
inlineconstexprnoexceptinherited

Iterator interface begin() function.

Returns
T* Pointer to the beginning of the span

◆ cend()

constexpr auto tdsl::span< const tdsl::uint8_t >::cend ( ) const -> const_iterator
inlineconstexprnoexceptinherited

Iterator interface end() function.

Returns
T* Pointer to the one past last element of the span

◆ operator[]()

auto tdsl::span< const tdsl::uint8_t >::operator[] ( size_type  index) const-> reference
inlinenoexceptinherited

Subscript operator.

Parameters
[in]indexElement to access
Returns
reference Reference to the element

◆ operator bool()

tdsl::span< const tdsl::uint8_t >::operator bool ( ) const
inlinenoexceptinherited

Make span boolable, so it can be used expressions like: span<int> span_v; ... if(span_v){ ..do stuff.

}

Returns
true if data is not nullptr and size is greater than zero
false otherwise

◆ rebind_cast()

constexpr auto tdsl::span< const tdsl::uint8_t >::rebind_cast ( ) const -> span<const Q>
inlineconstexprnoexceptinherited

Cast span to another span with new element type.

Template Parameters
QNew element type
Returns
span<const Q> New span
Note
If the original span's size_bytes() is not a multiple of sizeof(Q), the element count of the resulting span will be rounded down.

Member Data Documentation

◆ element_count

size_type tdsl::span< const tdsl::uint8_t >::element_count
protectedinherited

Size of the span (in element count)


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