pichar and pistring explicit test
This commit is contained in:
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
//! \~english Contructs symbol from system locale and no more than 4 bytes of string
|
||||
//! \~russian Создает символ из системной локали не более 4 байт длины
|
||||
PIChar(const char * c, int * bytes = 0);
|
||||
explicit PIChar(const char * c, int * bytes = 0);
|
||||
|
||||
//! \~english Copy operator
|
||||
//! \~russian Оператор присваивания
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
bool operator!=(const PIChar & o) const { return !(o == *this); }
|
||||
bool operator!=(const PIChar & o) const { return !(*this == o); }
|
||||
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
@@ -265,36 +265,36 @@ inline bool operator<=(const char * v, const PIChar & c) {
|
||||
//! \relatesalso PIChar
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
inline bool operator==(const int v, const PIChar & c) {
|
||||
return (PIChar((ushort)v) == c);
|
||||
inline bool operator==(ushort v, const PIChar & c) {
|
||||
return (PIChar(v) == c);
|
||||
}
|
||||
|
||||
//! \relatesalso PIChar
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
inline bool operator>(const int v, const PIChar & c) {
|
||||
return (PIChar((ushort)v) > c);
|
||||
inline bool operator>(ushort v, const PIChar & c) {
|
||||
return (PIChar(v) > c);
|
||||
}
|
||||
|
||||
//! \relatesalso PIChar
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
inline bool operator<(const int v, const PIChar & c) {
|
||||
return (PIChar((ushort)v) < c);
|
||||
inline bool operator<(ushort v, const PIChar & c) {
|
||||
return (PIChar(v) < c);
|
||||
}
|
||||
|
||||
//! \relatesalso PIChar
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
inline bool operator>=(const int v, const PIChar & c) {
|
||||
return (PIChar((ushort)v) >= c);
|
||||
inline bool operator>=(ushort v, const PIChar & c) {
|
||||
return (PIChar(v) >= c);
|
||||
}
|
||||
|
||||
//! \relatesalso PIChar
|
||||
//! \~english Compare operator
|
||||
//! \~russian Оператор сравнения
|
||||
inline bool operator<=(const int v, const PIChar & c) {
|
||||
return (PIChar((ushort)v) <= c);
|
||||
inline bool operator<=(ushort v, const PIChar & c) {
|
||||
return (PIChar(v) <= c);
|
||||
}
|
||||
|
||||
#endif // PICHAR_H
|
||||
|
||||
@@ -113,11 +113,11 @@ public:
|
||||
|
||||
//! \~english Contructs string with single character "c".
|
||||
//! \~russian Создает строку из одного символа "c".
|
||||
PIString(const PIChar c) { d.push_back(c); }
|
||||
explicit PIString(const PIChar c) { d.push_back(c); }
|
||||
|
||||
//! \~english Contructs string with single character "c".
|
||||
//! \~russian Создает строку из одного символа "c".
|
||||
PIString(const char c) { d.push_back(PIChar(c)); }
|
||||
explicit PIString(const char c) { d.push_back(PIChar(c)); }
|
||||
|
||||
//! \~english Contructs string from C-string "str" (system codepage).
|
||||
//! \~russian Создает строку из C-строки "str" (кодировка системы).
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
//! \~english Contructs string from byte array "ba" (as UTF-8).
|
||||
//! \~russian Создает строку из байтового массива "ba" (как UTF-8).
|
||||
PIString(const PIByteArray & ba) { *this += ba; }
|
||||
explicit PIString(const PIByteArray & ba) { *this += ba; }
|
||||
|
||||
//! \~english Contructs string from "len" characters of buffer "str".
|
||||
//! \~russian Создает строку из "len" символов массива "str".
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
d.push_back(c);
|
||||
}
|
||||
|
||||
PIString(const PIConstChars & c) { *this += c; }
|
||||
explicit PIString(const PIConstChars & c) { *this += c; }
|
||||
|
||||
~PIString();
|
||||
|
||||
@@ -1184,15 +1184,6 @@ 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 "str".
|
||||
//! \~russian Возвращает начинается ли строка со "str".
|
||||
bool startsWith(const PIString & str) const;
|
||||
|
||||
Reference in New Issue
Block a user