Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches
fixed_string< MAX_CHARS > Struct Template Reference

Template class for non-alloc strings. More...

#include <fixed_size_string.hpp>

Public Member Functions

 fixed_string () noexcept
 Default constructor.
 
 fixed_string (const char *c_array, size_t n_chars) noexcept
 
fixed_stringassign (const char *c_array, size_t n_chars) noexcept
 
 fixed_string (const char *c_string) noexcept
 
fixed_stringoperator= (const char *c_string) noexcept
 
 fixed_string (const std::string &str) noexcept
 
fixed_stringoperator= (const std::string &str) noexcept
 
template<size_t N>
fixed_stringoperator= (const fixed_string< N > &rhs) noexcept
 
const char * c_str () const noexcept
 
std::string to_string () const
 
bool operator== (const char *rhs) const noexcept
 
bool operator== (const std::string &rhs) const noexcept
 
template<size_t N>
bool operator== (const fixed_string< N > &rhs) const noexcept
 
bool operator!= (const char *rhs) const noexcept
 
bool operator!= (const std::string &rhs) const noexcept
 
template<size_t N>
bool operator!= (const fixed_string< N > &rhs) const noexcept
 
template<size_t N>
bool operator< (const fixed_string< N > &rhs) const noexcept
 
template<size_t N>
bool operator> (const fixed_string< N > &rhs) const noexcept
 
bool operator< (const std::string &rhs) const noexcept
 
bool operator> (const std::string &rhs) const noexcept
 
 operator const char * () const noexcept
 
size_t size () const noexcept
 
int compare (const char *str) const noexcept
 Compare with a C string.
 
int compare (const std::string &str) const noexcept
 Compare with a std::string.
 
template<size_t N>
int compare (const fixed_string< N > &str) const noexcept
 Compare with a fixed_string.
 

Static Public Attributes

static constexpr size_t max_size = MAX_CHARS
 

Detailed Description

template<size_t MAX_CHARS>
struct eprosima::fastrtps::fixed_string< MAX_CHARS >

Template class for non-alloc strings.

Will be truncated when assigned from a longer string.

Template Parameters
MAX_CHARSMaximum number of characters is specified as the template parameter. Space for an additional null terminator will be reserved.

Constructor & Destructor Documentation

◆ fixed_string() [1/4]

template<size_t MAX_CHARS>
fixed_string ( )
inlinenoexcept

Default constructor.

◆ fixed_string() [2/4]

template<size_t MAX_CHARS>
fixed_string ( const char *  c_array,
size_t  n_chars 
)
inlinenoexcept

◆ fixed_string() [3/4]

template<size_t MAX_CHARS>
fixed_string ( const char *  c_string)
inlinenoexcept

◆ fixed_string() [4/4]

template<size_t MAX_CHARS>
fixed_string ( const std::string &  str)
inlinenoexcept

Member Function Documentation

◆ assign()

template<size_t MAX_CHARS>
fixed_string & assign ( const char *  c_array,
size_t  n_chars 
)
inlinenoexcept

◆ c_str()

template<size_t MAX_CHARS>
const char * c_str ( ) const
inlinenoexcept

◆ compare() [1/3]

template<size_t MAX_CHARS>
int compare ( const char *  str) const
inlinenoexcept

Compare with a C string.

Parameters
strC string to be compared with.
Returns
Integer value with the result of the comparison as described in std::string::compare().

◆ compare() [2/3]

template<size_t MAX_CHARS>
template<size_t N>
int compare ( const fixed_string< N > &  str) const
inlinenoexcept

Compare with a fixed_string.

Parameters
strfixed_string to be compared with.
Returns
Integer value with the result of the comparison as described in std::string::compare().

◆ compare() [3/3]

template<size_t MAX_CHARS>
int compare ( const std::string &  str) const
inlinenoexcept

Compare with a std::string.

Parameters
strstd::string to be compared with.
Returns
Integer value with the result of the comparison as described in std::string::compare().

◆ operator const char *()

template<size_t MAX_CHARS>
operator const char * ( ) const
inlinenoexcept

◆ operator!=() [1/3]

template<size_t MAX_CHARS>
bool operator!= ( const char *  rhs) const
inlinenoexcept

◆ operator!=() [2/3]

template<size_t MAX_CHARS>
template<size_t N>
bool operator!= ( const fixed_string< N > &  rhs) const
inlinenoexcept

◆ operator!=() [3/3]

template<size_t MAX_CHARS>
bool operator!= ( const std::string &  rhs) const
inlinenoexcept

◆ operator<() [1/2]

template<size_t MAX_CHARS>
template<size_t N>
bool operator< ( const fixed_string< N > &  rhs) const
inlinenoexcept

◆ operator<() [2/2]

template<size_t MAX_CHARS>
bool operator< ( const std::string &  rhs) const
inlinenoexcept

◆ operator=() [1/3]

template<size_t MAX_CHARS>
fixed_string & operator= ( const char *  c_string)
inlinenoexcept

◆ operator=() [2/3]

template<size_t MAX_CHARS>
template<size_t N>
fixed_string & operator= ( const fixed_string< N > &  rhs)
inlinenoexcept

◆ operator=() [3/3]

template<size_t MAX_CHARS>
fixed_string & operator= ( const std::string &  str)
inlinenoexcept

◆ operator==() [1/3]

template<size_t MAX_CHARS>
bool operator== ( const char *  rhs) const
inlinenoexcept

◆ operator==() [2/3]

template<size_t MAX_CHARS>
template<size_t N>
bool operator== ( const fixed_string< N > &  rhs) const
inlinenoexcept

◆ operator==() [3/3]

template<size_t MAX_CHARS>
bool operator== ( const std::string &  rhs) const
inlinenoexcept

◆ operator>() [1/2]

template<size_t MAX_CHARS>
template<size_t N>
bool operator> ( const fixed_string< N > &  rhs) const
inlinenoexcept

◆ operator>() [2/2]

template<size_t MAX_CHARS>
bool operator> ( const std::string &  rhs) const
inlinenoexcept

◆ size()

template<size_t MAX_CHARS>
size_t size ( ) const
inlinenoexcept

◆ to_string()

template<size_t MAX_CHARS>
std::string to_string ( ) const
inline

Member Data Documentation

◆ max_size

template<size_t MAX_CHARS>
constexpr size_t max_size = MAX_CHARS
staticconstexpr

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