Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
doctest::String Class Reference

#include <doctest.h>

Classes

struct  view
 OCLINT avoid private static members. More...
 

Public Types

using size_type = DOCTEST_CONFIG_STRING_SIZE_TYPE
 

Public Member Functions

char * c_str ()
 
const char * c_str () const
 
size_type capacity () const
 
int compare (const char *other, bool no_case=false) const
 
int compare (const String &other, bool no_case=false) const
 
size_type find (char ch, size_type pos=0) const
 
Stringoperator+= (const String &other)
 
Stringoperator= (const String &other)
 
Stringoperator= (String &&other) noexcept
 
char & operator[] (size_type i)
 
char operator[] (size_type i) const
 
size_type rfind (char ch, size_type pos=npos) const
 
size_type size () const
 
 String () noexcept
 
 String (const char *in)
 
 String (const char *in, size_type in_size)
 
 String (const String &other)
 
 String (std::istream &in, size_type in_size)
 
 String (String &&other) noexcept
 
String substr (size_type pos, size_type cnt=npos) &&
 
String substr (size_type pos, size_type cnt=npos) const &
 
 ~String ()
 

Static Public Attributes

static DOCTEST_CONSTEXPR size_type npos = static_cast<size_type>(-1)
 

Private Member Functions

char * allocate (size_type sz)
 
void copy (const String &other)
 
bool isOnStack () const noexcept
 
void setLast (size_type in=last) noexcept
 
void setOnHeap () noexcept
 
void setSize (size_type sz) noexcept
 

Private Attributes

union {
   char   buf [len]
 
   view   data
 
}; 
 

Static Private Attributes

static DOCTEST_CONSTEXPR size_type last = len - 1
 OCLINT avoid private static members. More...
 
static DOCTEST_CONSTEXPR size_type len = 24
 

Friends

DOCTEST_INTERFACE std::ostreamoperator<< (std::ostream &s, const String &in)
 

Detailed Description

Definition at line 564 of file doctest.h.

Member Typedef Documentation

◆ size_type

Definition at line 567 of file doctest.h.

Constructor & Destructor Documentation

◆ String() [1/6]

doctest::String::String ( )
noexcept

◆ ~String()

doctest::String::~String ( )

◆ String() [2/6]

doctest::String::String ( const char *  in)

◆ String() [3/6]

doctest::String::String ( const char *  in,
size_type  in_size 
)

◆ String() [4/6]

doctest::String::String ( std::istream in,
size_type  in_size 
)

◆ String() [5/6]

doctest::String::String ( const String other)

◆ String() [6/6]

doctest::String::String ( String &&  other)
noexcept

Member Function Documentation

◆ allocate()

char* doctest::String::allocate ( size_type  sz)
private

◆ c_str() [1/2]

char* doctest::String::c_str ( )
inline

Definition at line 620 of file doctest.h.

◆ c_str() [2/2]

const char* doctest::String::c_str ( ) const
inline

Definition at line 619 of file doctest.h.

◆ capacity()

size_type doctest::String::capacity ( ) const

◆ compare() [1/2]

int doctest::String::compare ( const char *  other,
bool  no_case = false 
) const

◆ compare() [2/2]

int doctest::String::compare ( const String other,
bool  no_case = false 
) const

◆ copy()

void doctest::String::copy ( const String other)
private

◆ find()

size_type doctest::String::find ( char  ch,
size_type  pos = 0 
) const

◆ isOnStack()

bool doctest::String::isOnStack ( ) const
inlineprivatenoexcept

Definition at line 588 of file doctest.h.

◆ operator+=()

String& doctest::String::operator+= ( const String other)

◆ operator=() [1/2]

String& doctest::String::operator= ( const String other)

◆ operator=() [2/2]

String& doctest::String::operator= ( String &&  other)
noexcept

◆ operator[]() [1/2]

char& doctest::String::operator[] ( size_type  i)

◆ operator[]() [2/2]

char doctest::String::operator[] ( size_type  i) const

◆ rfind()

size_type doctest::String::rfind ( char  ch,
size_type  pos = npos 
) const

◆ setLast()

void doctest::String::setLast ( size_type  in = last)
privatenoexcept

◆ setOnHeap()

void doctest::String::setOnHeap ( )
privatenoexcept

◆ setSize()

void doctest::String::setSize ( size_type  sz)
privatenoexcept

◆ size()

size_type doctest::String::size ( ) const

◆ substr() [1/2]

String doctest::String::substr ( size_type  pos,
size_type  cnt = npos 
) &&

◆ substr() [2/2]

String doctest::String::substr ( size_type  pos,
size_type  cnt = npos 
) const &

Friends And Related Function Documentation

◆ operator<<

DOCTEST_INTERFACE std::ostream& operator<< ( std::ostream s,
const String in 
)
friend

Member Data Documentation

◆ @1

union { ... }

◆ buf

char doctest::String::buf[len]

Definition at line 582 of file doctest.h.

◆ data

view doctest::String::data

Definition at line 583 of file doctest.h.

◆ last

DOCTEST_CONSTEXPR size_type doctest::String::last = len - 1
staticprivate

OCLINT avoid private static members.

Definition at line 571 of file doctest.h.

◆ len

DOCTEST_CONSTEXPR size_type doctest::String::len = 24
staticprivate

Definition at line 570 of file doctest.h.

◆ npos

DOCTEST_CONSTEXPR size_type doctest::String::npos = static_cast<size_type>(-1)
static

Definition at line 596 of file doctest.h.


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


rosbag_fancy
Author(s):
autogenerated on Tue Feb 20 2024 03:20:59