C++ API Reference RNBO: RNBO::String Class Reference

RNBO: RNBO::String Class Reference

A string implementation without C++ standard library dependencies. More...

#include <RNBO_String.h>

Public Member Functions

 String ()
 Construct a new String object.
 
 String (const char *str)
 Copy-construct a new String object. More...
 
 String (String const &str)
 Copy-construct a new String object. More...
 
 ~String ()
 Destroy the String object.
 
size_t len () const
 Get the length of the String. More...
 
void clear ()
 Clear the contents of the String.
 
bool empty () const
 Get whether the String is empty. More...
 
void append (const char *astr)
 Append additional characters to the end of the String. More...
 
void append (String &astr)
 Append a String to this String. More...
 
const char * c_str () const
 Get the String's underlying null-terminated string. More...
 
Stringoperator= (const String &origin)
 Copy-assignment operator. More...
 
Stringoperator= (const char *origin)
 Copy-assignment operator. More...
 
Stringoperator+= (const String &origin)
 Addition assignment operator. More...
 
Stringoperator+= (const char *origin)
 Addition assignment operator. More...
 
bool operator== (const String &other) const
 Compare String objects for equality. More...
 
bool operator< (const String &other) const
 Compare if this String is lexicographically smaller than another. More...
 
bool operator> (const String &other) const
 Compare if this String is lexicographically larger than another. More...
 

Friends

struct StringHasher
 
String operator+ (String &str1, String &str2)
 Concatenate two String objects. More...
 

Detailed Description

A string implementation without C++ standard library dependencies.

Constructor & Destructor Documentation

◆ String() [1/2]

RNBO::String::String ( const char *  str)
inline

Copy-construct a new String object.

Parameters
stra null-terminated string

◆ String() [2/2]

RNBO::String::String ( String const &  str)
inline

Copy-construct a new String object.

Parameters
stranother String

Member Function Documentation

◆ append() [1/2]

void RNBO::String::append ( const char *  astr)
inline

Append additional characters to the end of the String.

Parameters
astra null-terminated string to append to this String

◆ append() [2/2]

void RNBO::String::append ( String astr)
inline

Append a String to this String.

Parameters
astra String to append

◆ c_str()

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

Get the String's underlying null-terminated string.

Returns
the null-terminated string

◆ empty()

bool RNBO::String::empty ( ) const
inline

Get whether the String is empty.

Returns
true if the String has length 0
false otherwise

◆ len()

size_t RNBO::String::len ( ) const
inline

Get the length of the String.

Returns
the String length

◆ operator+=() [1/2]

String& RNBO::String::operator+= ( const char *  origin)
inline

Addition assignment operator.

Append a null-terminated to this String

Parameters
originthe null-terminated string to append to this String
Returns
String&

◆ operator+=() [2/2]

String& RNBO::String::operator+= ( const String origin)
inline

Addition assignment operator.

Append a String to this String

Parameters
originthe other String to append to this String
Returns
String&

◆ operator<()

bool RNBO::String::operator< ( const String other) const
inline

Compare if this String is lexicographically smaller than another.

Parameters
otherthe String to compare with this String
Returns
true if this String is lexicographically smaller than the argument
false otherwise

◆ operator=() [1/2]

String& RNBO::String::operator= ( const char *  origin)
inline

Copy-assignment operator.

Parameters
originnull-terminated string to copy
Returns
String&

◆ operator=() [2/2]

String& RNBO::String::operator= ( const String origin)
inline

Copy-assignment operator.

Parameters
originString to copy
Returns
String&

◆ operator==()

bool RNBO::String::operator== ( const String other) const
inline

Compare String objects for equality.

Parameters
otherthe String to compare
Returns
true if the contents of this String and other are equal
false otherwise

◆ operator>()

bool RNBO::String::operator> ( const String other) const
inline

Compare if this String is lexicographically larger than another.

Parameters
otherthe String to compare with this String
Returns
true if this String is lexicographically larger than the argument
false otherwise

Friends And Related Function Documentation

◆ operator+

String operator+ ( String str1,
String str2 
)
friend

Concatenate two String objects.

Parameters
str1first String
str2second String
Returns
a new String which is the concatenation of the inputs

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