RTI Connext Modern C++ API  Version 6.1.0
dds::core::basic_string< CharType, Allocator > Class Template Reference

<<value-type>> A string convertible to std::string and with similar functionality More...

#include <dds/core/String.hpp>

Public Member Functions

 basic_string ()
 Creates an empty string. More...
 
 basic_string (const basic_string &other)
 Copy constructor. More...
 
 basic_string (const CharType *other_str)
 Constructor from C string. More...
 
 basic_string (const std::basic_string< CharType > &std_string)
 Constructor from std::basic_string. More...
 
 basic_string (size_t the_size)
 Creates a string of a given size, initialized to '\0'. More...
 
 basic_string (basic_string &&other) OMG_NOEXCEPT
 <<C++11>> Move constructor More...
 
const CharType * c_str () const
 Gets the underlying C string. More...
 
size_type size () const
 Gets the size. More...
 
basic_stringoperator= (const basic_string &other)
 Assignment operator. More...
 
basic_stringoperator= (basic_string &&other) OMG_NOEXCEPT
 <<C++11>> Move-assignment operator More...
 
bool operator== (const basic_string &other) const
 Returns if two strings are equal. More...
 
bool operator!= (const basic_string &other) const
 Returns if two strings are different. More...
 
std::basic_string< CharType > to_std_string () const
 Creates a std::basic_string from this dds::core::basic_string. More...
 
 operator std::basic_string< CharType > () const
 Creates a std::string from this dds::core::string. More...
 

Related Functions

(Note that these are not member functions.)

template<typename CharType , typename Allocator >
std::ostream & operator<< (std::ostream &out, const basic_string< CharType, Allocator > &the_string)
 Prints the string. More...
 

Detailed Description

template<typename CharType, typename Allocator>
class dds::core::basic_string< CharType, Allocator >

<<value-type>> A string convertible to std::string and with similar functionality

In many cases, for performance reasons and other implementation requirements, the RTI Connext API uses dds::core::string instead of std::string. The most significant case is the C++ types that rtiddsgen generates from IDL.

A dds::core::string provides a subset of the functionality of a std::string. It also provides automatic conversion to and from std::string.

Examples:
Foo.hpp.

Constructor & Destructor Documentation

◆ basic_string() [1/6]

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::basic_string ( )
inline

Creates an empty string.

◆ basic_string() [2/6]

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::basic_string ( const basic_string< CharType, Allocator > &  other)
inline

◆ basic_string() [3/6]

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::basic_string ( const CharType *  other_str)
inline

Constructor from C string.

◆ basic_string() [4/6]

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::basic_string ( const std::basic_string< CharType > &  std_string)
inline

Constructor from std::basic_string.

◆ basic_string() [5/6]

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::basic_string ( size_t  the_size)
inlineexplicit

Creates a string of a given size, initialized to '\0'.

◆ basic_string() [6/6]

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::basic_string ( basic_string< CharType, Allocator > &&  other)
inline

<<C++11>> Move constructor

References dds::core::Duration::swap().

Member Function Documentation

◆ c_str()

template<typename CharType, typename Allocator>
const CharType* dds::core::basic_string< CharType, Allocator >::c_str ( ) const
inline

◆ size()

template<typename CharType, typename Allocator>
size_type dds::core::basic_string< CharType, Allocator >::size ( ) const
inline

◆ operator=() [1/2]

template<typename CharType, typename Allocator>
basic_string& dds::core::basic_string< CharType, Allocator >::operator= ( const basic_string< CharType, Allocator > &  other)
inline

◆ operator=() [2/2]

template<typename CharType, typename Allocator>
basic_string& dds::core::basic_string< CharType, Allocator >::operator= ( basic_string< CharType, Allocator > &&  other)
inline

<<C++11>> Move-assignment operator

References dds::core::Duration::swap().

◆ operator==()

template<typename CharType, typename Allocator>
bool dds::core::basic_string< CharType, Allocator >::operator== ( const basic_string< CharType, Allocator > &  other) const
inline

Returns if two strings are equal.

References dds::core::basic_string< CharType, Allocator >::size().

◆ operator!=()

template<typename CharType, typename Allocator>
bool dds::core::basic_string< CharType, Allocator >::operator!= ( const basic_string< CharType, Allocator > &  other) const
inline

Returns if two strings are different.

◆ to_std_string()

template<typename CharType, typename Allocator>
std::basic_string<CharType> dds::core::basic_string< CharType, Allocator >::to_std_string ( ) const
inline

Creates a std::basic_string from this dds::core::basic_string.

◆ operator std::basic_string< CharType >()

template<typename CharType, typename Allocator>
dds::core::basic_string< CharType, Allocator >::operator std::basic_string< CharType > ( ) const
inline

Creates a std::string from this dds::core::string.

References dds::core::Duration::swap().

Friends And Related Function Documentation

◆ operator<<()

template<typename CharType , typename Allocator >
std::ostream & operator<< ( std::ostream &  out,
const basic_string< CharType, Allocator > &  the_string 
)
related

Prints the string.