Merge pull request 'добавил const для части контейнеров и explicit для конструкторов' (#176) from const_explicit into master
Reviewed-on: https://git.shs.tools/SHS/pip/pulls/176
This commit was merged in pull request #176.
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
||||
}
|
||||
PIString & operator+=(const char * str);
|
||||
PIString & operator+=(const wchar_t * str);
|
||||
PIString & operator+=(const PIByteArray & ba);
|
||||
PIString & operator+=(const char16_t * str);
|
||||
PIString & operator+=(const PIString & str);
|
||||
PIString & operator+=(const PIConstChars & str);
|
||||
|
||||
@@ -143,9 +143,17 @@ public:
|
||||
//! \endcode
|
||||
PIString(const wchar_t * str) { *this += str; }
|
||||
|
||||
//! \~english Contructs string from byte array "ba" (as UTF-8).
|
||||
//! \~russian Создает строку из байтового массива "ba" (как UTF-8).
|
||||
PIString(const PIByteArray & ba) { *this += ba; }
|
||||
//! \~english Contructs string from \c char16_t C-string "str".
|
||||
//! \~russian Создает строку из \c char16_t C-строки "str".
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! "str" should be null-terminated
|
||||
//! \~russian
|
||||
//! "str" должна заканчиваться нулевым \c char16_t
|
||||
//! \~\code
|
||||
//! PIString s(u"string");
|
||||
//! \endcode
|
||||
PIString(const char16_t * str) { *this += str; }
|
||||
|
||||
//! \~english Contructs string from "len" characters of buffer "str".
|
||||
//! \~russian Создает строку из "len" символов массива "str".
|
||||
@@ -217,6 +225,14 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Assign operator.
|
||||
//! \~russian Оператор присваивания.
|
||||
PIString & operator=(const char16_t * o) {
|
||||
d.clear();
|
||||
*this += o;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Compare operator.
|
||||
//! \~russian Оператор сравнения.
|
||||
bool operator==(const PIString & str) const;
|
||||
@@ -452,6 +468,13 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Insert string "str" at the begin of string.
|
||||
//! \~russian Вставляет "str" в начало строки.
|
||||
PIString & push_front(const char16_t * str) {
|
||||
insert(0, str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Insert string "str" at the begin of string.
|
||||
//! \~russian Вставляет "str" в начало строки.
|
||||
PIString & push_front(const PIString & str) {
|
||||
@@ -480,6 +503,13 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Insert string "str" at the end of string.
|
||||
//! \~russian Вставляет "str" в конец строки.
|
||||
PIString & append(const char16_t * str) {
|
||||
*this += str;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Insert string "str" at the end of string.
|
||||
//! \~russian Вставляет "str" в конец строки.
|
||||
PIString & append(const PIString & str) {
|
||||
@@ -787,6 +817,16 @@ public:
|
||||
//! \endcode
|
||||
PIString & insert(const int index, const char * c) { return insert(index, PIString(c)); }
|
||||
|
||||
//! \~english Insert string "str" after index "index" and return this string.
|
||||
//! \~russian Вставляет строку "str" после позиции "index" и возвращает эту строку.
|
||||
//! \~\details
|
||||
//! \~\code
|
||||
//! PIString s("stg");
|
||||
//! s.insert(2, u"rin");
|
||||
//! piCout << s; // s = "string"
|
||||
//! \endcode
|
||||
PIString & insert(const int index, const char16_t * c) { return insert(index, PIString(c)); }
|
||||
|
||||
//! \~english Enlarge string to length "len" by addition characters "c" at the end, and return this string.
|
||||
//! \~russian Увеличивает длину строки до "len" добавлением символов "c" в конец и возвращает эту строку.
|
||||
//! \~\details
|
||||
@@ -1184,19 +1224,26 @@ public:
|
||||
//! \endcode
|
||||
int entries(const PIChar c) const;
|
||||
|
||||
//! \~english Returns number of occurrences of character "c".
|
||||
//! \~russian Возвращает число вхождений символа "c".
|
||||
//! \~\details
|
||||
//! \~\code
|
||||
//! piCout << PIString(".str.0").entries('.'); // 2
|
||||
//! piCout << PIString(".str.0").entries('0'); // 1
|
||||
//! \endcode
|
||||
int entries(char c) const { return entries(PIChar(c)); }
|
||||
//! \~english Returns if string starts with "c".
|
||||
//! \~russian Возвращает начинается ли строка с "c".
|
||||
bool startsWith(const char c) const { return startsWith(PIChar(c)); }
|
||||
|
||||
//! \~english Returns if string starts with "c".
|
||||
//! \~russian Возвращает начинается ли строка с "c".
|
||||
bool startsWith(const PIChar c) const;
|
||||
|
||||
//! \~english Returns if string starts with "str".
|
||||
//! \~russian Возвращает начинается ли строка со "str".
|
||||
bool startsWith(const PIString & str) const;
|
||||
|
||||
//! \~english Returns if string ends with "c".
|
||||
//! \~russian Возвращает оканчивается ли строка на "c".
|
||||
bool endsWith(const char c) const { return endsWith(PIChar(c)); }
|
||||
|
||||
//! \~english Returns if string ends with "c".
|
||||
//! \~russian Возвращает оканчивается ли строка на "c".
|
||||
bool endsWith(const PIChar c) const;
|
||||
|
||||
//! \~english Returns if string ends with "str".
|
||||
//! \~russian Возвращает оканчивается ли строка на "str".
|
||||
bool endsWith(const PIString & str) const;
|
||||
@@ -1714,6 +1761,10 @@ public:
|
||||
//! \~russian Возвращает строку созданную из "len" символов ASCII.
|
||||
static PIString fromAscii(const char * s, int len);
|
||||
|
||||
//! \~english Returns string constructed from ASCII.
|
||||
//! \~russian Возвращает строку созданную из ASCII.
|
||||
static PIString fromAscii(const PIByteArray & ascii);
|
||||
|
||||
//! \~english Returns string constructed from "cp" codepage.
|
||||
//! \~russian Возвращает строку созданную из кодировки "cp".
|
||||
static PIString fromCodepage(const char * s, const char * cp);
|
||||
|
||||
Reference in New Issue
Block a user