CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | List of all members
CartoTypeCore::String Class Reference

#include <cartotype_string.h>

Inheritance diagram for CartoTypeCore::String:
CartoTypeCore::MString

Public Member Functions

 String ()
 
 String (std::nullptr_t)
 
 String (const String &aOther)
 
 String (const MString &aOther)
 
 String (String &&aOther) noexcept
 
Stringoperator= (const String &aOther)
 
Stringoperator= (const MString &aOther)
 
Stringoperator= (String &&aOther) noexcept
 
 String (const char *aText, size_t aLength=npos)
 
 String (const uint16_t *aText, size_t aLength=npos)
 
 String (const char16_t *aText, size_t aLength=npos)
 
 String (const std::string &aText)
 
uint16_t & operator[] (size_t aIndex) const
 
const uint16_t * Data () const override
 
- Public Member Functions inherited from CartoTypeCore::MString
virtual ~MString ()
 
template<typename T >
MStringoperator= (const T &aText)
 
template<typename T >
MStringoperator+= (const T &aText)
 
size_t Length () const
 
bool IsEmpty () const
 
virtual const uint16_t * Data () const =0
 
void Delete (size_t aStart, size_t aEnd)
 
void Clear ()
 
void SetLengthToZero ()
 
std::basic_string< uint16_t > CreateUtf16String () const
 
std::string CreateUtf8String () const
 
 operator std::string () const
 
uint16_t operator[] (size_t aIndex) const
 
Text First (size_t aLength) const
 
Text Last (size_t aLength) const
 
Text Substring (size_t aStart, size_t aLength) const
 
String Token (size_t aIndex, const MString *aSeparators=nullptr, const MString *aSingleCharacterTokens=nullptr) const
 
void DeletePrefix (const MString &aPrefix)
 
void DeleteSuffix (const MString &aSuffix)
 
void SetCase (LetterCase aCase, const StringTypeDictionary *aTitleCaseDictionary=0)
 
void SetSentenceCase ()
 
int32_t Compare (MIter< int32_t > &aIter, StringMatchMethod aStringMatchMethod) const noexcept
 
Result Replace (size_t aStart, size_t aEnd, MIter< int32_t > &aText, size_t aMaxLength)
 
int32_t Compare (const MString &aString) const
 
int32_t Compare (const MString &aString, StringMatchMethod aStringMatchMethod) const noexcept
 
size_t Find (const MString &aString, StringMatchMethod aStringMatchMethod=StringMatchMethod::Exact, size_t *aEndPos=nullptr) const noexcept
 
void Replace (size_t aStart, size_t aEnd, const MString &aString)
 
void Insert (size_t aIndex, const MString &aString)
 
void Append (const MString &aString)
 
void AppendCommaSeparated (const String &aLabel, const String &aText, size_t &aItems, size_t aMaxItems=SIZE_MAX)
 
void Set (const MString &aString)
 
int32_t Compare (const uint16_t *aText) const
 
int32_t Compare (const uint16_t *aText, size_t aLength) const
 
int32_t Compare (const char16_t *aText, size_t aLength=npos) const
 
int32_t Compare (const uint16_t *aText, size_t aLength, StringMatchMethod aStringMatchMethod) const noexcept
 
void Replace (size_t aStart, size_t aEnd, const uint16_t *aText, size_t aLength=npos)
 
void Replace (size_t aStart, size_t aEnd, const char16_t *aText, size_t aLength=npos)
 
void Insert (size_t aIndex, const uint16_t *aText, size_t aLength=npos)
 
void Append (const uint16_t *aText, size_t aLength=npos)
 
void Set (const uint16_t *aText, size_t aLength=npos)
 
int32_t Compare (const char *aText, size_t aLength=npos, StringMatchMethod aStringMatchMethod=StringMatchMethod::Exact) const noexcept
 
int32_t CompareExact (const char *aText, size_t aLength=npos) const noexcept
 
int32_t CompareFoldCase (const char *aText, size_t aLength=npos) const noexcept
 
void Replace (size_t aStart, size_t aEnd, const char *aText, size_t aLength=npos, int32_t aCodePage=0)
 
bool operator== (const char *aText) const noexcept
 
bool operator% (const char *aText) const noexcept
 
bool operator!= (const char *aText) const
 
StringMatchType MatchType (const MString &aText) const
 
void Insert (size_t aIndex, const char *aText, size_t aLength=npos, int32_t aCodePage=0)
 
void Append (const char *aText, size_t aLength=npos, int32_t aCodePage=0)
 
template<typename T >
void Append (const std::basic_string< T > aString)
 
template<typename T >
void Set (const std::basic_string< T > aString)
 
void Set (const char *aText, size_t aLength=npos)
 
void Set (const char *aText, size_t aLength, int32_t aCodePage)
 
void Replace (size_t aStart, size_t aEnd, uint16_t aChar)
 
void Insert (size_t aIndex, uint16_t aChar)
 
void Append (uint16_t aChar)
 
void Set (uint16_t aChar)
 
void Trim ()
 
bool operator== (const MString &aString) const
 
bool operator== (const uint16_t *aText) const
 
bool operator== (const char16_t *aText) const
 
bool operator!= (const MString &aString) const
 
bool operator!= (const uint16_t *aText) const
 
bool operator!= (const char16_t *aText) const
 
bool operator% (const MString &aString) const
 
