Raytrix Light Field SDK  5.0
Rx::CRxString Class Reference

Detailed Description

Basic character string operations.

Inherits Rx::Interop::Runtime30::IMemoryAccess.

Public Member Functions

 CRxString ()
 Default constructor. More...
 
 CRxString (const char *pcString)
 Creates a CRxString consisting of string pcString. More...
 
 CRxString (const char cChar)
 Creates a CRxString consisting of character cChar. More...
 
 CRxString (const CRxString &sxString)
 Copy constructor. More...
 
 CRxString (const Interop::Runtime30::IMemory *pSrcMem)
 Creates a CRxString consisting of pSrcMem interpreted as character array. More...
 
 CRxString (CRxString &&sxString)
 Move constructor. More...
 
 CRxString (size_t nSize)
 Creates an empty string with the given size. More...
 
virtual ~CRxString ()
 Destructor. More...
 
void Assign (const char *pcData, size_t nNumChars)
 Assigns a new value to the string, replacing its current contents. More...
 
bool Contains (const char *pcString) const
 Query if this CRxString contains the given pcString. More...
 
bool Contains (const CRxString &sxString) const
 Query if this CRxString contains the given sxString. More...
 
const char * Data () const
 Returns a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string object. More...
 
bool EndsWith (const CRxString &sxString) const
 Determines whether the end of this string instance matches the specified string. More...
 
size_t Find (const char *pcString, size_t nStartIdx=0) const
 Searches this string for the content specified in either pcString or sxString, and returns the position of the first occurrence in this string. More...
 
size_t Find (const CRxString &sxString, size_t nStartIdx=0) const
 
size_t FindFirstNotOf (const char *pcWhat, size_t nStartIdx=0, size_t nCount=CRxString::npos) const
 
size_t FindFirstOf (const char *pcWhat, size_t nStartIdx=0, size_t nCount=CRxString::npos) const
 Searches the string for the first character that matches any of the characters specified in its arguments. More...
 
size_t FindLastNotOf (const char *pcWhat, size_t nStartIdx=CRxString::npos, size_t nCount=CRxString::npos) const
 
size_t FindLastOf (const char *pcWhat, size_t nStartIdx=CRxString::npos, size_t nCount=CRxString::npos) const
 
size_t GetElementSize () const override
 Gets the size in bytes of an element of a string, which is always 1. More...
 
const void * GetPointer () const override
 Gets the pointer to memory. More...
 
bool IsValid () const override
 Query if this object is valid. More...
 
size_t Length () const override
 Gets the length of this CRxString. This is the number of characters. More...
 
bool operator!= (const char *pcString) const
 Inequality operator. More...
 
bool operator!= (const CRxString &sxString) const
 Inequality operator. More...
 
CRxStringoperator+= (const char *pcString)
 Appends the given string to this CRxString. More...
 
CRxStringoperator+= (const CRxString &sxString)
 Appends the given string to this CRxString. More...
 
CRxStringoperator+= (double dValue)
 Appends the given double to this CRxString. More...
 
CRxStringoperator+= (float fValue)
 Appends the given float to this CRxString. More...
 
CRxStringoperator+= (int iValue)
 Appends the given integer to this CRxString. More...
 
CRxStringoperator+= (int64_t iValue)
 Appends the given integer to this CRxString. More...
 
CRxStringoperator+= (uint32_t uValue)
 Appends the given unsigned integer to this CRxString. More...
 
CRxStringoperator+= (uint64_t nValue)
 Addition assignment operator. More...
 
bool operator< (const CRxString &sxString) const
 Less-than comparison operator. More...
 
CRxStringoperator<< (const char *pcString)
 Appends the given string to this CRxString. More...
 
CRxStringoperator<< (const CRxString &sxString)
 Appends the given string to this CRxString. More...
 
CRxStringoperator<< (CRxStringPrecision &xPrecision)
 
CRxStringoperator<< (double dValue)
 Appends the given double to this CRxString. More...
 
CRxStringoperator<< (float fValue)
 Appends the given float to this CRxString. More...
 
CRxStringoperator<< (int32_t uValue)
 Appends the given unsigned integer to this CRxString. More...
 
CRxStringoperator<< (int64_t iValue)
 Appends the given __int64 element to the string. More...
 
CRxStringoperator<< (NUMBER_PRESENTAION::ID ePresentation)
 
CRxStringoperator<< (uint32_t nValue)
 Appends the given size_t element to the string. More...
 
CRxStringoperator<< (uint64_t nValue)
 Appends the given size_t element to the string. More...
 
