string brush

This commit is contained in:
2022-04-25 15:29:27 +03:00
parent 765ef7368e
commit 90afc369f0
5 changed files with 38 additions and 34 deletions

View File

@@ -39,7 +39,7 @@ class PIP_EXPORT PIString: public PIDeque<PIChar>
public:
//! \~english Contructs an empty string
//! \~russian Создает пустую строку
PIString(): PIDeque<PIChar>() {data_ = nullptr;}
PIString(): PIDeque<PIChar>() {}
//! \~english Value for elide at left
//! \~russian Значение для пропуска слева
@@ -62,18 +62,18 @@ public:
//! \~english Contructs a copy of string
//! \~russian Создает копию строки
PIString(const PIString & o): PIDeque<PIChar>(o) {data_ = nullptr;}
PIString(const PIString & o): PIDeque<PIChar>(o) {}
PIString(PIString && o): PIDeque<PIChar>(std::move(o)) {data_ = nullptr;}
PIString(PIString && o): PIDeque<PIChar>(std::move(o)) {}
//! \~english Contructs string with single symbol "c"
//! \~russian Создает строку из одного символа "c"
PIString(const PIChar c): PIDeque<PIChar>() {data_ = nullptr; *this += c;}
PIString(const PIChar c): PIDeque<PIChar>() {*this += c;}
//! \~english Contructs string with single symbol "c"
//! \~russian Создает строку из одного символа "c"
PIString(const char c): PIDeque<PIChar>() {data_ = nullptr; *this += PIChar(c);}
PIString(const char c): PIDeque<PIChar>() {*this += PIChar(c);}
//! \~english Contructs string from C-string "str" (system codepage)
//! \~russian Создает строку из C-строки "str" (кодировка системы)
@@ -85,7 +85,7 @@ public:
//! \~\code
//! PIString s("string");
//! \endcode
PIString(const char * str): PIDeque<PIChar>() {data_ = nullptr; *this += str;}
PIString(const char * str): PIDeque<PIChar>() {*this += str;}
//! \~english Contructs string from \c wchar_t C-string "str"
//! \~russian Создает строку из \c wchar_t C-строки "str"
@@ -97,15 +97,15 @@ public:
//! \~\code
//! PIString s(L"string");
//! \endcode
PIString(const wchar_t * str): PIDeque<PIChar>() {data_ = nullptr; *this += str;}
PIString(const wchar_t * str): PIDeque<PIChar>() {*this += str;}
//! \~english Contructs string from byte array "ba" (as UTF-8)
//! \~russian Создает строку из байтового массива "ba" (как UTF-8)
PIString(const PIByteArray & ba): PIDeque<PIChar>() {data_ = nullptr; *this += ba;}
PIString(const PIByteArray & ba): PIDeque<PIChar>() {*this += ba;}
//! \~english Contructs string from "len" characters of buffer "str"
//! \~russian Создает строку из "len" символов массива "str"
PIString(const PIChar * str, const int len): PIDeque<PIChar>(str, size_t(len)) {data_ = nullptr;}
PIString(const PIChar * str, const int len): PIDeque<PIChar>(str, size_t(len)) {}
//! \~english Contructs string from "len" characters of buffer "str" (system codepage)
//! \~russian Создает строку из "len" символов массива "str" (кодировка системы)
@@ -113,7 +113,7 @@ public:
//! \~\code
//! PIString s("string", 3); // s = "str"
//! \endcode
PIString(const char * str, const int len): PIDeque<PIChar>() {data_ = nullptr; appendFromChars(str, len);}
PIString(const char * str, const int len): PIDeque<PIChar>() {appendFromChars(str, len);}
//! \~english Contructs string as sequence of characters "c" of buffer with length "len"
//! \~russian Создает строку как последовательность длиной "len" символа "c"
@@ -121,7 +121,7 @@ public:
//! \~\code
//! PIString s(5, 'p'); // s = "ppppp"
//! \endcode
PIString(const int len, const char c): PIDeque<PIChar>() {data_ = nullptr; for (int i = 0; i < len; ++i) PIDeque<PIChar>::push_back(PIChar(c));}
PIString(const int len, const char c): PIDeque<PIChar>() {for (int i = 0; i < len; ++i) PIDeque<PIChar>::push_back(PIChar(c));}
//! \~english Contructs string as sequence of symbols "c" of buffer with length "len"
//! \~russian Создает строку как последовательность длиной "len" символа "c"
@@ -129,7 +129,7 @@ public:
//! \~\code
//! PIString s(5, "№"); // s = "№№№№№"
//! \endcode
PIString(const int len, const PIChar c): PIDeque<PIChar>() {data_ = nullptr; for (int i = 0; i < len; ++i) PIDeque<PIChar>::push_back(c);}
PIString(const int len, const PIChar c): PIDeque<PIChar>() {for (int i = 0; i < len; ++i) PIDeque<PIChar>::push_back(c);}
~PIString();
@@ -1397,8 +1397,10 @@ private:
static llong toNumberBase(const PIString & value, int base = -1, bool * ok = 0);
void appendFromChars(const char * c, int s, const char * cp = __syslocname__);
void buildData(const char * cp = __syslocname__) const;
void deleteData() const;
void trimsubstr(int &st, int &fn) const;
mutable char * data_;
mutable char * data_ = nullptr;
};