LightsprintSDK 2021.08.08
rr::RRString Class Reference

#include <RRMemory.h>

Inheritance diagram for rr::RRString:
rr::RRUniformlyAllocated

Public Member Functions

 RRString ()
 
 RRString (const RRString &a)
 
 RRString (const char *a)
 
 RRString (const wchar_t *a)
 
 RRString (unsigned zero, const wchar_t *fmt,...)
 
RRStringoperator= (const RRString &a)
 
RRStringoperator= (const char *a)
 
RRStringoperator= (const wchar_t *a)
 
void clear ()
 
void format (const wchar_t *fmt,...)
 
bool operator== (const RRString &a) const
 
bool operator== (const char *a) const
 
bool operator== (const wchar_t *a) const
 
bool operator!= (const RRString &a) const
 
bool operator!= (const char *a) const
 
bool operator!= (const wchar_t *a) const
 
const char * c_str () const
 
const wchar_t * w_str () const
 
bool empty () const
 
 ~RRString ()
 
void _skipDestructor ()
 
- Public Member Functions inherited from rr::RRUniformlyAllocated
void * operator new (std::size_t n)
 
void * operator new[] (std::size_t n)
 
void operator delete (void *p, std::size_t n)
 
void operator delete[] (void *p, std::size_t n)
 

Detailed Description

Minimalistic string, for portable API.

RRString is intentionally minimalistic, for passing data, not for manipulation. Its only purpose is to replace std::[w]string in public Lightsprint headers, to make SDK compatible with any STL implementation.

Encoding:

  • char* is always null terminated string in local charset
  • wchar_t* is always null terminated string in UTF16 (windows) or UTF32 (mac, linux)

RRString implicitly converts from and explicitly to char* and wchar_t*. Conversions from/to third party string types are explicit, using RR_* macros.

Constructor & Destructor Documentation

◆ RRString() [1/5]

rr::RRString::RRString ( )

◆ RRString() [2/5]

rr::RRString::RRString ( const RRString a)

◆ RRString() [3/5]

rr::RRString::RRString ( const char *  a)

◆ RRString() [4/5]

rr::RRString::RRString ( const wchar_t *  a)

◆ RRString() [5/5]

rr::RRString::RRString ( unsigned  zero,
const wchar_t *  fmt,
  ... 
)

Initializes string using wprintf() like syntax (s for wide string, hs for singlebyte). First parameter is reserved and should be always zero.

◆ ~RRString()

rr::RRString::~RRString ( )

Member Function Documentation

◆ operator=() [1/3]

RRString & rr::RRString::operator= ( const RRString a)

◆ operator=() [2/3]

RRString & rr::RRString::operator= ( const char *  a)

◆ operator=() [3/3]

RRString & rr::RRString::operator= ( const wchar_t *  a)

◆ clear()

void rr::RRString::clear ( )

◆ format()

void rr::RRString::format ( const wchar_t *  fmt,
  ... 
)

Sets new string value using wprintf() like syntax (s for wide string, hs for singlebyte).

◆ operator==() [1/3]

bool rr::RRString::operator== ( const RRString a) const

◆ operator==() [2/3]

bool rr::RRString::operator== ( const char *  a) const

◆ operator==() [3/3]

bool rr::RRString::operator== ( const wchar_t *  a) const

◆ operator!=() [1/3]

bool rr::RRString::operator!= ( const RRString a) const

◆ operator!=() [2/3]

bool rr::RRString::operator!= ( const char *  a) const

◆ operator!=() [3/3]

bool rr::RRString::operator!= ( const wchar_t *  a) const

◆ c_str()

const char * rr::RRString::c_str ( ) const
inline

String in local charset. Unrepresentable characters are replaced by ?. Never returns nullptr, empty string is "".

◆ w_str()

const wchar_t * rr::RRString::w_str ( ) const
inline

String in utf16 or utf32. Never returns nullptr, empty string is L"".

◆ empty()

bool rr::RRString::empty ( ) const
inline

◆ _skipDestructor()

void rr::RRString::_skipDestructor ( )

For internal use only.