CRxStringoperator= (const char *pcString)
 Assignment operator. More...
 
CRxStringoperator= (const char cChar)
 Assignment operator. More...
 
CRxStringoperator= (const CRxString &sxString)
 Assignment operator. More...
 
CRxStringoperator= (const Interop::Runtime30::IMemoryAccess *pSrcMem)
 Assignment operator. More...
 
CRxStringoperator= (CRxString &&sxString)
 Move assignment operator. More...
 
bool operator== (const char *pcString) const
 Equality operator. More...
 
bool operator== (const CRxString &sxString) const
 Equality operator. More...
 
char operator[] (size_t nIndex) const
 Gets the nIndex-th character from string. More...
 
CRxString Replace (const char *pcOld, const char *pcNew) const
 Replaces all occurrences of pcOld by pcNew and returns the resulting CRxString. More...
 
void SplitFilename (CRxString &sxDirectory, CRxString &sxName, CRxString &sxExtension) const
 Assumes that this CRxString represents a file name and splits it in path, name and extension. More...
 
bool StartsWith (const CRxString &sxString) const
 Determines whether the start of this string instance matches the specified string. More...
 
CRxString SubStr (size_t nStartIdx, size_t nCount=CRxString::npos) const
 Returns a newly constructed CRxString object with its value initialized to a copy of a substring of this object. More...
 
const char * ToCString () const
 Converts this CRxString to a c string. More...
 
double ToDoubleFromHex () const
 Converts this hexadecimal string with 16 chars to a 8 byte double variable. More...
 
int ToInt () const
 Converts this CRxString to an int. More...
 
int64_t ToInt64FromHex () const
 Converts this hexadecimal string to a 64-bit integer value. More...
 
unsigned ToUInt () const
 Converts this CRxString to an unsigned int. More...
 
uint64_t ToUInt64 () const
 Converts this CRxString to a 64-bit unsigned int. More...
 
uint64_t ToUInt64FromHex () const
 Converts this hexadecimal string to a 64-bit unsigned value. More...
 
unsigned ToUIntFromHex () const
 Converts this hexadecimal string to an unsigned value. More...
 

Static Public Member Functions

static CRxString ToHexString (double dVal)
 Convert a 8 byte double variable into a hexadecimal string representation with 16 chars. More...
 

Static Public Attributes

static const size_t npos
 npos is a static member constant value with the greatest possible value for an element of type size_t. More...
 

Constructor & Destructor Documentation

◆ CRxString() [1/7]

Rx::CRxString::CRxString ( )

Default constructor.

◆ CRxString() [2/7]

Rx::CRxString::CRxString ( size_t  nSize)

Creates an empty string with the given size.

Parameters
nSizeThe size in bytes.

◆ CRxString() [3/7]

Rx::CRxString::CRxString ( const char  cChar)

Creates a CRxString consisting of character cChar.

Parameters
cCharThe character.

◆ CRxString() [4/7]

Rx::CRxString::CRxString ( const char *  pcString)

Creates a CRxString consisting of string pcString.

Parameters
pcStringThe string.

◆ CRxString() [5/7]

Rx::CRxString::CRxString ( const CRxString sxString)

Copy constructor.

Parameters
sxStringThe Raytrix string.

◆ CRxString() [6/7]

Rx::CRxString::CRxString ( CRxString &&  sxString)

Move constructor.

Parameters
sxString[in,out] The Raytrix string. Is invalid after this call.

◆ CRxString() [7/7]

Rx::CRxString::CRxString ( const Interop::Runtime30::IMemory pSrcMem)

Creates a CRxString consisting of pSrcMem interpreted as character array.

Parameters
pSrcMemSource memory.

◆ ~CRxString()

virtual Rx::CRxString::~CRxString ( )
virtual

Destructor.

Member Function Documentation

◆ Assign()

void Rx::CRxString::Assign ( const char *  pcData,
size_t  nNumChars 
)

Assigns a new value to the string, replacing its current contents.

Copies the first nNumChars characters from the array of characters pointed by pcData.

Parameters
pcDataPointer to an array of characters.
nNumCharsNumber of characters to copy.

◆ Contains() [1/2]

bool Rx::CRxString::Contains ( const char *  pcString) const

Query if this CRxString contains the given pcString.

Parameters
pcStringThe string to test for containment.
Returns
true if this string contains the given pcString, false if not.

◆ Contains() [2/2]

bool Rx::CRxString::Contains ( const CRxString sxString) const

Query if this CRxString contains the given sxString.

Parameters
sxStringThe CRxString to test for containment.
Returns
True if this string contains the given sString, false if not.

◆ Data()

