/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013 Raytrix GmbH. All rights reserved.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

#include <cstdint>

#include "RxCore.h"
#include "Rx.Interop.Runtime30/IMemory.h"

/// <summary> Defines a prefix for a quoted string to convert it to CRxString. RX_S "This is a CRxString". </summary>
#define RX_S Rx::CRxString("") <<

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// namespace: Rx
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rx
{
	namespace NUMBER_PRESENTAION
	{
		enum ID
		{
			BINARY = 0,
			OCTAL,
			DECIMAL,
			HEX
		};
	}

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/// <summary>
	/// 	Raytrix string format precision.
	/// </summary>
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	class CRxStringFormatPrecision
	{
	public:

		CRxStringFormatPrecision(unsigned int uPrecision) { m_uPrecision = uPrecision; }
		unsigned int GetPrecision() const { return m_uPrecision; }

	private:

		unsigned int m_uPrecision;
	};

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/// <summary>
	/// 	Basic character string operations.
	/// </summary>
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	class RXCORE_API CRxString : public Interop::Runtime30::IMemoryAccess
	{
	public:

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	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.
		/// </summary>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		static const size_t npos = size_t(-1);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Default constructor.
		/// </summary>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString();

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Creates a CRxString consisting of character cChar.
		/// </summary>
		///
		/// <param name="cChar"> The character. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString(const char cChar);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Creates a CRxString consisting of string pcString.
		/// </summary>
		///
		/// <param name="pcString"> The string. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString(const char* pcString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Copy constructor.
		/// </summary>
		///
		/// <param name="sxString"> The Raytrix string. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString(const CRxString& sxString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Move constructor.
		/// </summary>
		///
		/// <param name="sxString"> [in,out] The Raytrix string. Is invalid after this call. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString(CRxString&& sxString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Creates a CRxString consisting of pSrcMem interpreted as character array.
		/// </summary>
		///
		/// <param name="pSrcMem"> Source memory. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString(const Interop::Runtime30::IMemory* pSrcMem);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Destructor.
		/// </summary>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		virtual ~CRxString();

	public:

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Assignment operator.
		/// </summary>
		///
		/// <param name="cChar"> The character. </param>
		///
		/// <returns> A CRxString consisting of character cChar. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator=(const char cChar);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Assignment operator.
		/// </summary>
		///
		/// <param name="pcString"> The string. </param>
		///
		/// <returns> A CRxString consisting of string pcString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator=(const char* pcString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Assignment operator.
		/// </summary>
		///
		/// <param name="sxString"> The Raytrix string. </param>
		///
		/// <returns> A CRxString consisting of Raytrix string sxString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator=(const CRxString& sxString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Move assignment operator.
		/// </summary>
		///
		/// <param name="sxString"> [in,out] The Raytrix string. Is invalid after this call. </param>
		///
		/// <returns> A shallow copy of this object. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator=(CRxString&& sxString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Assignment operator.
		/// </summary>
		///
		/// <param name="pSrcMem"> Source memory. </param>
		///
		/// <returns> A CRxString consisting of pSrcMem interpreted as character array. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator=(const Interop::Runtime30::IMemoryAccess* pSrcMem);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Equality operator.
		/// </summary>
		///
		/// <param name="pcString"> The string. </param>
		///
		/// <returns> True if the parameters are considered equivalent. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator==(const char* pcString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Equality operator.
		/// </summary>
		///
		/// <param name="sxString"> The string. </param>
		///
		/// <returns> True if the parameters are considered equivalent. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator==(const CRxString& sxString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Inequality operator.
		/// </summary>
		///
		/// <param name="pcString"> The string. </param>
		///
		/// <returns> True if the parameters are not considered equivalent. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator!=(const char* pcString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Inequality operator.
		/// </summary>
		///
		/// <param name="sxString"> The string. </param>
		///
		/// <returns> True if the parameters are not considered equivalent. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator!=(const CRxString& sxString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given string to this CRxString.
		/// </summary>
		///
		/// <param name="pcString"> The string. </param>
		///
		/// <returns> The concatenation of this CRxString with pcString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(const char* pcString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given string to this CRxString.
		/// </summary>
		///
		/// <param name="sxString"> The string. </param>
		///
		/// <returns> The concatenation of this CRxString with sxString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(const CRxString& sxString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given integer to this CRxString.
		/// </summary>
		///
		/// <param name="iValue"> The integer. </param>
		///
		/// <returns> The concatenation of this CRxString with iValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(int iValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given integer to this CRxString.
		/// </summary>
		///
		/// <param name="iValue"> The integer. </param>
		///
		/// <returns> The concatenation of this CRxString with iValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(int64_t iValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given unsigned integer to this CRxString.
		/// </summary>
		///
		/// <param name="uValue"> The unsigned integer. </param>
		///
		/// <returns> The concatenation of this CRxString with uValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(uint32_t uValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Addition assignment operator.
		/// </summary>
		///
		/// <param name="nValue"> The unsigned __int64 value. </param>
		///
		/// <returns> The concatenation of this CRxString with nValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(uint64_t nValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given float to this CRxString.
		/// </summary>
		///
		/// <param name="fValue"> The float. </param>
		///
		/// <returns> The concatenation of this CRxString with fValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(float fValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given double to this CRxString.
		/// </summary>
		///
		/// <param name="dValue"> The double. </param>
		///
		/// <returns> The concatenation of this CRxString with dValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator+=(double dValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given string to this CRxString.
		/// </summary>
		///
		/// <param name="pcString"> The string. </param>
		///
		/// <returns> The concatenation of this CRxString with pcString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(const char* pcString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given string to this CRxString.
		/// </summary>
		///
		/// <param name="sxString"> The string. </param>
		///
		/// <returns> The concatenation of this CRxString with sxString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(const CRxString& sxString);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given __int64 element to the string.
		/// </summary>
		///
		/// <param name="iValue"> The value. </param>
		///
		/// <returns> This string object. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(int64_t iValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given unsigned integer to this CRxString.
		/// </summary>
		///
		/// <param name="uValue"> The unsigned integer. </param>
		///
		/// <returns> The concatenation of this CRxString with uValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(int32_t uValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given size_t element to the string.
		/// </summary>
		///
		/// <param name="nValue"> The value. </param>
		///
		/// <returns> This string object. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(uint64_t nValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given size_t element to the string.
		/// </summary>
		///
		/// <param name="nValue"> The value. </param>
		///
		/// <returns> This string object. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(uint32_t nValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given float to this CRxString.
		/// </summary>
		///
		/// <param name="fValue"> The float. </param>
		///
		/// <returns> The concatenation of this CRxString with fValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(float fValue);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Appends the given double to this CRxString.
		/// </summary>
		///
		/// <param name="dValue"> The double. </param>
		///
		/// <returns> The concatenation of this CRxString with dValue. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString& operator<<(double dValue);

		CRxString& operator<<(CRxStringFormatPrecision& xPrecision);
		CRxString& operator<<(NUMBER_PRESENTAION::ID ePresentation);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Gets the nIndex-th character from string.
		/// </summary>
		///
		/// <param name="nIndex"> The index. </param>
		///
		/// <returns> The indexed character. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		char operator[](size_t nIndex) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Less-than comparison operator.
		/// </summary>
		///
		/// <param name="sxString"> The string to compare with. </param>
		///
		/// <returns> True if the first parameter is less than the second. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool operator<(const CRxString& sxString) const;

	public:

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Gets the size in bytes of an element of a string, which is always 1.
		/// </summary>
		///
		/// <returns> The element size. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		virtual size_t GetElementSize() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Gets the length of this CRxString. This is the number of characters.
		/// </summary>
		///
		/// <returns> The length of this CRxString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		virtual size_t Length() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Gets the pointer to memory.
		/// </summary>
		///
		/// <returns> The pointer to memory. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		virtual const void* GetPointer() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Query if this object is valid.
		/// </summary>
		///
		/// <returns> True if valid, false if not. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		virtual bool IsValid() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Converts this CRxString to a c string.
		/// </summary>
		///
		/// <returns> This CRxString as a const char*. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		const char* ToCString() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Converts this CRxString to an int.
		/// </summary>
		///
		/// <returns> This CRxString as an int. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		int ToInt() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Converts this CRxString to an unsigned int.
		/// </summary>
		///
		/// <returns> This CRxString as an unsigned int. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		unsigned ToUInt() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Convert a 8 byte double variable into a hexadecimal string representation with 16 chars.
		/// </summary>
		///
		/// <param name="dVal"> The double value. </param>
		///
		/// <returns> The hexadecimal string. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		static CRxString ToHexString(double dVal);

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Converts this hexadecimal string with 16 chars to a 8 byte double variable.
		/// </summary>
		///
		/// <returns> The double value. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		double ToDoubleFromHex() const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	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).
		/// </summary>
		///
		/// <param name="nStartIdx"> Position of the first character to be copied as a substring. If this is equal to the string length,
		/// 						 the function returns an empty string. </param>
		/// <param name="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. </param>
		///
		/// <returns> A string object with a substring of this object. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString SubStr(size_t nStartIdx, size_t nCount = CRxString::npos) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Searches the string for the first character that matches any of the characters specified in its arguments.
		/// </summary>
		///
		/// <remarks>
		/// 	When nCount is specified, the search only includes characters at or after position nCount, ignoring any possible
		/// 	occurrences before nCount.
		/// </remarks>
		///
		/// <param name="pcWhat">    String containing the characters to search for in this string. </param>
		/// <param name="nStartIdx"> (optional) Position of the first character in the string to be taken into consideration for
		/// 						 possible matches. </param>
		/// <param name="nCount">    (optional) Length of sequence of characters to search for. </param>
		///
		/// <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.
		/// </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		size_t FindFirstOf(const char* pcWhat, size_t nStartIdx = 0, size_t nCount = CRxString::npos) const;
		size_t FindFirstNotOf(const char* pcWhat, size_t nStartIdx = 0, 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 FindLastNotOf(const char* pcWhat, size_t nStartIdx = CRxString::npos, size_t nCount = CRxString::npos) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Searches this string for the content specified in either pcString or sxString, and returns the position of the first
		/// 	occurrence in this string.
		/// </summary>
		///
		/// <remarks>
		/// 	When nStartIdx is specified the search only includes characters on or after position nStartIdx, ignoring any possible
		/// 	occurrences in previous locations.
		/// </remarks>
		///
		/// <param name="pcString">  String 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. </param>
		/// <param name="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. </param>
		///
		/// <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.
		/// </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		size_t Find(const char* pcString, size_t nStartIdx = 0) const;
		size_t Find(const CRxString& sxString, size_t nStartIdx = 0) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Query if this CRxString contains the given pcString.
		/// </summary>
		///
		/// <param name="pcString"> The string to test for containment. </param>
		///
		/// <returns> true if this string contains the given pcString, false if not. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool Contains(const char* pcString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Query if this CRxString contains the given sxString.
		/// </summary>
		///
		/// <param name="sxString"> The CRxString to test for containment. </param>
		///
		/// <returns> True if this string contains the given sString, false if not. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool Contains(const CRxString& sxString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Determines whether the end of this string instance matches the specified string.
		/// </summary>
		///
		/// <param name="sxString"> The string to compare to the substring at the end of this instance. </param>
		///
		/// <returns> True if value matches the end of this instance; otherwise, false. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		bool EndsWith(const CRxString& sxString) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Replaces all occurrences of pcOld by pcNew and returns the resulting CRxString.
		/// </summary>
		///
		/// <param name="pcOld"> String which should be replaced. </param>
		/// <param name="pcNew"> This string is used as the replacement. </param>
		///
		/// <returns> The replaced CRxString. </returns>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		CRxString Replace(const char* pcOld, const char* pcNew) const;

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Assigns a new value to the string, replacing its current contents.
		///
		/// 	Copies the first nNumChars characters from the array of characters pointed by pcData.
		/// </summary>
		///
		/// <param name="pcData">    Pointer to an array of characters. </param>
		/// <param name="nNumChars"> Number of characters to copy. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		void Assign(const char* pcData, size_t nNumChars);

	public:

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Assumes that this CRxString represents a file name and splits it in path, name and extension.
		/// </summary>
		///
		/// <param name="sxDirectory"> [out] The directory path. </param>
		/// <param name="sxName">	   [out] Name of file without extension. </param>
		/// <param name="sxExtension"> [out] Extension of file. </param>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		void SplitFilename(CRxString& sxDirectory, CRxString& sxName, CRxString& sxExtension) const;

	private:

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Initializes this object. Creates both pointer.
		/// </summary>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		void _Init();

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	Finalizes this object. Frees both pointer.
		/// </summary>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		void _Finalize();

		void* m_pvString;
		void* m_pvFormater;
	};

	RXCORE_API CRxString operator+(const CRxString& sxA, const CRxString& sxB);
	RXCORE_API CRxString operator+(const CRxString& sxA, const char* pcB);
	RXCORE_API CRxString operator+(const char* pcA, const CRxString& sxB);

	RXCORE_API CRxString operator+(const CRxString& sxA, int iVal);
	RXCORE_API CRxString operator+(const CRxString& sxA, unsigned int uVal);
	RXCORE_API CRxString operator+(const CRxString& sxA, float fVal);
	RXCORE_API CRxString operator+(const CRxString& sxA, double dVal);

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/// <summary>
	/// 	Converts the given string into an integer value.
	/// </summary>
	///
	/// <param name="sxString"> [in] The string. </param>
	/// <param name="iInt">	    [out] The integer. </param>
	///
	/// <returns> The integer. </returns>
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	RXCORE_API int& operator>>(const CRxString& sxString, int& iInt);

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/// <summary>
	/// 	Converts the given string into an unsigned integer value.
	/// </summary>
	///
	/// <param name="sxString"> [in] The string. </param>
	/// <param name="uInt">	    [iout] The unsinged integer. </param>
	///
	/// <returns> The unsigned integer. </returns>
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	RXCORE_API unsigned& operator>>(const CRxString& sxString, unsigned& uInt);
}

#pragma make_public(Rx::CRxString)
