Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::inline_string_reference Class Reference

A reference class to an inline_string object, with size-erased type. More...

Inheritance diagram for arene::base::inline_string_reference:
Inheritance graph

Public Types

using const_iterator = string_base::const_iterator
 The type of a const iterator at the base class.
 
using iterator = string_base::iterator
 The type of an iterator at the base class.
 
using size_type = string_base::size_type
 The type of a size at the base class.
 
using string_base = inline_string_detail::inline_string_base
 The type of the base class.
 

Public Member Functions

template<std::size_t MaxSize>
constexpr inline_string_reference (inline_string< MaxSize > &str) noexcept
 Construct a reference to the supplied inline_string.
 
constexpr auto append (size_type const count, detail::character const chr) const noexcept -> inline_string_reference const &
 Append the specified number of copies of a character to the string.
 
constexpr auto append (string_view const rhs) const noexcept -> inline_string_reference const &
 Append a string to the current string.
 
constexpr auto assign (string_view const rhs) const noexcept -> inline_string_reference const &
 Assign from a string_view.
 
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
constexpr auto at (size_type const index) const -> detail::character &
 Retrieve the index -th character in the string.
 
constexpr auto back () const noexcept -> detail::character &
 Get the last character in the string.
 
constexpr auto begin () const noexcept -> iterator
 Return an iterator to the first position in the string.
 
ARENE_NODISCARD constexpr auto c_str () const noexcept -> detail::raw_c_string
 Return a pointer to the NUL-terminated string held in *this.
 
constexpr auto capacity () const noexcept -> size_type
 The maximum length of the string.
 
constexpr auto const_operations_ptr (inline_string_reference_detail::ref_passkey) const noexcept -> inline_string_reference_detail::const_operations const *
 Get a pointer to the struct holding const operation implementations.
 
ARENE_NODISCARD constexpr auto data () const noexcept -> detail::raw_c_string
 Return a pointer to the NUL-terminated string held in *this.
 
constexpr auto empty () const noexcept -> bool
 Check if the string is empty.
 
constexpr auto end () const noexcept -> iterator
 The one-past-the-last position in the string.
 
constexpr auto erase (const_iterator const first, const_iterator const last) const noexcept -> iterator
 Erase the characters in the specified range.
 
constexpr auto erase (size_type const pos, size_type const count) const noexcept -> inline_string_reference const &
 Erase the specified number of characters in the string starting at the specified position.
 
constexpr auto front () const noexcept -> detail::character &
 Get the first character in the string.
 
constexpr auto get_string_ptr (inline_string_reference_detail::ref_passkey) const noexcept -> inline_string_detail::inline_string_base *
 Get a pointer to the underlying string object pointer.
 
constexpr auto operator+= (detail::character const rhs) const noexcept -> inline_string_reference const &
 Append a character to the current string.
 
constexpr auto operator+= (string_view const rhs) const noexcept -> inline_string_reference const &
 Append a string to the current string.
 
ARENE_NODISCARD constexpr auto operator[] (size_type const index) const noexcept -> detail::character &
 Retrieve the index -th character in the string.
 
constexpr auto push_back (detail::character const rhs) const noexcept -> inline_string_reference const &
 Append a character to the current string.
 
constexpr auto push_back (string_view const rhs) const noexcept -> inline_string_reference const &
 Append a string to the current string.
 
constexpr auto size () const noexcept -> size_type
 Get the length of the string.
 
constexpr auto to_string_view () const noexcept -> string_view
 Convert to string view.
 

Static Public Member Functions

static ARENE_NODISCARD constexpr auto three_way_compare (inline_string_reference const lhs, inline_string_reference const rhs) noexcept -> strong_ordering
 Compare two strings for lexicographical ordering, forwarded to string_view's.
 
static ARENE_NODISCARD constexpr auto three_way_compare (inline_string_reference const lhs, string_view const rhs) noexcept -> strong_ordering
 Compare two strings for lexicographical ordering, forwarded to string_view's.
 