bool operator% (const uint16_t *aText) const
 
bool WildMatch (const MString &aWildText) const noexcept
 
bool WildMatch (const char *aWildText) const noexcept
 
bool LayerMatch (const MString &aWildText) const
 
bool LayerMatch (const char *aWildText) const noexcept
 
template<class T >
bool operator< (const T &aOther) const
 
template<class T >
bool operator<= (const T &aOther) const
 
template<class T >
bool operator> (const T &aOther) const
 
template<class T >
bool operator>= (const T &aOther) const
 
int32_t ToInt32 (size_t *aLengthUsed=nullptr, int32_t aBase=10) const noexcept
 
int64_t ToInt64 (size_t *aLengthUsed=nullptr, int32_t aBase=10) const noexcept
 
uint32_t ToUint32 (size_t *aLengthUsed=nullptr, int32_t aBase=10) const noexcept
 
double ToDouble (size_t *aLengthUsed=nullptr) const noexcept
 
double ToDimension (size_t *aLengthUsed=nullptr) const noexcept
 
void Shape (BidiParDir aParDir, BidiEngine *aBidiEngine, bool aParStart, bool aReorderFontSelectors)
 
void Abbreviate (const AbbreviationDictionary &aDictionary, bool aDeleteWords=false)
 
Result Transliterate (const StringTypeDictionary *aTitleCaseDictionary=nullptr, const char *aLocale=nullptr)
 
bool IsLineBreak (size_t aPos) const noexcept
 
size_t LineBreakBefore (size_t aPos) const noexcept
 
size_t LineBreakAfter (size_t aPos) const noexcept
 
void SetAttribute (const MString &aKey, const MString &aValue)
 
void SetAttribute (const String &aKey, const String &aValue)
 
Text Attribute (const MString &aKey) const noexcept
 
Text Attribute (const String &aKey) const noexcept
 
bool NextAttribute (size_t &aPos, Text &aKey, Text &aValue) const noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from CartoTypeCore::MString
static int32_t Compare (MIter< int32_t > &aIter1, MIter< int32_t > &aIter2, StringMatchMethod aStringMatchMethod) noexcept
 
static int32_t FuzzyCompare (MIter< int32_t > &aIter1, MIter< int32_t > &aIter2, int32_t aMaxDistance) noexcept
 
static bool FuzzyMatch (MIter< int32_t > &aIter1, MIter< int32_t > &aIter2, int32_t aMaxDistance) noexcept
 
static bool FuzzyMatch (const char *aText1, const char *aText2, int32_t aMaxDistance) noexcept
 
static int32_t ToInt32 (const uint8_t *aText, size_t aLength, size_t *aLengthUsed=nullptr, int32_t aBase=10) noexcept
 
- Static Public Attributes inherited from CartoTypeCore::MString
static constexpr int KMaxFuzzyDistance = 4
 
- Protected Member Functions inherited from CartoTypeCore::MString
 MString ()
 
 MString (size_t aLength)
 
- Protected Attributes inherited from CartoTypeCore::MString
size_t iLength
 

Detailed Description

A string that owns its own text, which is freely resizable.

Constructor & Destructor Documentation

◆ String() [1/9]

CartoTypeCore::String::String ( )
inline

Constructs an empty String object.

◆ String() [2/9]

CartoTypeCore::String::String ( std::nullptr_t  )
inline

Constructs an empty String object. This constructor allows a null argument in a function expecting a String to be converted to an empty string.

◆ String() [3/9]

CartoTypeCore::String::String ( const String aOther)

Creates a String by copying another String.

◆ String() [4/9]

CartoTypeCore::String::String ( const MString aOther)

Creates a String by copying from another object derived from MString.

◆ String() [5/9]

CartoTypeCore::String::String ( String &&  aOther)
noexcept

Creates a String by moving from another String.

◆ String() [6/9]

CartoTypeCore::String::String ( const char *  aText,
size_t  aLength = npos 
)

Creates a String from UTF8 text. If aLength is npos, the text must be null-terminated.

◆ String() [7/9]

CartoTypeCore::String::String ( const uint16_t *  aText,
size_t  aLength = npos 
)

Creates a String from UTF16 text. If aLength is npos, the text must be null-terminated.

◆ String() [8/9]

CartoTypeCore::String::String ( const char16_t *  aText,
size_t  aLength = npos 
)

Creates a String from UTF16 text. If aLength is npos, the text must be null-terminated.

◆ String() [9/9]

CartoTypeCore::String::String ( const std::string &  aText)

Creates a String from a std::string.

Member Function Documentation

◆ Data()

const uint16_t * CartoTypeCore::String::Data ( ) const
inlineoverridevirtual

Returns a constant pointer to Unicode text stored in UTF16 format.

Implements CartoTypeCore::MString.

◆ operator=() [1/3]

String & CartoTypeCore::String::operator= ( const MString aOther)

Assigns from an object derived from MString to this String.

◆ operator=() [2/3]

String & CartoTypeCore::String::operator= ( const String aOther)

Assigns from one String to another.

◆ operator=() [3/3]

String & CartoTypeCore::String::operator= ( String &&  aOther)
noexcept

Moves from a String object to this String.

◆ operator[]()

uint16_t & CartoTypeCore::String::operator[] ( size_t  aIndex) const
inline

Gets the character at the position aIndex.


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