OnixS CME Drop Copy Handler C++ library 5.7.1
API documentation
Loading...
Searching...
No Matches
String Class Reference

Public Types

typedef char * iterator
typedef const char * ConstIterator

Public Member Functions

 String ()
 String (const String &other)
 String (const StringRef &strRef)
 String (const std::string &stdStr)
 String (const char *cStr)
 String (const char *text, size_t textSize)
 ~String ()
bool empty () const
size_t size () const
size_t capacity () const
const char * data () const
const char * c_str () const
iterator begin ()
ConstIterator begin () const
iterator end ()
ConstIterator end () const
char & operator[] (size_t index)
const char & operator[] (size_t index) const
char & at (size_t index)
const char & at (size_t index) const
void reserve (size_t capacity)
void resize (size_t size)
void resize (size_t size, char filler)
Stringinsert (size_t offset, const char *text, size_t textSize)
Stringappend (const char *text, size_t textSize)
Stringassign (const char *text, size_t textSize)
Stringreplace (size_t offset, size_t count, const char *text, size_t textSize)
void erase (size_t offset, size_t count)
void clear ()
 operator std::string () const
bool operator== (const String &other) const
bool operator!= (const String &other) const
Stringoperator= (const String &other)
Stringoperator= (const std::string &other)
Stringoperator= (const char *other)
Stringoperator= (char other)
Stringoperator+= (const String &text)
Stringoperator+= (const char *text)
Stringoperator+= (const std::string &text)
Stringoperator+= (char character)

Detailed Description

Definition at line 36 of file String.h.

Member Typedef Documentation

◆ ConstIterator

typedef const char* ConstIterator

Read-only access over characters.

Definition at line 43 of file String.h.

◆ iterator

typedef char* iterator

Read-write access over characters.

Definition at line 40 of file String.h.

Constructor & Destructor Documentation

◆ String() [1/6]

String ( )

Initializes empty string.

◆ String() [2/6]

String ( const String & other)

Initializes as copy of another instance.

◆ String() [3/6]

String ( const StringRef & strRef)
explicit

Initializes as copy of what is referred by StringRef instance.

◆ String() [4/6]

String ( const std::string & stdStr)
explicit

Initializes as copy of std::string instance.

◆ String() [5/6]

String ( const char * cStr)
explicit

Initializes as copy of null-terminated C string.

◆ String() [6/6]

String ( const char * text,
size_t textSize )

Initializes from sequence of give size.

◆ ~String()

~String ( )

Cleans up internal resources.

Member Function Documentation

◆ append()

String & append ( const char * text,
size_t textSize )

Appends subsequence to the end.

◆ assign()

String & assign ( const char * text,
size_t textSize )

Re-initializes instance with given string.

◆ at() [1/2]

char & at ( size_t index)
inline

Provides safe access to the character via its reference located at specified index.

Definition at line 252 of file String.h.

◆ at() [2/2]

const char & at ( size_t index) const
inline

Provides safe access to the character via its reference located at specified index.

Definition at line 262 of file String.h.

◆ begin() [1/2]

String::iterator begin ( )
inline

Points to the first element in the sequence.

Definition at line 222 of file String.h.

◆ begin() [2/2]

String::ConstIterator begin ( ) const
inline

Points to the first element in the sequence.

Definition at line 227 of file String.h.

◆ c_str()

const char * c_str ( ) const
inline

Returns string as C string.

Definition at line 217 of file String.h.

◆ capacity()

size_t capacity ( ) const
inline

Number of characters that can be put into sequence without reallocating internal store.

Definition at line 207 of file String.h.

◆ clear()

void clear ( )

Erases all characters in the string.

◆ data()

const char * data ( ) const
inline

Direct read-only access to buffer which holds the sequence.

Definition at line 212 of file String.h.

◆ empty()

bool empty ( ) const
inline

Indicates whether sequence is empty.

Definition at line 197 of file String.h.

◆ end() [1/2]

String::iterator end ( )
inline

Points to the location succeeding the last element in the sequence.

Definition at line 232 of file String.h.

◆ end() [2/2]

String::ConstIterator end ( ) const
inline

Points to the location succeeding the last element in the sequence.

Definition at line 237 of file String.h.

◆ erase()

void erase ( size_t offset,
size_t count )

Erases subsequence of specified length at specified position.

◆ insert()

String & insert ( size_t offset,
const char * text,
size_t textSize )

Inserts subsequence at specified position.

◆ operator std::string()

operator std::string ( ) const
inline

Implicit conversion to std::string type.

Definition at line 272 of file String.h.

◆ operator!=()

bool operator!= ( const String & other) const

Compares with other instance for inequality.

◆ operator+=() [1/4]

String & operator+= ( char character)
inline

Appends other string to the end.

Definition at line 317 of file String.h.

◆ operator+=() [2/4]

String & operator+= ( const char * text)
inline

Appends other string to the end.

Definition at line 302 of file String.h.

◆ operator+=() [3/4]

String & operator+= ( const std::string & text)
inline

Appends other string to the end.

Definition at line 312 of file String.h.

◆ operator+=() [4/4]

String & operator+= ( const String & text)
inline

Appends other string to the end.

Definition at line 297 of file String.h.

◆ operator=() [1/4]

String & operator= ( char other)
inline

Reinitializes instance as copy of another one.

Definition at line 292 of file String.h.

◆ operator=() [2/4]

String & operator= ( const char * other)
inline

Reinitializes instance as copy of another one.

Definition at line 282 of file String.h.

◆ operator=() [3/4]

String & operator= ( const std::string & other)
inline

Reinitializes instance as copy of another one.

Definition at line 277 of file String.h.

◆ operator=() [4/4]

String & operator= ( const String & other)

Reinitializes instance as copy of another one.

◆ operator==()

bool operator== ( const String & other) const

Compares with other instance for equality.

◆ operator[]() [1/2]

char & operator[] ( size_t index)
inline

Reference to the character located at specified index.

Note
For a performance considerations does NOT check bounds of the character being accessed.

Definition at line 242 of file String.h.

◆ operator[]() [2/2]

const char & operator[] ( size_t index) const
inline

Const reference to the character located at specified index.

Note
For a performance considerations does NOT check bounds of the character being accessed.

Definition at line 247 of file String.h.

◆ replace()

String & replace ( size_t offset,
size_t count,
const char * text,
size_t textSize )

Replaces subsequence of specified length at specified position with the new subsequence.

◆ reserve()

void reserve ( size_t capacity)

Makes internal store to be capable of storing at least specified number of characters without necessity to reallocate it.

◆ resize() [1/2]

void resize ( size_t size)

Specifies new size for the sequence, appending or erasing elements as required.

◆ resize() [2/2]

void resize ( size_t size,
char filler )

Specifies new size for the sequence, appending or erasing elements as required.

◆ size()

size_t size ( ) const
inline

Number of characters in the sequence.

Definition at line 202 of file String.h.