Detailed Description

A reference class to an inline_string object, with size-erased type.

Member Typedef Documentation

◆ const_iterator

using arene::base::inline_string_reference::const_iterator = string_base::const_iterator

The type of a const iterator at the base class.

◆ iterator

using arene::base::inline_string_reference::iterator = string_base::iterator

The type of an iterator at the base class.

◆ size_type

using arene::base::inline_string_reference::size_type = string_base::size_type

The type of a size at the base class.

◆ string_base

using arene::base::inline_string_reference::string_base = inline_string_detail::inline_string_base

The type of the base class.

Constructor & Destructor Documentation

◆ inline_string_reference()

template<std::size_t MaxSize>
arene::base::inline_string_reference::inline_string_reference ( inline_string< MaxSize > & str)
inlineexplicitconstexprnoexcept

Construct a reference to the supplied inline_string.

Template Parameters
MaxSizeThe maximum capacity of the string, not including the null terminator
Parameters
strReference to the inline_string

Member Function Documentation

◆ append() [1/2]

auto arene::base::inline_string_reference::append ( size_type const count,
detail::character const chr ) const -> inline_string_reference const&
inlineconstexprnoexcept

Append the specified number of copies of a character to the string.

Parameters
countThe number of characters to append
chrThe character to append
Returns
A reference to this object

◆ append() [2/2]

auto arene::base::inline_string_reference::append ( string_view const rhs) const -> inline_string_reference const&
inlineconstexprnoexcept

Append a string to the current string.

Parameters
rhsThe string to append
Returns
A reference to this object

◆ assign()

auto arene::base::inline_string_reference::assign ( string_view const rhs) const -> inline_string_reference const&
inlineconstexprnoexcept

Assign from a string_view.

Parameters
rhsThe string to append
Returns
A reference to this object

◆ at()

template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
auto arene::base::inline_string_reference::at ( size_type const index) const -> detail::character&
inlineconstexpr

Retrieve the index -th character in the string.

Template Parameters
AreExceptionsEnabledUsed to disable this overload if exceptions are not enabled.
Parameters
indexThe index of the character to retrieve
Returns
A reference to that character

◆ back()

auto arene::base::inline_string_reference::back ( ) const -> detail::character&
inlineconstexprnoexcept

Get the last character in the string.

Returns
A reference to the last character

◆ begin()

auto arene::base::inline_string_reference::begin ( ) const -> iterator
inlineconstexprnoexcept

Return an iterator to the first position in the string.

Returns
An iterator to the first element if not empty, end() otherwise

◆ c_str()

ARENE_NODISCARD constexpr auto arene::base::inline_string_reference::c_str ( ) const -> detail::raw_c_string
inlineconstexprnoexcept

Return a pointer to the NUL-terminated string held in *this.

Returns
a pointer to the NUL-terminated string held in *this

◆ capacity()

auto arene::base::inline_string_reference::capacity ( ) const -> size_type
inlineconstexprnoexcept

The maximum length of the string.

Returns
size_type MaxSize

◆ const_operations_ptr()

auto arene::base::inline_string_reference::const_operations_ptr ( inline_string_reference_detail::ref_passkey ) const -> inline_string_reference_detail::const_operations const*
inlineconstexprnoexcept

Get a pointer to the struct holding const operation implementations.

Returns
A pointer to the struct holding const operation implementations

◆ data()

ARENE_NODISCARD constexpr auto arene::base::inline_string_reference::data ( ) const -> detail::raw_c_string
inlineconstexprnoexcept

Return a pointer to the NUL-terminated string held in *this.

Returns
A pointer to the NUL-terminated string held in *this

◆ empty()

auto arene::base::inline_string_reference::empty ( ) const -> bool
inlineconstexprnoexcept

Check if the string is empty.

Returns
true if the string is empty, false otherwise

◆ end()

auto arene::base::inline_string_reference::end ( ) const -> iterator
inlineconstexprnoexcept

