iceoryx2
C++ Bindings
Loading...
Searching...
No Matches
iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > Class Template Reference

The SemanticString is a string which has an inner syntax and restrictions to valid content. Examples are for instance. More...

#include <semantic_string.hpp>

Public Member Functions

constexpr auto size () const noexcept -> uint64_t
 Returns the number of characters.
constexpr auto as_string () const noexcept -> const bb::StaticString< Capacity > &
 Returns a const reference to the underlying string. It is const and shall not be modified to guarantee the contract that a SemanticString contains always a valid value.
template<typename T>
auto append (const T &value) noexcept -> bb::Expected< void, SemanticStringError >
 Appends another string to the SemanticString. If the value contains invalid characters or the result would end up in invalid content it fails.
template<typename T>
auto insert (uint64_t pos, const T &str, uint64_t count) noexcept -> bb::Expected< void, SemanticStringError >
 Inserts another string into the SemanticString. If the value contains invalid characters or the result would end up in invalid content it fails.
auto operator== (const SemanticString &rhs) const noexcept -> bool
 checks if another SemanticString is equal to this string
template<typename T>
auto operator== (const T &rhs) const noexcept -> bb::RequireStaticStringOrCharArray< T, bool >
 checks if another string or char array is equal to this string
auto operator!= (const SemanticString &rhs) const noexcept -> bool
 checks if another SemanticString is not equal to this string
template<typename T>
auto operator!= (const T &rhs) const noexcept -> bb::RequireStaticStringOrCharArray< T, bool >
 checks if another string or char array is not equal to this string
auto operator<= (const SemanticString &rhs) const noexcept -> bool
 checks if another SemanticString is less than or equal this string
template<typename T>
auto operator<= (const T &rhs) const noexcept -> bb::RequireStaticStringOrCharArray< T, bool >
 checks if another string or char array is less than or equal this string
auto operator< (const SemanticString &rhs) const noexcept -> bool
 checks if another SemanticString is less than this string
template<typename T>
auto operator< (const T &rhs) const noexcept -> bb::RequireStaticStringOrCharArray< T, bool >
 checks if another string or char array is less than this string
auto operator>= (const SemanticString &rhs) const noexcept -> bool
 checks if another SemanticString is greater than or equal this string
template<typename T>
auto operator>= (const T &rhs) const noexcept -> bb::RequireStaticStringOrCharArray< T, bool >
 checks if another string or char array is greater than or equal this string
auto operator> (const SemanticString &rhs) const noexcept -> bool
 checks if another SemanticString is greater than this string
template<typename T>
auto operator> (const T &rhs) const noexcept -> bb::RequireStaticStringOrCharArray< T, bool >
 checks if another string or char array is greater than this string

Static Public Member Functions

template<uint64_t N>
static auto create (const char(&value)[N]) noexcept -> bb::Expected< Child, SemanticStringError >
 Creates a new SemanticString from the provided string literal. If the value contains invalid characters or invalid content the expected returns an error describing the cause.
template<uint64_t N>
static auto create (const bb::StaticString< N > &value) noexcept -> bb::Expected< Child, SemanticStringError >
 Creates a new SemanticString from the provided string. If the value contains invalid characters or invalid content the expected returns an error describing the cause.
static auto create (const char *value) noexcept -> bb::Expected< Child, SemanticStringError >
 Creates a new SemanticString from the provided string literal. If the value contains invalid characters or invalid content the expected returns an error describing the cause.
static constexpr auto capacity () noexcept -> uint64_t
 Returns the capacity of the string.

Protected Member Functions

template<uint64_t N>
 SemanticString (const bb::StaticString< N > &value) noexcept

Detailed Description

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
class iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >

The SemanticString is a string which has an inner syntax and restrictions to valid content. Examples are for instance.

Definition at line 65 of file semantic_string.hpp.

Constructor & Destructor Documentation

◆ SemanticString()

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<uint64_t N>
iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::SemanticString ( const bb::StaticString< N > & value)
inlineexplicitprotectednoexcept