const char* Rx::CRxString::Data ( ) const

Returns a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string object.

This array includes the same sequence of characters that make up the value of the string object plus an additional terminating null-character ('\0') at the end.

The pointer returned points to the internal array currently used by the string object to store the characters that conform its value.

Returns
A pointer to the c-string representation of the string object's value.

◆ EndsWith()

bool Rx::CRxString::EndsWith ( const CRxString sxString) const

Determines whether the end of this string instance matches the specified string.

Parameters
sxStringThe string to compare to the substring at the end of this instance.
Returns
True if value matches the end of this instance; otherwise, false.

◆ Find() [1/2]

size_t Rx::CRxString::Find ( const char *  pcString,
size_t  nStartIdx = 0 
) const

Searches this string for the content specified in either pcString or sxString, and returns the position of the first occurrence in this string.

When nStartIdx is specified the search only includes characters on or after position nStartIdx, ignoring any possible occurrences in previous locations.

Parameters
pcStringString to be searched for in this string. The entire content of str must be matched in some part of the string to be considered a match.
nStartIdx(optional) Position of the first character in the string to be taken into consideration for possible matches. A value of 0 means that the entire string is considered.
Returns
The position of the first occurrence in the string of the searched content. If the content is not found, the member value CRxString::npos is returned.

◆ Find() [2/2]

size_t Rx::CRxString::Find ( const CRxString sxString,
size_t  nStartIdx = 0 
) const

◆ FindFirstNotOf()

size_t Rx::CRxString::FindFirstNotOf ( const char *  pcWhat,
size_t  nStartIdx = 0,
size_t  nCount = CRxString::npos 
) const

◆ FindFirstOf()

size_t Rx::CRxString::FindFirstOf ( const char *  pcWhat,
size_t  nStartIdx = 0,
size_t  nCount = CRxString::npos 
) const

Searches the string for the first character that matches any of the characters specified in its arguments.

When nCount is specified, the search only includes characters at or after position nCount, ignoring any possible occurrences before nCount.

Parameters
pcWhatString containing the characters to search for in this string.
nStartIdx(optional) Position of the first character in the string to be taken into consideration for possible matches.
nCount(optional) Length of sequence of characters to search for.
Returns
The position of the first occurrence in the string of any of the characters searched for. If the content is not found, the member value CRxString::npos is returned.

◆ FindLastNotOf()

size_t Rx::CRxString::FindLastNotOf ( const char *  pcWhat,
size_t  nStartIdx = CRxString::npos,
size_t  nCount = CRxString::npos 
) const

◆ FindLastOf()

size_t Rx::CRxString::FindLastOf ( const char *  pcWhat,
size_t  nStartIdx = CRxString::npos,
size_t  nCount = CRxString::npos 
) const

◆ GetElementSize()

size_t Rx::CRxString::GetElementSize ( ) const
overridevirtual

Gets the size in bytes of an element of a string, which is always 1.

Returns
The element size.

Implements Rx::Interop::Runtime30::IMemoryAccess.

◆ GetPointer()

const void* Rx::CRxString::GetPointer ( ) const
overridevirtual

Gets the pointer to memory.

Returns
The pointer to memory.

Implements Rx::Interop::Runtime30::IMemoryAccess.

◆ IsValid()

bool Rx::CRxString::IsValid ( ) const
overridevirtual

Query if this object is valid.

Returns
True if valid, false if not.

Implements Rx::Interop::Runtime30::IMemoryAccess.

◆ Length()

size_t Rx::CRxString::Length ( ) const
overridevirtual

Gets the length of this CRxString. This is the number of characters.

Returns
The length of this CRxString.

Implements Rx::Interop::Runtime30::IMemoryAccess.

◆ operator!=() [1/2]

bool Rx::CRxString::operator!= ( const char *  pcString) const

Inequality operator.

Parameters
pcStringThe string.
Returns
True if the parameters are not considered equivalent.

◆ operator!=() [2/2]

bool Rx::CRxString::operator!= ( const CRxString sxString) const

Inequality operator.

Parameters
sxStringThe string.
Returns
True if the parameters are not considered equivalent.

◆ operator+=() [1/8]

CRxString& Rx::CRxString::operator+= ( const char *  pcString)

Appends the given string to this CRxString.

Parameters
pcStringThe string.
Returns
The concatenation of this CRxString with pcString.

◆ operator+=() [2/8]

CRxString& Rx::CRxString::operator+= ( const CRxString sxString)

Appends the given string to this CRxString.

Parameters
sxStringThe string.
Returns
The concatenation of this CRxString with sxString.

