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

Public Types

typedef const char * ConstIterator

Public Member Functions

 StringRef ()
 StringRef (const char *chars, size_t size)
 StringRef (const StringRef &other)
 StringRef (const std::string &stdStr)
 StringRef (const String &ownStr)
 StringRef (const char *cStr)
bool empty () const
const char * data () const
ConstIterator begin () const
ConstIterator end () const
size_t size () const
void reset ()
void reset (const char *chars, size_t size)
const char & operator[] (size_t index) const
const char & at (size_t index) const
template<typename NumericType>
bool toNumber (NumericType &number) const
void toString (std::string &str) const
std::string toString () const
 operator std::string () const
bool operator== (const StringRef &other) const
bool operator!= (const StringRef &other) const
StringRefoperator= (const StringRef &other)
void swap (StringRef &other)

Detailed Description

Definition at line 323 of file String.h.

Member Typedef Documentation

◆ ConstIterator

typedef const char* ConstIterator

Immutable iterator over chars.

Definition at line 327 of file String.h.

Constructor & Destructor Documentation

◆ StringRef() [1/6]

StringRef ( )
inline

Initializes blank instance.

Definition at line 330 of file String.h.

◆ StringRef() [2/6]

StringRef ( const char * chars,
size_t size )
inline

Full initialization.

Definition at line 337 of file String.h.

◆ StringRef() [3/6]

StringRef ( const StringRef & other)
inline

Initializes as clone of other instance. Data referenced by clone is not copied. Instead both instances will refer to same text segment.

Definition at line 347 of file String.h.

◆ StringRef() [4/6]

StringRef ( const std::string & stdStr)
inlineexplicit

Initializes instance from string content.

Definition at line 354 of file String.h.

◆ StringRef() [5/6]

StringRef ( const String & ownStr)
inlineexplicit

Initializes instance from string content.

Definition at line 361 of file String.h.

◆ StringRef() [6/6]

StringRef ( const char * cStr)
inlineexplicit

Initializes instance from zero-terminated string.

Definition at line 368 of file String.h.

Member Function Documentation

◆ at()

const char & at ( size_t index) const
inline

Definition at line 422 of file String.h.

◆ begin()

ConstIterator begin ( ) const
inline

STL-like begin().

Definition at line 387 of file String.h.

◆ data()

const char * data ( ) const
inline

Read-only content.

Definition at line 381 of file String.h.

◆ empty()

bool empty ( ) const
inline

Indicates whether array of zero length.

Definition at line 375 of file String.h.

◆ end()

ConstIterator end ( ) const
inline

STL-like end().

Definition at line 393 of file String.h.

◆ operator std::string()

operator std::string ( ) const
inline

Implicit conversion to std::string.

Definition at line 453 of file String.h.

◆ operator!=()

bool operator!= ( const StringRef & other) const
inline

Compares with another instance.

Definition at line 465 of file String.h.

◆ operator=()

StringRef & operator= ( const StringRef & other)
inline

Reinitializes from another instance.

Definition at line 471 of file String.h.

◆ operator==()

bool operator== ( const StringRef & other) const
inline

Compares with another instance.

Definition at line 459 of file String.h.

◆ operator[]()

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

Definition at line 417 of file String.h.

◆ reset() [1/2]

void reset ( )
inline

Resets reference to nothing.

Definition at line 405 of file String.h.

◆ reset() [2/2]

void reset ( const char * chars,
size_t size )
inline

Updates data being referenced.

Definition at line 411 of file String.h.

◆ size()

size_t size ( ) const
inline

Number of chars.

Definition at line 399 of file String.h.

◆ swap()

void swap ( StringRef & other)
inline

Swaps content with other instance.

Definition at line 480 of file String.h.

◆ toNumber()

template<typename NumericType>
bool toNumber ( NumericType & number) const
inline

Returns number if text is string representation of an integer.

Definition at line 435 of file String.h.

◆ toString() [1/2]

std::string toString ( ) const
inline

Definition at line 447 of file String.h.

◆ toString() [2/2]

void toString ( std::string & str) const
inline

Definition at line 441 of file String.h.