The one-past-the-last position in the string.

Returns
An iterator to the one-past-the-last position in the string

◆ erase() [1/2]

auto arene::base::inline_string_reference::erase ( const_iterator const first,
const_iterator const last ) const -> iterator
inlineconstexprnoexcept

Erase the characters in the specified range.

Parameters
firstThe start of the range
lastThe end of the range
Returns
An iterator referring to the character after the removed range, or end()

◆ erase() [2/2]

auto arene::base::inline_string_reference::erase ( size_type const pos,
size_type const count ) const -> inline_string_reference const&
inlineconstexprnoexcept

Erase the specified number of characters in the string starting at the specified position.

Parameters
posThe position of the characters to remove. If pos>size() this is a noop.
countThe maximum number of characters to remove.
Returns
A reference to this object

◆ front()

auto arene::base::inline_string_reference::front ( ) const -> detail::character&
inlineconstexprnoexcept

Get the first character in the string.

Returns
A reference to the first character

◆ get_string_ptr()

auto arene::base::inline_string_reference::get_string_ptr ( inline_string_reference_detail::ref_passkey ) const -> inline_string_detail::inline_string_base*
inlineconstexprnoexcept

Get a pointer to the underlying string object pointer.

Returns
A pointer to the underlying string object pointer

◆ operator+=() [1/2]

auto arene::base::inline_string_reference::operator+= ( detail::character const rhs) const -> inline_string_reference const&
inlineconstexprnoexcept

Append a character to the current string.

Parameters
rhsThe character to append
Returns
A reference to this object

◆ operator+=() [2/2]

auto arene::base::inline_string_reference::operator+= ( string_view const rhs) const -> inline_string_reference const&
inlineconstexprnoexcept

Append a string to the current string.

Parameters
rhsThe string to append
Returns
A reference to this object

◆ operator[]()

ARENE_NODISCARD constexpr auto arene::base::inline_string_reference::operator[] ( size_type const index) const -> detail::character&
inlineconstexprnoexcept

Retrieve the index -th character in the string.

Parameters
indexThe index of the character to retrieve
Returns
A reference to that character

◆ push_back() [1/2]

auto arene::base::inline_string_reference::push_back ( detail::character const rhs) const -> inline_string_reference const&
inlineconstexprnoexcept

Append a character to the current string.

Parameters
rhsThe character to append
Returns
A reference to this object

◆ push_back() [2/2]

auto arene::base::inline_string_reference::push_back ( string_view const rhs) const -> inline_string_reference const&
inlineconstexprnoexcept

Append a string to the current string.

Parameters
rhsThe string to append
Returns
A reference to this object

◆ size()

auto arene::base::inline_string_reference::size ( ) const -> size_type
inlineconstexprnoexcept

Get the length of the string.

Returns
The number of characters in the string, non-inclusive of the null-terminator

◆ three_way_compare() [1/2]

static ARENE_NODISCARD constexpr auto arene::base::inline_string_reference::three_way_compare ( inline_string_reference const lhs,
inline_string_reference const rhs ) -> strong_ordering
inlinestaticconstexprnoexcept

Compare two strings for lexicographical ordering, forwarded to string_view's.

Parameters
lhsThe first string representation
rhsThe second string representation
Returns
strong_ordering equivalent to string_view's 3 way compare result

◆ three_way_compare() [2/2]

static ARENE_NODISCARD constexpr auto arene::base::inline_string_reference::three_way_compare ( inline_string_reference const lhs,
string_view const rhs ) -> strong_ordering
inlinestaticconstexprnoexcept

Compare two strings for lexicographical ordering, forwarded to string_view's.

Parameters
lhsThe first string representation
rhsThe second string representation
Returns
strong_ordering equivalent to string_view's 3 way compare result

◆ to_string_view()

auto arene::base::inline_string_reference::to_string_view ( ) const -> string_view
inlineconstexprnoexcept

Convert to string view.

Returns
A string_view object referencing the data

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