◆ operator+=() [3/8]

CRxString& Rx::CRxString::operator+= ( double  dValue)

Appends the given double to this CRxString.

Parameters
dValueThe double.
Returns
The concatenation of this CRxString with dValue.

◆ operator+=() [4/8]

CRxString& Rx::CRxString::operator+= ( float  fValue)

Appends the given float to this CRxString.

Parameters
fValueThe float.
Returns
The concatenation of this CRxString with fValue.

◆ operator+=() [5/8]

CRxString& Rx::CRxString::operator+= ( int  iValue)

Appends the given integer to this CRxString.

Parameters
iValueThe integer.
Returns
The concatenation of this CRxString with iValue.

◆ operator+=() [6/8]

CRxString& Rx::CRxString::operator+= ( int64_t  iValue)

Appends the given integer to this CRxString.

Parameters
iValueThe integer.
Returns
The concatenation of this CRxString with iValue.

◆ operator+=() [7/8]

CRxString& Rx::CRxString::operator+= ( uint32_t  uValue)

Appends the given unsigned integer to this CRxString.

Parameters
uValueThe unsigned integer.
Returns
The concatenation of this CRxString with uValue.

◆ operator+=() [8/8]

CRxString& Rx::CRxString::operator+= ( uint64_t  nValue)

Addition assignment operator.

Parameters
nValueThe unsigned __int64 value.
Returns
The concatenation of this CRxString with nValue.

◆ operator<()

bool Rx::CRxString::operator< ( const CRxString sxString) const

Less-than comparison operator.

Parameters
sxStringThe string to compare with.
Returns
True if the first parameter is less than the second.

◆ operator<<() [1/10]

CRxString& Rx::CRxString::operator<< ( const char *  pcString)

Appends the given string to this CRxString.

Parameters
pcStringThe string.
Returns
The concatenation of this CRxString with pcString.

◆ operator<<() [2/10]

CRxString& Rx::CRxString::operator<< ( const CRxString sxString)

Appends the given string to this CRxString.

Parameters
sxStringThe string.
Returns
The concatenation of this CRxString with sxString.

◆ operator<<() [3/10]

CRxString& Rx::CRxString::operator<< ( CRxStringPrecision xPrecision)

◆ operator<<() [4/10]

CRxString& Rx::CRxString::operator<< ( double  dValue)

Appends the given double to this CRxString.

Parameters
dValueThe double.
Returns
The concatenation of this CRxString with dValue.

◆ operator<<() [5/10]

CRxString& Rx::CRxString::operator<< ( float  fValue)

Appends the given float to this CRxString.

Parameters
fValueThe float.
Returns
The concatenation of this CRxString with fValue.

◆ operator<<() [6/10]

CRxString& Rx::CRxString::operator<< ( int32_t  uValue)

Appends the given unsigned integer to this CRxString.

Parameters
uValueThe unsigned integer.
Returns
The concatenation of this CRxString with uValue.

◆ operator<<() [7/10]

CRxString& Rx::CRxString::operator<< ( int64_t  iValue)

Appends the given __int64 element to the string.

Parameters
iValueThe value.
Returns
This string object.

◆ operator<<() [8/10]

CRxString& Rx::CRxString::operator<< ( NUMBER_PRESENTAION::ID  ePresentation)

◆ operator<<() [9/10]

CRxString& Rx::CRxString::operator<< ( uint32_t  nValue)

Appends the given size_t element to the string.

Parameters
nValueThe value.
Returns
This string object.

◆ operator<<() [10/10]

CRxString& Rx::CRxString::operator<< ( uint64_t  nValue)

Appends the given size_t element to the string.

Parameters
nValueThe value.
Returns
This string object.

◆ operator=() [1/5]

CRxString& Rx::CRxString::operator= ( const char *  pcString)

Assignment operator.

Parameters
pcStringThe string.
Returns
A CRxString consisting of string pcString.

◆ operator=() [2/5]

CRxString& Rx::CRxString::operator= ( const char  cChar)

Assignment operator.

Parameters
cCharThe character.
Returns
A CRxString consisting of character cChar.

◆ operator=() [3/5]

CRxString& Rx::CRxString::operator= ( const CRxString sxString)

Assignment operator.

Parameters
sxStringThe Raytrix string.
Returns
A CRxString consisting of Raytrix string sxString.

◆ operator=() [4/5]

CRxString& Rx::CRxString::operator= ( const Interop::Runtime30::IMemoryAccess pSrcMem)

Assignment operator.

Parameters
pSrcMemSource memory.
Returns
A CRxString consisting of pSrcMem interpreted as character array.

