deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
UString Class Reference

String class to replace QString (work in progress). More...

#include <ustring.h>

Public Member Functions

 UString ()
 Constructor.
 
 UString (const char *str)
 C string constructor.
 
 UString (const UString &other)
 Copy constructor.
 
 UString (UString &&other) noexcept
 Move constructor.
 
UStringoperator= (const UString &other)
 Copy assignment operator.
 
UStringoperator= (UString &&other) noexcept
 Move assignment operator.
 
 ~UString ()
 Destructor.
 
bool operator== (const UString &) const
 
bool operator!= (const UString &rhs) const
 
bool operator== (const char *) const
 
bool operator!= (const char *rhs) const
 
const char * c_str () const
 Returns the zero terminated C-String.
 
unsigned size () const
 Returns the byte size of the string.
 
bool empty () const
 Returns true if the string is empty.
 

Static Public Member Functions

static UString number (int, int base=10)
 
static UString number (unsigned int, int base=10)
 
static UString number (long, int base=10)
 
static UString number (unsigned long, int base=10)
 
static UString number (long long, int base=10)
 
static UString number (unsigned long long, int base=10)
 
static UString number (double, char f='f', int prec=6)
 
static UString fromAtom (AT_Atom)
 Constructs a UString from an atom.
 
static UString fromAtom (AT_AtomIndex)
 Constructs a UString from an atom index.
 

Detailed Description

String class to replace QString (work in progress).

Beside the usual string functions, a UString can be constructed from an atom. This makes the strings very small, since only the atom index is stored, and fast for comparisons and copies.

See also
Atoms

Member Function Documentation

◆ c_str()

const char * UString::c_str ( ) const

Returns the zero terminated C-String.

This is always safe to use also for empty strings.

◆ fromAtom() [1/2]

UString UString::fromAtom ( AT_Atom  atom)
static

Constructs a UString from an atom.

No dynamic heap allocations are done as only the index referencing the atom is stored.

◆ fromAtom() [2/2]

UString UString::fromAtom ( AT_AtomIndex  ati)
static

Constructs a UString from an atom index.

No dynamic heap allocations are done as only the index referencing the atom is stored.

◆ size()

unsigned UString::size ( ) const

Returns the byte size of the string.

Note for multibyte UTF-8 characters the size is larger than the codepoint count.


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