Member Function Documentation

◆ append()

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::append ( const T & value) ->bb::Expected< void, SemanticStringError >
inlinenoexcept

Appends another string to the SemanticString. If the value contains invalid characters or the result would end up in invalid content it fails.

Parameters
[in]valuethe value which should be added
Returns
on failure the error inside the expected describes the failure

Definition at line 323 of file semantic_string.hpp.

References iox2::bb::detail::get_size(), insert(), and size().

◆ as_string()

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::as_string ( ) const->constbb::StaticString< Capacity > &
constexprnoexcept

Returns a const reference to the underlying string. It is const and shall not be modified to guarantee the contract that a SemanticString contains always a valid value.

Returns
string reference containing the actual value.

Definition at line 313 of file semantic_string.hpp.

Referenced by operator!=(), operator!=(), operator<(), operator<(), operator<=(), operator<=(), operator==(), operator==(), operator>(), operator>(), operator>=(), and operator>=().

◆ capacity()

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::capacity ( ) ->uint64_t
staticconstexprnoexcept

Returns the capacity of the string.

Returns
the maximum amount of characters which can be stored.

Definition at line 303 of file semantic_string.hpp.

◆ create() [1/3]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<uint64_t N>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::create ( const bb::StaticString< N > & value) ->bb::Expected< Child, SemanticStringError >
inlinestaticnoexcept

Creates a new SemanticString from the provided string. If the value contains invalid characters or invalid content the expected returns an error describing the cause.

Parameters
[in]valuethe value of the SemanticString
Returns
expected either containing the new SemanticString or an error

Definition at line 265 of file semantic_string.hpp.

References SemanticString().

◆ create() [2/3]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::create ( const char * value) ->bb::Expected< Child, SemanticStringError >
inlinestaticnoexcept

Creates a new SemanticString from the provided string literal. If the value contains invalid characters or invalid content the expected returns an error describing the cause.

Parameters
[in]valuethe value of the SemanticString
Returns
expected either containing the new SemanticString or an error

Definition at line 275 of file semantic_string.hpp.

References iox2::Debug, iox2::bb::err(), iox2::bb::ExceedsMaximumLength, IOX2_LOG, and SemanticString().

◆ create() [3/3]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<uint64_t N>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::create ( const char(&) value[N]) ->bb::Expected< Child, SemanticStringError >
inlinestaticnoexcept

Creates a new SemanticString from the provided string literal. If the value contains invalid characters or invalid content the expected returns an error describing the cause.

Parameters
[in]valuethe value of the SemanticString
Returns
expected either containing the new SemanticString or an error

Definition at line 252 of file semantic_string.hpp.

References SemanticString().

◆ insert()

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::insert ( uint64_t pos,
const T & str,
uint64_t count )->bb::Expected< void, SemanticStringError >
inlinenoexcept

Inserts another string into the SemanticString. If the value contains invalid characters or the result would end up in invalid content it fails.

Parameters
[in]posthe position where the string should be inserted
[in]strthe value which should be added
[in]counthow many characters of str shall be inserted
Returns
on failure the error inside the expected describes the failure

Definition at line 333 of file semantic_string.hpp.

References iox2::Debug, iox2::bb::err(), iox2::bb::ExceedsMaximumLength, iox2::bb::InvalidContent, and IOX2_LOG.

Referenced by append().

