diff --git a/libs/main/core/picli.h b/libs/main/core/picli.h index 4bb0073c..5a71db20 100644 --- a/libs/main/core/picli.h +++ b/libs/main/core/picli.h @@ -135,7 +135,7 @@ public: //! \~russian Возвращает короткий ключ аргумента "name" или пустую строку, если аргумента нет. PIString argumentShortKey(const PIString & name) { piForeach(Argument & i, _args) - if (i.name == name) return i.short_key; + if (i.name == name) return PIString(i.short_key); return PIString(); } diff --git a/libs/main/io_devices/piusb.h b/libs/main/io_devices/piusb.h index c80a059b..839f2382 100644 --- a/libs/main/io_devices/piusb.h +++ b/libs/main/io_devices/piusb.h @@ -175,11 +175,11 @@ public: void setVendorID(ushort vid) { vid_ = vid; - setPath(PIString::fromNumber(vid_, 16).expandLeftTo(4, "0") + ":" + PIString::fromNumber(pid_, 16).expandLeftTo(4, "0")); + setPath(PIString::fromNumber(vid_, 16).expandLeftTo(4, '0') + ':' + PIString::fromNumber(pid_, 16).expandLeftTo(4, '0')); } void setProductID(ushort pid) { pid_ = pid; - setPath(PIString::fromNumber(vid_, 16).expandLeftTo(4, "0") + ":" + PIString::fromNumber(pid_, 16).expandLeftTo(4, "0")); + setPath(PIString::fromNumber(vid_, 16).expandLeftTo(4, '0') + ':' + PIString::fromNumber(pid_, 16).expandLeftTo(4, '0')); } bool setConfiguration(uchar value); diff --git a/libs/main/text/pichar.h b/libs/main/text/pichar.h index 22977c2f..2d39742a 100644 --- a/libs/main/text/pichar.h +++ b/libs/main/text/pichar.h @@ -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 diff --git a/libs/main/text/pistring.h b/libs/main/text/pistring.h index 2a3f7d28..e81fa4d1 100644 --- a/libs/main/text/pistring.h +++ b/libs/main/text/pistring.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; diff --git a/tests/core/pistringTest.cpp b/tests/core/pistringTest.cpp index 4597c157..981e373b 100644 --- a/tests/core/pistringTest.cpp +++ b/tests/core/pistringTest.cpp @@ -12,7 +12,7 @@ TEST(PIString_Tests, constructor_empty) { TEST(PIString_Tests, operator_concatenation_pichar) { PIString str1 = "AB C"; - const PIChar str2 = " "; + const PIChar str2 = ' '; str1 += str2; PIString res = "AB C "; ASSERT_EQ(str1, res); @@ -20,7 +20,7 @@ TEST(PIString_Tests, operator_concatenation_pichar) { TEST(PIString_Tests, operator_concatenation_pichar_zero1) { PIString str1 = ""; - const PIChar str2 = "D"; + const PIChar str2 = 'D'; str1 += str2; ASSERT_EQ(str1, "D"); } @@ -120,7 +120,7 @@ TEST(PIString_Tests, construct_pistring) { TEST(PIString_Tests, construct_pistring_move) { PIString str1 = "New"; PIString res = str1; - PIString str(move(str1)); + PIString str(std::move(str1)); ASSERT_EQ(res, str); } @@ -192,14 +192,14 @@ TEST(PIString_Tests, operator_assignment) { TEST(PIString_Tests, operator_assignment_move) { PIString str1 = "testing"; PIString str; - str = move(str1); + str = std::move(str1); ASSERT_EQ(PIString("testing"), str); ASSERT_TRUE(str1.isEmpty()); } TEST(PIString_Tests, operator_symbol) { PIString str1 = "testing"; - PIChar symbo = "i"; + PIChar symbo = 'i'; ASSERT_EQ(symbo, str1[4]); } @@ -217,13 +217,13 @@ TEST(PIString_Tests, operator_equal_pistring_false) { TEST(PIString_Tests, operator_equal_pichar_true) { PIString str1 = "t"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_TRUE(str1 == str2); } TEST(PIString_Tests, operator_equal_pichar_false) { PIString str1 = "t"; - PIChar str2 = "p"; + PIChar str2 = 'p'; ASSERT_FALSE(str1 == str2); } @@ -253,13 +253,13 @@ TEST(PIString_Tests, operator_not_equal_pistring_true) { TEST(PIString_Tests, operator_not_equal_pichar_false) { PIString str1 = "t"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_FALSE(str1 != str2); } TEST(PIString_Tests, operator_not_equal_pichar_true) { PIString str1 = "t"; - PIChar str2 = "p"; + PIChar str2 = 'p'; ASSERT_TRUE(str1 != str2); } @@ -295,19 +295,19 @@ TEST(PIString_Tests, operator_less_pistring_false_equal) { TEST(PIString_Tests, operator_less_pichar_true) { PIString str1 = "a"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_TRUE(str1 < str2); } TEST(PIString_Tests, operator_less_pichar_false) { PIString str1 = "t"; - PIChar str2 = "a"; + PIChar str2 = 'a'; ASSERT_FALSE(str1 < str2); } TEST(PIString_Tests, operator_less_pichar_false_equal) { PIString str1 = "t"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_FALSE(str1 < str2); } @@ -349,19 +349,19 @@ TEST(PIString_Tests, operator_grater_pistring_false_equal) { TEST(PIString_Tests, operator_grater_pichar_true) { PIString str1 = "t"; - PIChar str2 = "a"; + PIChar str2 = 'a'; ASSERT_TRUE(str1 > str2); } TEST(PIString_Tests, operator_grater_pichar_false) { PIString str1 = "a"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_FALSE(str1 > str2); } TEST(PIString_Tests, operator_grater_pichar_false_equal) { PIString str1 = "t"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_FALSE(str1 > str2); } @@ -403,19 +403,19 @@ TEST(PIString_Tests, operator_less_eq_pistring_true_equal) { TEST(PIString_Tests, operator_less_eq_pichar_true) { PIString str1 = "a"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_TRUE(str1 <= str2); } TEST(PIString_Tests, operator_less_eq_pichar_false) { PIString str1 = "t"; - PIChar str2 = "a"; + PIChar str2 = 'a'; ASSERT_FALSE(str1 <= str2); } TEST(PIString_Tests, operator_less_eq_pichar_true_equal) { PIString str1 = "t"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_TRUE(str1 <= str2); } @@ -457,19 +457,19 @@ TEST(PIString_Tests, operator_grater_eq_pistring_true_equal) { TEST(PIString_Tests, operator_grater_eq_pichar_true) { PIString str1 = "t"; - PIChar str2 = "a"; + PIChar str2 = 'a'; ASSERT_TRUE(str1 >= str2); } TEST(PIString_Tests, operator_grater_eq_pichar_false) { PIString str1 = "a"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_FALSE(str1 >= str2); } TEST(PIString_Tests, operator_grater_eq_pichar_true_equal) { PIString str1 = "t"; - PIChar str2 = "t"; + PIChar str2 = 't'; ASSERT_TRUE(str1 >= str2); } diff --git a/utils/deploy_tool/main.cpp b/utils/deploy_tool/main.cpp index afa4421b..4a5e2c07 100644 --- a/utils/deploy_tool/main.cpp +++ b/utils/deploy_tool/main.cpp @@ -20,7 +20,6 @@ #include "picli.h" #include "pidir.h" #include "piiostream.h" -#include "piprocess.h" #define DELIM "::" @@ -251,7 +250,7 @@ void checkQtLib(PIString lib) { for (int i = 0;; ++i) { if (qt_deps[i].lib.isEmpty()) break; if (qt_deps[i].lib == base) { - qt_plugins << qt_deps[i].plugins; + qt_plugins << PISet(qt_deps[i].plugins); // piCout << "add qt plugins" << qt_deps[i].plugins << "now" << qt_plugins; need_qt = true; qt_libs << lib; @@ -269,8 +268,8 @@ void checkQtLib(PIString lib) { void procLdd(PIString file, bool ext_lib = false, int cur_depth = 0) { ++cur_depth; if (cur_depth > depth) return; - static PIStringList ignore_ext = {"png", "jpg", "jpeg", "gif", "bmp", "svg", "tif", "tiff", "ico", "pdf", - "txt", "cfg", "conf", "json", "qml", "glsl", "fraq", "vert", "geom", "qmltypes", + static PIStringList ignore_ext = {"png", "jpg", "jpeg", "gif", "bmp", "svg", "tif", "tiff", "ico", "pdf", + "txt", "cfg", "conf", "json", "qml", "glsl", "fraq", "vert", "geom", "qmltypes", "metainfo", "ts", "qm", "ttf", "htm", "html", "md", "sms", "smsee", "blockmodel"}; PIString ext = PIFile::FileInfo(file).extension(); if (ignore_ext.contains(ext.toLowerCase())) return; @@ -615,7 +614,7 @@ int main(int argc, char * argv[]) { out_dir = cli.argumentValue("output"); lib_dirs = cli.argumentValue("search_path").split(DELIM); add_libs = cli.argumentValue("add_libs").split(DELIM); - ignore_libs = cli.argumentValue("ignore").split(DELIM); + ignore_libs = PISet(cli.argumentValue("ignore").split(DELIM)); qt_dir = cli.argumentValue("qtdir"); ldd = cli.argumentValue("ldd"); readelf = cli.argumentValue("Lreadelf");