◆ operator=() [5/5]

CRxString& Rx::CRxString::operator= ( CRxString &&  sxString)

Move assignment operator.

Parameters
sxString[in,out] The Raytrix string. Is invalid after this call.
Returns
A shallow copy of this object.

◆ operator==() [1/2]

bool Rx::CRxString::operator== ( const char *  pcString) const

Equality operator.

Parameters
pcStringThe string.
Returns
True if the parameters are considered equivalent.

◆ operator==() [2/2]

bool Rx::CRxString::operator== ( const CRxString sxString) const

Equality operator.

Parameters
sxStringThe string.
Returns
True if the parameters are considered equivalent.

◆ operator[]()

char Rx::CRxString::operator[] ( size_t  nIndex) const

Gets the nIndex-th character from string.

Parameters
nIndexThe index.
Returns
The indexed character.

◆ Replace()

CRxString Rx::CRxString::Replace ( const char *  pcOld,
const char *  pcNew 
) const

Replaces all occurrences of pcOld by pcNew and returns the resulting CRxString.

Parameters
pcOldString which should be replaced.
pcNewThis string is used as the replacement.
Returns
The replaced CRxString.

◆ SplitFilename()

void Rx::CRxString::SplitFilename ( CRxString sxDirectory,
CRxString sxName,
CRxString sxExtension 
) const

Assumes that this CRxString represents a file name and splits it in path, name and extension.

Parameters
sxDirectory[out] The directory path.
sxName[out] Name of file without extension.
sxExtension[out] Extension of file.

◆ StartsWith()

bool Rx::CRxString::StartsWith ( const CRxString sxString) const

Determines whether the start of this string instance matches the specified string.

Parameters
sxStringThe string to compare to the substring at the start of this instance.
Returns
True if value matches the start of this instance; otherwise, false.

◆ SubStr()

CRxString Rx::CRxString::SubStr ( size_t  nStartIdx,
size_t  nCount = CRxString::npos 
) const

Returns a newly constructed CRxString object with its value initialized to a copy of a substring of this object.

The substring is the portion of the object that starts at character position nStartIdx and spans nCount characters (or until the end of the string, whichever comes first).

Parameters
nStartIdxPosition of the first character to be copied as a substring. If this is equal to the string length, the function returns an empty string.
nCount(Optional) Number of characters to include in the substring (if the string is shorter, as many characters as possible are used). A value of -1 indicates all characters until the end of the string.
Returns
A string object with a substring of this object.

◆ ToCString()

const char* Rx::CRxString::ToCString ( ) const

Converts this CRxString to a c string.

Returns
This CRxString as a const char*.

◆ ToDoubleFromHex()

double Rx::CRxString::ToDoubleFromHex ( ) const

Converts this hexadecimal string with 16 chars to a 8 byte double variable.

Returns
The double value.

◆ ToHexString()

static CRxString Rx::CRxString::ToHexString ( double  dVal)
static

Convert a 8 byte double variable into a hexadecimal string representation with 16 chars.

Parameters
dValThe double value.
Returns
The hexadecimal string.

◆ ToInt()

int Rx::CRxString::ToInt ( ) const

Converts this CRxString to an int.

Returns
This CRxString as an int.

◆ ToInt64FromHex()

int64_t Rx::CRxString::ToInt64FromHex ( ) const

Converts this hexadecimal string to a 64-bit integer value.

Returns
The 64-bit integer value.

◆ ToUInt()

unsigned Rx::CRxString::ToUInt ( ) const

Converts this CRxString to an unsigned int.

Returns
This CRxString as an unsigned int.

◆ ToUInt64()

uint64_t Rx::CRxString::ToUInt64 ( ) const

Converts this CRxString to a 64-bit unsigned int.

Returns
This CRxString as a 64-bit unsigned int.

◆ ToUInt64FromHex()

uint64_t Rx::CRxString::ToUInt64FromHex ( ) const

Converts this hexadecimal string to a 64-bit unsigned value.

Returns
The 64-bit unsigned value.

◆ ToUIntFromHex()

unsigned Rx::CRxString::ToUIntFromHex ( ) const

Converts this hexadecimal string to an unsigned value.

Returns
The unsigned value.

Member Data Documentation

◆ npos

const size_t Rx::CRxString::npos
static

npos is a static member constant value with the greatest possible value for an element of type size_t.

This value, when used as the value for a length parameter in string's member functions, means "until the end of the string".

As a return value, it is usually used to indicate no matches.

This constant is defined with a value of -1, which because size_t is an unsigned integral type, it is the largest possible representable value for this type.