Updated code to support newer Qt versions (#237)

This commit is contained in:
Vampire Cat 2021-04-04 11:09:23 +02:00 committed by GitHub
parent d1e47539fc
commit 34c8ad8dcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 358 additions and 94 deletions

View file

@ -45,14 +45,14 @@ public:
UByteArray toUpper() { std::basic_string<char> s = d; std::transform(s.begin(), s.end(), s.begin(), ::toupper); return UByteArray(s); }
uint32_t toUInt(bool* ok = NULL, const uint8_t base = 10) { return (uint32_t)strtoul(d.c_str(), NULL, base); }
int32_t size() const { return d.size(); }
int32_t count(char ch) const { return std::count(d.begin(), d.end(), ch); }
int32_t size() const { return (int32_t)d.size(); }
int32_t count(char ch) const { return (int32_t)std::count(d.begin(), d.end(), ch); }
char at(uint32_t i) const { return d.at(i); }
char operator[](uint32_t i) const { return d[i]; }
char& operator[](uint32_t i) { return d[i]; }
bool startsWith(const UByteArray & ba) const { return 0 == d.find(ba.d, 0); }
int indexOf(const UByteArray & ba, int from = 0) const { return d.find(ba.d, from); }
int indexOf(const UByteArray & ba, int from = 0) const { return (int)d.find(ba.d, from); }
int lastIndexOf(const UByteArray & ba, int from = 0) const {
size_t old_index = d.npos;
size_t index = d.find(ba.d, from);
@ -60,7 +60,7 @@ public:
old_index = index;
index = d.find(ba.d, index + 1);
}
return old_index;
return (int)old_index;
}
UByteArray left(int32_t len) const { return d.substr(0, len); }