class CCL::String
Overview
Unicode string class with “copy-on-write” semantics. More…
#include <cclstring.h> class String: protected CCL::PlainString { public: // fields static const String kEmpty; // construction String (nullptr_t unused = nullptr); String (int unused); String (IString* string); String (const uchar* charBuffer); String (const char* asciiString); String (TextEncoding encoding, const char* cString); String (StringRef string, int count); String (const String& other); // methods String& operator = (const String& other); bool isEmpty () const; int length () const; uchar at (int index) const; uchar firstChar () const; uchar lastChar () const; uchar operator [] (int index) const; bool copyTo (uchar* charBuffer, int bufferSize) const; bool toCString ( TextEncoding encoding, char* cString, int cStringSize, int* bytesWritten = nullptr ) const; bool toPascalString ( TextEncoding encoding, unsigned char* pString, int pStringSize ) const; bool toASCII ( char* asciiString, int asciiStringSize, int* bytesWritten = nullptr ) const; bool equals (StringRef otherString) const; bool equalsChars (const uchar* charBuffer, int count = -1) const; int compare (StringRef otherString, bool caseSensitive = true) const; int compareWithOptions (StringRef otherString, int flags) const; int compareChars (const uchar* charBuffer, int count = -1) const; bool operator == (StringRef s) const; bool operator != (StringRef s) const; bool operator > (StringRef s) const; bool operator >= (StringRef s) const; bool operator < (StringRef s) const; bool operator <= (StringRef s) const; int index (StringRef otherString, bool caseSensitive = true) const; int lastIndex (StringRef otherString, bool caseSensitive = true) const; bool contains (StringRef otherString, bool caseSensitive = true) const; bool startsWith (StringRef otherString, bool caseSensitive = true) const; bool endsWith (StringRef otherString, bool caseSensitive = true) const; String subString (int index, int count = -1) const; IStringTokenizer* tokenize (StringRef delimiters, int flags = 0) const; unsigned int getHashCode () const; bool getFloatValue (float& value) const; bool getFloatValue (double& value) const; float scanFloat (float fallback = 0) const; double scanDouble (double fallback = 0) const; bool getIntValue (int32& value) const; bool getIntValue (int64& value) const; int scanInt (int fallback = 0) const; int64 scanLargetInt (int64 fallback = 0) const; bool getHexValue (int64& value) const; int scanFormat (StringRef format, Variant args [], int count) const; template <typename Type> Type createNativeString () const; template <typename Type> void releaseNativeString (Type nativeString); void writeEnable (); void empty (); String& assign (const uchar* charBuffer, int count = -1); String& operator = (const uchar* charBuffer); String& append (StringRef otherString); String& append (StringRef otherString, int count); String& append (const uchar* charBuffer, int count = -1); String& append (uchar uc); bool appendCString (TextEncoding encoding, const char* cString, int count = -1); bool appendPascalString (TextEncoding encoding, const unsigned char* pString); bool appendNativeString (const void* nativeString); String& appendASCII (const char* asciiString, int count = -1); String& appendFormat (StringRef format, Variant args [], int count); String& appendFormat (StringRef format, VariantRef arg1); String& appendFormat (StringRef format, VariantRef arg1, VariantRef arg2); String& appendFormat ( StringRef format, VariantRef arg1, VariantRef arg2, VariantRef arg3 ); String& appendFormat ( StringRef format, VariantRef arg1, VariantRef arg2, VariantRef arg3, VariantRef arg4 ); String& appendIntValue (int v, int numPaddingZeros = -1); String& appendIntValue (int64 v, int numPaddingZeros = -1); String& appendHexValue (int v, int numPaddingZeros = -1); String& appendHexValue (int64 v, int numPaddingZeros = -1); String& appendFloatValue (float v, int numDecimalDigits = -1); String& appendFloatValue (double v, int numDecimalDigits = -1); String& operator << (int v); String& operator << (int64 v); String& operator << (float v); String& operator << (double v); String& operator << (StringRef s); String& operator << (const uchar* charBuffer); String& operator << (const char* asciiString); String& insert (int index, StringRef otherString); String& prepend (StringRef otherString); String& remove (int index, int count); String& remove (StringRef otherString, bool caseSensitive = true); String& truncate (int index); String& trimWhitespace (); String& toUppercase (); String& toLowercase (); String& capitalize (); String& substitute (int flags = 0); bool isNormalized (NormalizationForm form) const; String& normalize (NormalizationForm form); int replace ( StringRef searchString, StringRef replacementString, bool caseSensitive = true ); static StringRef getLineEnd (TextLineFormat lineFormat = Text::kSystemLineFormat); };
Inherited Members
public: // fields IString* theString; IStringPrivateData __private;
Detailed Documentation
Unicode string class with “copy-on-write” semantics.
Construction
String (nullptr_t unused = nullptr)
default ctor, allows StringRef s = nullptr
String (int unused)
deprecated: allows StringRef s = 0
String (IString* string)
IString* is shared!
String (const uchar* charBuffer)
characters are copied!
String (const char* asciiString)
construct from ASCII string
String (TextEncoding encoding, const char* cString)
construct from C string
String (StringRef string, int count)
construct with string repetition
String (const String& other)
copy ctor
Methods
String& operator = (const String& other)
string content is shared!