◆ operator!=() [1/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator!= ( const SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > & rhs) const->bool
inlinenoexcept

checks if another SemanticString is not equal to this string

Parameters
[in]rhsthe other SemanticString
Returns
true if the contents are not equal, otherwise false

Definition at line 388 of file semantic_string.hpp.

References as_string(), and SemanticString().

◆ operator!=() [2/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator!= ( const T & rhs) const->bb::RequireStaticStringOrCharArray< T, bool >
inlinenoexcept

checks if another string or char array is not equal to this string

Parameters
[in]rhsthe other string
Returns
true if the contents are not equal, otherwise false

Definition at line 398 of file semantic_string.hpp.

References as_string().

◆ operator<() [1/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator< ( const SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > & rhs) const->bool
inlinenoexcept

checks if another SemanticString is less than this string

Parameters
[in]rhsthe other SemanticString
Returns
true if the contents are less than rhs, otherwise false

Definition at line 426 of file semantic_string.hpp.

References as_string(), and SemanticString().

◆ operator<() [2/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator< ( const T & rhs) const->bb::RequireStaticStringOrCharArray< T, bool >
inlinenoexcept

checks if another string or char array is less than this string

Parameters
[in]rhsthe other string
Returns
true if the contents are less than rhs, otherwise false

Definition at line 436 of file semantic_string.hpp.

References as_string().

◆ operator<=() [1/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator<= ( const SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > & rhs) const->bool
inlinenoexcept

checks if another SemanticString is less than or equal this string

Parameters
[in]rhsthe other SemanticString
Returns
true if the contents are less than or equal rhs, otherwise false

Definition at line 407 of file semantic_string.hpp.

References as_string(), and SemanticString().

◆ operator<=() [2/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator<= ( const T & rhs) const->bb::RequireStaticStringOrCharArray< T, bool >
inlinenoexcept

checks if another string or char array is less than or equal this string

Parameters
[in]rhsthe other string
Returns
true if the contents are less than or equal rhs, otherwise false

Definition at line 417 of file semantic_string.hpp.

References as_string().

◆ operator==() [1/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator== ( const SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > & rhs) const->bool
inlinenoexcept

checks if another SemanticString is equal to this string

Parameters
[in]rhsthe other SemanticString
Returns
true if the contents are equal, otherwise false

Definition at line 369 of file semantic_string.hpp.

References as_string(), and SemanticString().

◆ operator==() [2/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator== ( const T & rhs) const->bb::RequireStaticStringOrCharArray< T, bool >
inlinenoexcept

checks if another string or char array is equal to this string

Parameters
[in]rhsthe other string
Returns
true if the contents are equal, otherwise false

Definition at line 379 of file semantic_string.hpp.

References as_string().

◆ operator>() [1/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator> ( const SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > & rhs) const->bool
inlinenoexcept

checks if another SemanticString is greater than this string

Parameters
[in]rhsthe other SemanticString
Returns
true if the contents are greater than rhs, otherwise false

Definition at line 464 of file semantic_string.hpp.

References as_string(), and SemanticString().

◆ operator>() [2/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator> ( const T & rhs) const->bb::RequireStaticStringOrCharArray< T, bool >
inlinenoexcept

checks if another string or char array is greater than this string

Parameters
[in]rhsthe other string
Returns
true if the contents are greater than rhs, otherwise false

Definition at line 474 of file semantic_string.hpp.

References as_string().

◆ operator>=() [1/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator>= ( const SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall > & rhs) const->bool
inlinenoexcept

checks if another SemanticString is greater than or equal this string

Parameters
[in]rhsthe other SemanticString
Returns
true if the contents are greater than or equal rhs, otherwise false

Definition at line 445 of file semantic_string.hpp.

References as_string(), and SemanticString().

◆ operator>=() [2/2]

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
template<typename T>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::operator>= ( const T & rhs) const->bb::RequireStaticStringOrCharArray< T, bool >
inlinenoexcept

checks if another string or char array is greater than or equal this string

Parameters
[in]rhsthe other string
Returns
true if the contents are greater than or equal rhs, otherwise false

Definition at line 455 of file semantic_string.hpp.

References as_string().

◆ size()

template<typename Child, uint64_t Capacity, DoesContainInvalidContent< Capacity > DoesContainInvalidContentCall, DoesContainInvalidCharacter< Capacity > DoesContainInvalidCharacterCall>
auto iox2::bb::SemanticString< Child, Capacity, DoesContainInvalidContentCall, DoesContainInvalidCharacterCall >::size ( ) const->uint64_t
constexprnoexcept

Returns the number of characters.

Returns
number of characters

Definition at line 293 of file semantic_string.hpp.

Referenced by append().


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