version 2.39.0
PIString works with PIConstChars picodeinfo optimizations PIIODevice::availableClasses
This commit is contained in:
@@ -263,7 +263,7 @@ PIString PIString::fromAscii(const char * s, int len) {
|
||||
PIString ret;
|
||||
ret.resize(len);
|
||||
for (int l = 0; l < len; ++l) {
|
||||
ret[l] = s[l];
|
||||
ret[l] = s[l];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -369,14 +369,14 @@ uint PIString::hash() const {
|
||||
|
||||
|
||||
PIByteArray PIString::toUTF8() const {
|
||||
if (isEmpty()) return PIByteArray(1,'\0');
|
||||
if (isEmpty()) return PIByteArray();
|
||||
buildData(__utf8name__);
|
||||
return PIByteArray(data_, strlen(data_));
|
||||
}
|
||||
|
||||
|
||||
PIByteArray PIString::toCharset(const char * c) const {
|
||||
if (isEmpty()) return PIByteArray(1,'\0');
|
||||
if (isEmpty()) return PIByteArray();
|
||||
buildData(
|
||||
#ifdef PIP_ICU
|
||||
c
|
||||
@@ -418,6 +418,18 @@ PIString & PIString::operator +=(const PIString & str) {
|
||||
}
|
||||
|
||||
|
||||
PIString & PIString::operator +=(const PIConstChars & str) {
|
||||
if (!str.isEmpty()) {
|
||||
size_t os = d.size();
|
||||
d.enlarge(str.size());
|
||||
for (size_t l = 0; l < d.size(); ++l) {
|
||||
d[os + l] = str[l];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool PIString::operator ==(const PIString & str) const {
|
||||
return d == str.d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user