This is a high level string class. More...
Public Types | |
| typedef size_t | Size_t |
Public Member Functions | |
| const Dtk_WChar_t * | _w_str_us () const |
| Retrieve the UNICODE string. More... | |
| void | add_int (const int integer, int force_unsigned_int=0) |
| concat an int to the Dtk_string (convert the int to Dtk_string) More... | |
| const char * | c_str () const |
| Retrieve the ASCII conversion string. More... | |
| void | cat (const Dtk_string &s2) |
| concat the Dtk_string with the Dtk_string given in parameter More... | |
| void | clear () |
| clear string data More... | |
| int | cmp (const Dtk_string &s2) const |
| compare the Dtk_string with the string given in parameter More... | |
| int | cmp (const Dtk_WChar_t *s2) const |
| void | convert_from_int (const int integer, int force_unsigned_int=0) |
| affectation operator from a int More... | |
| void | ConvertFromUTF8String (const char *inUTF8String) |
| int | count_char_occurrences (const int car) const |
| Counts all the occurrences of a given character into the Dtk_string. More... | |
| int | count_substring_occurrences (const Dtk_string &substring) const |
| Counts all the occurrences of a given substring into the Dtk_string. More... | |
| void | cpy (Dtk_string s2) |
| copy the Dtk_string given in parameter in the Dtk_string More... | |
| Dtk_string | drive () const |
| File Utility : Retrieves the drive in Dtk_string form. More... | |
| Dtk_string () | |
| Default constructor. More... | |
| Dtk_string (const char *s) | |
| constructor from a char * (ASCII string) More... | |
| Dtk_string (const char *s, const Dtk_Size_t &inCount) | |
| Dtk_string (const double dbl_val) | |
| constructor from a double More... | |
| Dtk_string (const double dbl_val, Dtk_Int32 inWithMorePrecision) | |
| Dtk_string (const Dtk_string &) | |
| copy constructor More... | |
| Dtk_string (const Dtk_WChar_t *s) | |
| Dtk_string (const float float_val) | |
| constructor from a float More... | |
| Dtk_string (Dtk_string &&s) DTK_NOEXCEPT | |
| Move constructor. More... | |
| Dtk_bool | existe_fichier () const |
| File Utility : tests if a file exists. More... | |
| Dtk_string | extension () const |
| File Utility : Retrieves the extension in Dtk_string form. More... | |
| Dtk_string | filename () const |
| File Utility : Retrieves the filename in Dtk_string form. More... | |
| void | FileNameExtension (Dtk_string &outFileNameExtension) const |
| File Utility : Retrieves the filename extension in Dtk_string form. More... | |
| Dtk_Size_t | FileSize () const |
| File Utility : retrieve the file size. More... | |
| int | find_first (int character) const |
| find the position of a character into a Dtk_string More... | |
| int | find_last (int character) const |
| find the position of a character into a Dtk_string More... | |
| int | find_substring (const Dtk_string &s1) const |
| find the position of a substring into a Dtk_string More... | |
| void | FixPathSeparator () |
| File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed separator. More... | |
| void | free_mem () |
| void | FullPath (Dtk_string &outFullPath) const |
| File Utility : Retrieves the full path in Dtk_string form. More... | |
| Dtk_Size_t | get_char (char *inoutStr) const |
| copy the Dtk_string in a char * (ASCII) string More... | |
| void | get_wchar (Dtk_WChar_t *str) const |
| copy the Dtk_string in a char * (UNICODE) string More... | |
| int | icmp (const Dtk_string &s2) const |
| Perform a lowercase comparison of strings. More... | |
| int | icmp (const Dtk_WChar_t *s2) const |
| Dtk_bool | is_not_NULL () const |
| Dtk_bool | is_NULL () const |
| Dtk_string | left (int pos) const |
| retrieve the left part of the Dtk_string from a position More... | |
| Dtk_string | left_exclusive (int pos) const |
| retrieve the left part of the Dtk_string from a position More... | |
| void | LeftExclusive (const int &pos, Dtk_string &outRes) const |
| int | len () const |
| Retrieve the length of the Dtk_string. More... | |
| void | Merge (const Dtk_string &s2) |
| int | mkdir () const |
| File Utility : Create a Directory. More... | |
| int | ncmp (const Dtk_string &s2, const int count) const |
| compare the count first character of the Dtk_string with the string given in parameter More... | |
| int | ncmp (const Dtk_WChar_t *s2, const int count) const |
| void | ncpy (const Dtk_string &s2, size_t size) |
| copy a number of characters of the Dtk_string in an other Dtk_string More... | |
| int | nicmp (const Dtk_string &s2, const size_t size) const |
| Compare characters of two strings without regard to case. More... | |
| int | nicmp (const Dtk_WChar_t *s2, const size_t size) const |
| FILE * | OpenFile (const Dtk_string &inRights) const |
| File Utility : Open a file with the given rights. More... | |
| Dtk_string & | operator+= (const Dtk_string &s2) |
| Dtk_string & | operator= (const char *s) |
| affectation operator from a char (ASCII) string More... | |
| Dtk_string & | operator= (const double dbl_val) |
| affectation operator from a double More... | |
| Dtk_string & | operator= (const Dtk_string &s) |
| affectation operator from a Dtk_string More... | |
| Dtk_string & | operator= (const float fltval) |
| affectation operator from a float More... | |
| Dtk_string & | operator= (Dtk_string &&s) DTK_NOEXCEPT |
| Move assignment operator. More... | |
| const Dtk_WChar_t & | operator[] (int i) const |
| Dtk_WChar_t & | operator[] (int) |
| access to a specified letter in the Dtk_string More... | |
| FILE * | ouvrir_fichier (const Dtk_string &droits) const |
| File Utility : Open a file with the given rights. More... | |
| Dtk_string | path () const |
| File Utility : Retrieves the path in Dtk_string form. More... | |
| void | RawCopyFromASCII (const char *inStrToBeCopied, const Dtk_Size_t inCount=-1) |
| int | removechar (const int &removed_char) |
| Removes all occurrences of a character in a string. More... | |
| int | replace (const int &old_char, const int &new_char) |
| Replaces all occurrences of a character in a string with a new character. More... | |
| Dtk_string | right (int pos) const |
| retrieve the right part of the Dtk_string from a position More... | |
| Dtk_string | right_exclusive (int pos) const |
| retrieve the right part of the Dtk_string from a position More... | |
| void | RightExclusive (const int &pos, Dtk_string &outRes) const |
| int | rmdir () const |
| SetAsDeprecated ("2022.3", "Use FileSize() method instead") long taille_fichier() const | |
| void | Split (const Dtk_string &inDelimiters, Dtk_tab< Dtk_string > &outResults) const |
| Split a Dtk_string into an array of Dtk_string giving a char array. More... | |
| void | Split (Dtk_WChar_t *inDelimiters, Dtk_tab< Dtk_string > &outResults) const |
| Dtk_string | Substring (const Dtk_Size_t &inStartIndex, const Dtk_Size_t &inLength) const |
| int | test_extension (const Dtk_string &ext) const |
| Dtk_status | ToDtkDouble64 (Dtk_Double64 &outRes) const |
| Dtk_status | ToDtkInt32 (Dtk_Int32 &outRes) const |
| void | ToLower () |
| Converts the Dtk_string to Lower case. More... | |
| void | ToUpper () |
| Converts the Dtk_string to Upper case. More... | |
| char * | ToUTF8String () const |
| Converts the Dtk_string to UTF8 string. More... | |
| int | traite_nom_fichier (Dtk_string *drive, Dtk_string *path, Dtk_string *filename, Dtk_string *extension) const |
| File Utility: Splits Fullpath into drive/path/filename/extension. More... | |
| void | TrimCharacters (const Dtk_WChar_t inCharToBeTrimmed, const Dtk_bool inTrimLeadingCharacters=DTK_TRUE, const Dtk_bool inTrimTrailingCharacters=DTK_TRUE) |
| Removes all occurrences of a given char at the beginning - leading - or the end - trailing - into the Dtk_string. More... | |
| void | TrimLeadingAndTrailingCharacters (const Dtk_WChar_t inCharToBeTrimmed) |
| Removes all occurrences of a given char at the beginning - leading - and the end - trailing - into the Dtk_string. More... | |
| void | TrimLeadingCharacters (const Dtk_WChar_t inCharToBeTrimmed) |
| Removes all occurrences of a given char at the beginning - leading - and the end - trailing - into the Dtk_string. More... | |
| void | TrimTrailingCharacters (const Dtk_WChar_t inCharToBeTrimmed) |
| Removes all occurrences of a given char at the end - trailing - into the Dtk_string. More... | |
| int | unlink () const |
| File Utility : Delete a file. More... | |
| ~Dtk_string () | |
| Default destructors. More... | |
Static Public Member Functions | |
| static const char | PathSeparatorChar () |
| File Utility : retrieve The OS Path Separator as char. More... | |
| static const Dtk_string | PathSeparatorString () |
| File Utility : Retrieves The OS Path Separator as Dtk_string. More... | |
| static const Dtk_WChar_t | PathSeparatorWChar () |
| File Utility : Retrieves The OS Path Separator as Dtk_WChar_t. More... | |
Protected Member Functions | |
| void | _FillFromCharBuffer (const char *inBuffer, const Dtk_Size_t inSize=(Dtk_Size_t) -1) |
Protected Attributes | |
| char * | m_CStr |
| compatibility ASCII representation. WARNING this field is not always up to date. More... | |
| Size_t | m_CStrSize |
| size of m_CStr buffer More... | |
| Dtk_WChar_t * | m_Str |
| Internal representation of the string. More... | |
| Size_t | m_StrSize |
| size of m_Str buffer More... | |
This is a high level string class.
This class lets you use ASCII or UNICODE strings. It also has some File fonctions
| typedef size_t Dtk_string::Size_t |
| Dtk_string::~Dtk_string | ( | ) |
Default destructors.
| Dtk_string::Dtk_string | ( | ) |
Default constructor.
| Dtk_string::Dtk_string | ( | const char * | s | ) |
constructor from a char * (ASCII string)
| s | the ASCII string to convert |
| Dtk_string::Dtk_string | ( | const char * | s, |
| const Dtk_Size_t & | inCount | ||
| ) |
| Dtk_string::Dtk_string | ( | const Dtk_string & | ) |
copy constructor
| s | the Dtk_string to copy |
| Dtk_string::Dtk_string | ( | Dtk_string && | s | ) |
| Dtk_string::Dtk_string | ( | const double | dbl_val | ) |
constructor from a double
| dbl_val | the double value to convert |
| Dtk_string::Dtk_string | ( | const double | dbl_val, |
| Dtk_Int32 | inWithMorePrecision | ||
| ) |
| Dtk_string::Dtk_string | ( | const float | float_val | ) |
constructor from a float
| float_val | the float value to convert |
| Dtk_string::Dtk_string | ( | const Dtk_WChar_t * | s | ) |
|
protected |
| const Dtk_WChar_t* Dtk_string::_w_str_us | ( | ) | const |
Retrieve the UNICODE string.
Sample:
| void Dtk_string::add_int | ( | const int | integer, |
| int | force_unsigned_int = 0 |
||
| ) |
concat an int to the Dtk_string (convert the int to Dtk_string)
| integer | the int to concat |
Sample:
| const char* Dtk_string::c_str | ( | ) | const |
Retrieve the ASCII conversion string.
Sample:
| void Dtk_string::cat | ( | const Dtk_string & | s2 | ) |
concat the Dtk_string with the Dtk_string given in parameter
| s2 | the Dtk_string to concat |
Sample:
| void Dtk_string::clear | ( | ) |
| int Dtk_string::cmp | ( | const Dtk_string & | s2 | ) | const |
compare the Dtk_string with the string given in parameter
| s2 | : Dtk_string to be compared with |
Sample:
| int Dtk_string::cmp | ( | const Dtk_WChar_t * | s2 | ) | const |
| void Dtk_string::convert_from_int | ( | const int | integer, |
| int | force_unsigned_int = 0 |
||
| ) |
affectation operator from a int
| integer | the affected value (a conversion is made) |
Sample:
| void Dtk_string::ConvertFromUTF8String | ( | const char * | inUTF8String | ) |
| int Dtk_string::count_char_occurrences | ( | const int | car | ) | const |
Counts all the occurrences of a given character into the Dtk_string.
| car | the searched substring |
Sample:
| int Dtk_string::count_substring_occurrences | ( | const Dtk_string & | substring | ) | const |
Counts all the occurrences of a given substring into the Dtk_string.
| substring | the searched substring |
Sample:
| void Dtk_string::cpy | ( | Dtk_string | s2 | ) |
copy the Dtk_string given in parameter in the Dtk_string
| s2 | the Dtk_string to be copied |
Sample:
| Dtk_string Dtk_string::drive | ( | ) | const |
| Dtk_bool Dtk_string::existe_fichier | ( | ) | const |
File Utility : tests if a file exists.
Sample:
| Dtk_string Dtk_string::extension | ( | ) | const |
File Utility : Retrieves the extension in Dtk_string form.
Sample:
| Dtk_string Dtk_string::filename | ( | ) | const |
File Utility : Retrieves the filename in Dtk_string form.
Sample:
| void Dtk_string::FileNameExtension | ( | Dtk_string & | outFileNameExtension | ) | const |
File Utility : Retrieves the filename extension in Dtk_string form.
Sample:
| Dtk_Size_t Dtk_string::FileSize | ( | ) | const |
File Utility : retrieve the file size.
Sample:
| int Dtk_string::find_first | ( | int | character | ) | const |
find the position of a character into a Dtk_string
| car | the searched character (UNICODE or ASCII form) |
Sample:
| int Dtk_string::find_last | ( | int | character | ) | const |
find the position of a character into a Dtk_string
| car | the searched character (UNICODE or ASCII form) |
Sample:
| int Dtk_string::find_substring | ( | const Dtk_string & | s1 | ) | const |
find the position of a substring into a Dtk_string
| s1 | the searched substring |
Sample:
| void Dtk_string::FixPathSeparator | ( | ) |
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed separator.
Sample:
| void Dtk_string::free_mem | ( | ) |
| void Dtk_string::FullPath | ( | Dtk_string & | outFullPath | ) | const |
File Utility : Retrieves the full path in Dtk_string form.
Sample:
| Dtk_Size_t Dtk_string::get_char | ( | char * | inoutStr | ) | const |
copy the Dtk_string in a char * (ASCII) string
| inoutStr | the buffer string. If NULL the method only processes the resulting ASCII length - for buffer allocation - |
Sample:
| void Dtk_string::get_wchar | ( | Dtk_WChar_t * | str | ) | const |
copy the Dtk_string in a char * (UNICODE) string
| str | the buffer string |
Sample:
| int Dtk_string::icmp | ( | const Dtk_string & | s2 | ) | const |
Perform a lowercase comparison of strings.
| s2 | : Dtk_string to be compared with |
Sample:
| int Dtk_string::icmp | ( | const Dtk_WChar_t * | s2 | ) | const |
| Dtk_bool Dtk_string::is_not_NULL | ( | ) | const |
| Dtk_bool Dtk_string::is_NULL | ( | ) | const |
| Dtk_string Dtk_string::left | ( | int | pos | ) | const |
retrieve the left part of the Dtk_string from a position
| pos | : start position |
Sample:
| Dtk_string Dtk_string::left_exclusive | ( | int | pos | ) | const |
retrieve the left part of the Dtk_string from a position
| pos | : start position |
Sample:
| void Dtk_string::LeftExclusive | ( | const int & | pos, |
| Dtk_string & | outRes | ||
| ) | const |
| int Dtk_string::len | ( | ) | const |
| void Dtk_string::Merge | ( | const Dtk_string & | s2 | ) |
| int Dtk_string::mkdir | ( | ) | const |
File Utility : Create a Directory.
Sample:
| int Dtk_string::ncmp | ( | const Dtk_string & | s2, |
| const int | count | ||
| ) | const |
compare the count first character of the Dtk_string with the string given in parameter
| s2 | : Dtk_string to be compared with |
| count | : the number of characters to be compared |
Sample:
| int Dtk_string::ncmp | ( | const Dtk_WChar_t * | s2, |
| const int | count | ||
| ) | const |
| void Dtk_string::ncpy | ( | const Dtk_string & | s2, |
| size_t | size | ||
| ) |
copy a number of characters of the Dtk_string in an other Dtk_string
| s2 | the Dtk_string to be copied |
| size | the number of character to be copied |
Sample:
| int Dtk_string::nicmp | ( | const Dtk_string & | s2, |
| const size_t | size | ||
| ) | const |
Compare characters of two strings without regard to case.
| s2 | : Dtk_string to be compared with |
| size | : the number of characters to be compared |
Sample:
| int Dtk_string::nicmp | ( | const Dtk_WChar_t * | s2, |
| const size_t | size | ||
| ) | const |
| FILE* Dtk_string::OpenFile | ( | const Dtk_string & | inRights | ) | const |
File Utility : Open a file with the given rights.
| inRights | the given rights (in ASCII, UNICODE or Dtk_string form
|
Sample:
| Dtk_string& Dtk_string::operator+= | ( | const Dtk_string & | s2 | ) |
| Dtk_string& Dtk_string::operator= | ( | const char * | s | ) |
affectation operator from a char (ASCII) string
| s | the affected value |
Sample:
| Dtk_string& Dtk_string::operator= | ( | const double | dbl_val | ) |
affectation operator from a double
| dbl_val | the affected value (a conversion is made) |
Sample:
| Dtk_string& Dtk_string::operator= | ( | const Dtk_string & | s | ) |
| Dtk_string& Dtk_string::operator= | ( | const float | fltval | ) |
affectation operator from a float
| fltval | the affected value (a conversion is made) |
Sample:
| Dtk_string& Dtk_string::operator= | ( | Dtk_string && | s | ) |
| const Dtk_WChar_t& Dtk_string::operator[] | ( | int | i | ) | const |
| Dtk_WChar_t& Dtk_string::operator[] | ( | int | ) |
access to a specified letter in the Dtk_string
| i | the position of the wanted letter |
| FILE* Dtk_string::ouvrir_fichier | ( | const Dtk_string & | droits | ) | const |
File Utility : Open a file with the given rights.
| droits | the given rights (in ASCII, UNICODE or Dtk_string form
|
Sample:
| Dtk_string Dtk_string::path | ( | ) | const |
File Utility : Retrieves the path in Dtk_string form.
Sample:
|
static |
|
static |
File Utility : Retrieves The OS Path Separator as Dtk_string.
|
static |
| void Dtk_string::RawCopyFromASCII | ( | const char * | inStrToBeCopied, |
| const Dtk_Size_t | inCount = -1 |
||
| ) |
| int Dtk_string::removechar | ( | const int & | removed_char | ) |
Removes all occurrences of a character in a string.
| removed_char | : character to be removed |
Sample:
| int Dtk_string::replace | ( | const int & | old_char, |
| const int & | new_char | ||
| ) |
Replaces all occurrences of a character in a string with a new character.
| old_char | : character to be replaced |
| new_char | : character to replace |
Sample:
| Dtk_string Dtk_string::right | ( | int | pos | ) | const |
retrieve the right part of the Dtk_string from a position
| pos | : start position |
Sample:
| Dtk_string Dtk_string::right_exclusive | ( | int | pos | ) | const |
retrieve the right part of the Dtk_string from a position
| pos | : start position |
Sample:
| void Dtk_string::RightExclusive | ( | const int & | pos, |
| Dtk_string & | outRes | ||
| ) | const |
| int Dtk_string::rmdir | ( | ) | const |
| Dtk_string::SetAsDeprecated | ( | "2022.3" | , |
| "Use FileSize() method instead" | |||
| ) | const |
| void Dtk_string::Split | ( | const Dtk_string & | inDelimiters, |
| Dtk_tab< Dtk_string > & | outResults | ||
| ) | const |
Split a Dtk_string into an array of Dtk_string giving a char array.
| inDelimiters | the delimiters string. This string contains each characters used to split the string |
| outResults | the result array |
Sample:
| void Dtk_string::Split | ( | Dtk_WChar_t * | inDelimiters, |
| Dtk_tab< Dtk_string > & | outResults | ||
| ) | const |
| Dtk_string Dtk_string::Substring | ( | const Dtk_Size_t & | inStartIndex, |
| const Dtk_Size_t & | inLength | ||
| ) | const |
| int Dtk_string::test_extension | ( | const Dtk_string & | ext | ) | const |
| Dtk_status Dtk_string::ToDtkDouble64 | ( | Dtk_Double64 & | outRes | ) | const |
| Dtk_status Dtk_string::ToDtkInt32 | ( | Dtk_Int32 & | outRes | ) | const |
| void Dtk_string::ToLower | ( | ) |
Converts the Dtk_string to Lower case.
Sample:
| void Dtk_string::ToUpper | ( | ) |
Converts the Dtk_string to Upper case.
Sample:
| char* Dtk_string::ToUTF8String | ( | ) | const |
Converts the Dtk_string to UTF8 string.
Sample:
| int Dtk_string::traite_nom_fichier | ( | Dtk_string * | drive, |
| Dtk_string * | path, | ||
| Dtk_string * | filename, | ||
| Dtk_string * | extension | ||
| ) | const |
File Utility: Splits Fullpath into drive/path/filename/extension.
| [out] | drive | drive buffer or NULL if not wanted... |
| [out] | path | path buffer or NULL if not wanted... |
| [out] | filename | filename buffer or NULL if not wanted... |
| [out] | extension | extension buffer or NULL if not wanted... |
Sample:
| void Dtk_string::TrimCharacters | ( | const Dtk_WChar_t | inCharToBeTrimmed, |
| const Dtk_bool | inTrimLeadingCharacters = DTK_TRUE, |
||
| const Dtk_bool | inTrimTrailingCharacters = DTK_TRUE |
||
| ) |
Removes all occurrences of a given char at the beginning - leading - or the end - trailing - into the Dtk_string.
| inCharToBeTrimmed | the searched Dtk_WChar_t |
| inTrimLeadingCharacters | DTK_TRUE If you want to trim leading characters. DTK_FALSE otherwise. DTK_TRUE by default. |
| inTrimTrailingCharacters | DTK_TRUE If you want to trim leading characters. DTK_FALSE otherwise. DTK_TRUE by default. |
Sample:
| void Dtk_string::TrimLeadingAndTrailingCharacters | ( | const Dtk_WChar_t | inCharToBeTrimmed | ) |
Removes all occurrences of a given char at the beginning - leading - and the end - trailing - into the Dtk_string.
| inCharToBeTrimmed | the searched Dtk_WChar_t |
Sample:
| void Dtk_string::TrimLeadingCharacters | ( | const Dtk_WChar_t | inCharToBeTrimmed | ) |
Removes all occurrences of a given char at the beginning - leading - and the end - trailing - into the Dtk_string.
| inCharToBeTrimmed | the searched Dtk_WChar_t |
Sample:
| void Dtk_string::TrimTrailingCharacters | ( | const Dtk_WChar_t | inCharToBeTrimmed | ) |
Removes all occurrences of a given char at the end - trailing - into the Dtk_string.
| inCharToBeTrimmed | the searched Dtk_WChar_t |
Sample:
| int Dtk_string::unlink | ( | ) | const |
File Utility : Delete a file.
Sample:
|
mutableprotected |
compatibility ASCII representation. WARNING this field is not always up to date.
|
mutableprotected |
size of m_CStr buffer
|
protected |
Internal representation of the string.
|
mutableprotected |
size of m_Str buffer