![Logo](tetiere_ht.jpg) |
DATAKIT API
V2025.1
|
|
Go to the documentation of this file. 1 #ifdef A93938D6857511E1B78E58294824019B
2 # include "util/external/dtk_string_alt.hpp"
5 #ifndef __DTK_STRING_HPP__
6 #define __DTK_STRING_HPP__
9 # pragma warning(disable:4786)
10 # pragma warning(disable:4800)
26 # if (_MSC_VER > 1200)
27 # define Dtk_defined__wchar_t
31 #if ( defined(Dtk_defined__wchar_t) && defined(_NATIVE_WCHAR_T_DEFINED) )
33 # define w_str _w_str_w
35 # define w_str _w_str_us
38 #define DTK_A Dtk_string(L"a")
39 #define DTK_AB Dtk_string(L"ab")
40 #define DTK_RB Dtk_string(L"rb")
41 #define DTK_RBP Dtk_string(L"rb+")
42 #define DTK_R Dtk_string(L"r")
43 #define DTK_W Dtk_string(L"w")
44 #define DTK_WP Dtk_string(L"w+")
45 #define DTK_WB Dtk_string(L"wb")
46 #define DTK_WBP Dtk_string(L"wb+")
47 #define DTK_RW Dtk_string(L"rw")
75 void UpdateLen()
const;
93 #ifndef DTK_NO_CXX11_RVALUE_REFERENCES
178 #if ( defined(Dtk_defined__wchar_t))
179 const unsigned short *
_w_str_us()
const;
180 const __wchar_t * _w_str_w()
const;
199 void get_wchar(
unsigned short * str )
const;
214 int cmp(
const unsigned short *s2 )
const;
215 int cmp(
const __wchar_t *s2 )
const;
216 int ncmp(
const unsigned short *s2,
const int count )
const;
217 int ncmp(
const __wchar_t *s2,
const int count )
const;
218 int icmp(
const unsigned short *s2 )
const;
219 int icmp(
const __wchar_t *s2 )
const;
220 int nicmp(
const unsigned short *s2,
const size_t size )
const;
221 int nicmp(
const __wchar_t *s2,
const size_t size )
const;
736 int replace(
const int& old_char,
const int& new_char );
891 long taille_fichier() const;
897 # if defined(_WIN32) || defined(__CYGWIN__) // Windows default, including MinGW and Cygwin
907 # if defined(_WIN32) || defined(__CYGWIN__) // Windows default, including MinGW and Cygwin
917 # if defined(_WIN32) || defined(__CYGWIN__) // Windows default, including MinGW and Cygwin
963 void add_int(
const int integer,
int force_unsigned_int = 0 );
1072 #endif // __DTK_STRING_HPP__
1074 #endif // A93938D6857511E1B78E58294824019B
void ConvertFromUTF8String(const char *inUTF8String)
Dtk_string(const char *s)
constructor from a char * (ASCII string)
friend bool operator==(const Dtk_string &s1, const Dtk_string &s2)
compare two Dtk_string
int cmp(const Dtk_WChar_t *s2) const
friend bool operator!=(const Dtk_string &s1, const Dtk_string &s2)
compare two Dtk_string
void TrimTrailingCharacters(const Dtk_WChar_t inCharToBeTrimmed)
Removes all occurrences of a given char at the end - trailing - into the Dtk_string.
Definition: dtk_string.hpp:613
void _FillFromCharBuffer(const char *inBuffer, const Dtk_Size_t inSize=(Dtk_Size_t) -1)
static const char PathSeparatorChar()
File Utility : retrieve The OS Path Separator as char.
Definition: dtk_string.hpp:895
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...
FILE * ouvrir_fichier(const Dtk_string &droits) const
File Utility : Open a file with the given rights.
void TrimLeadingAndTrailingCharacters(const Dtk_WChar_t inCharToBeTrimmed)
Removes all occurrences of a given char at the beginning - leading - and the end - trailing - into th...
Definition: dtk_string.hpp:627
const Dtk_WChar_t * _w_str_us() const
Retrieve the UNICODE string.
int count_substring_occurrences(const Dtk_string &substring) const
Counts all the occurrences of a given substring into the Dtk_string.
#define DTK_TRUE
Definition: define.h:727
void cat(const Dtk_string &s2)
concat the Dtk_string with the Dtk_string given in parameter
std::string ToUtf8(Dtk_string const &)
int count_char_occurrences(const int car) const
Counts all the occurrences of a given character into the Dtk_string.
void TrimLeadingCharacters(const Dtk_WChar_t inCharToBeTrimmed)
Removes all occurrences of a given char at the beginning - leading - and the end - trailing - into th...
Definition: dtk_string.hpp:599
This is a high level string class.
Definition: dtk_string.hpp:58
size_t Dtk_Size_t
Definition: define.h:712
wchar_t Dtk_WChar_t
Definition: define.h:711
int unlink() const
File Utility : Delete a file.
void convert_from_int(const int integer, int force_unsigned_int=0)
affectation operator from a int
Dtk_string path() const
File Utility : Retrieves the path in Dtk_string form.
friend std::ostream & operator<<(std::ostream &, const Dtk_string &)
void LeftExclusive(const int &pos, Dtk_string &outRes) const
void ncpy(const Dtk_string &s2, size_t size)
copy a number of characters of the Dtk_string in an other Dtk_string
Definition: dtk_status.hpp:16
friend bool operator>=(const Dtk_string &s1, const Dtk_string &s2)
compare two Dtk_string
#define DTK_FALSE
Definition: define.h:728
int ncmp(const Dtk_WChar_t *s2, const int count) const
char Dtk_bool
Definition: define.h:725
FILE * OpenFile(const Dtk_string &inRights) const
File Utility : Open a file with the given rights.
Dtk_string & operator+=(const Dtk_string &s2)
void ToUpper()
Converts the Dtk_string to Upper case.
Dtk_string right(int pos) const
retrieve the right part of the Dtk_string from a position
double Dtk_Double64
Definition: define.h:699
int icmp(const Dtk_WChar_t *s2) const
int find_substring(const Dtk_string &s1) const
find the position of a substring into a Dtk_string
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.
Dtk_bool existe_fichier() const
File Utility : tests if a file exists.
static const Dtk_string PathSeparatorString()
File Utility : Retrieves The OS Path Separator as Dtk_string.
Definition: dtk_string.hpp:915
void add_int(const int integer, int force_unsigned_int=0)
concat an int to the Dtk_string (convert the int to Dtk_string)
Size_t m_CStrSize
size of m_CStr buffer
Definition: dtk_string.hpp:71
Dtk_bool is_not_NULL() const
SetAsDeprecated("2022.3", "Use FileSize() method instead") long taille_fichier() const
void RightExclusive(const int &pos, Dtk_string &outRes) const
int replace(const int &old_char, const int &new_char)
Replaces all occurrences of a character in a string with a new character.
Dtk_string filename() const
File Utility : Retrieves the filename in Dtk_string form.
friend bool operator<(const Dtk_string &s1, const Dtk_string &s2)
compare two Dtk_string
Dtk_status ToDtkInt32(Dtk_Int32 &outRes) const
friend bool operator<=(const Dtk_string &s1, const Dtk_string &s2)
compare two Dtk_string
int cmp(const Dtk_string &s2) const
compare the Dtk_string with the string given in parameter
char * ToUTF8String() const
Converts the Dtk_string to UTF8 string.
void FullPath(Dtk_string &outFullPath) const
File Utility : Retrieves the full path in Dtk_string form.
Dtk_string(const double dbl_val, Dtk_Int32 inWithMorePrecision)
int32_t Dtk_Int32
Definition: define.h:687
Dtk_status ToDtkDouble64(Dtk_Double64 &outRes) const
Dtk_string & operator=(Dtk_string &&s) DTK_NOEXCEPT
Move assignment operator.
Definition: dtk_string.hpp:106
void Split(Dtk_WChar_t *inDelimiters, Dtk_tab< Dtk_string > &outResults) const
void cpy(Dtk_string s2)
copy the Dtk_string given in parameter in the Dtk_string
int test_extension(const Dtk_string &ext) const
Dtk_Size_t get_char(char *inoutStr) const
copy the Dtk_string in a char * (ASCII) string
Definition: dtk_string.hpp:1065
static const Dtk_WChar_t PathSeparatorWChar()
File Utility : Retrieves The OS Path Separator as Dtk_WChar_t.
Definition: dtk_string.hpp:905
void get_wchar(Dtk_WChar_t *str) const
copy the Dtk_string in a char * (UNICODE) string
Dtk_string(const Dtk_string &)
copy constructor
Dtk_WChar_t & operator[](int)
access to a specified letter in the Dtk_string
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.
void FileNameExtension(Dtk_string &outFileNameExtension) const
File Utility : Retrieves the filename extension in Dtk_string form.
size_t Size_t
Definition: dtk_string.hpp:60
Dtk_string left(int pos) const
retrieve the left part of the Dtk_string from a position
const char * c_str() const
Retrieve the ASCII conversion string.
int nicmp(const Dtk_string &s2, const size_t size) const
Compare characters of two strings without regard to case.
Dtk_Size_t FileSize() const
File Utility : retrieve the file size.
Dtk_string extension() const
File Utility : Retrieves the extension in Dtk_string form.
int find_first(int character) const
find the position of a character into a Dtk_string
int mkdir() const
File Utility : Create a Directory.
void clear()
clear string data
Dtk_string left_exclusive(int pos) const
retrieve the left part of the Dtk_string from a position
#define w_str
Definition: dtk_string.hpp:35
Dtk_string(const double dbl_val)
constructor from a double
void RawCopyFromASCII(const char *inStrToBeCopied, const Dtk_Size_t inCount=-1)
friend Dtk_string operator+(const Dtk_string &s1, const Dtk_string &s2)
concat two Dtk_string
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
Dtk_string drive() const
File Utility : Retrieves the drive in Dtk_string form.
Dtk_string(const char *s, const Dtk_Size_t &inCount)
int find_last(int character) const
find the position of a character into a Dtk_string
~Dtk_string()
Default destructors.
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
int nicmp(const Dtk_WChar_t *s2, const size_t size) const
Dtk_string Substring(const Dtk_Size_t &inStartIndex, const Dtk_Size_t &inLength) const
Dtk_string right_exclusive(int pos) const
retrieve the right part of the Dtk_string from a position
void Merge(const Dtk_string &s2)
Size_t m_StrSize
size of m_Str buffer
Definition: dtk_string.hpp:69
Dtk_string FromUtf8(char const *)
int len() const
Retrieve the length of the Dtk_string.
int icmp(const Dtk_string &s2) const
Perform a lowercase comparison of strings.
Dtk_WChar_t * m_Str
Internal representation of the string.
Definition: dtk_string.hpp:63
Dtk_string(const Dtk_WChar_t *s)
Dtk_string(const float float_val)
constructor from a float
Dtk_string()
Default constructor.
friend bool operator>(const Dtk_string &s1, const Dtk_string &s2)
compare two Dtk_string
void ToLower()
Converts the Dtk_string to Lower case.
char * m_CStr
compatibility ASCII representation. WARNING this field is not always up to date.
Definition: dtk_string.hpp:65
#define DTK_NOEXCEPT
Definition: config.hpp:26
int removechar(const int &removed_char)
Removes all occurrences of a character in a string.