23.06.2014 - PICodeParser, PICodeInfo, PIConnection, new binary "pip_cmg"
This commit is contained in:
34
pistring.cpp
34
pistring.cpp
@@ -155,8 +155,8 @@ PIString & PIString::operator +=(const wstring & str) {
|
||||
|
||||
|
||||
PIString & PIString::operator +=(const PIString & str) {
|
||||
uint l = str.size();
|
||||
for (uint i = 0; i < l; ++i) push_back(str[i]);
|
||||
//uint l = str.size();
|
||||
*((PIDeque<PIChar>*)this) << *((PIDeque<PIChar>*)&str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -208,23 +208,25 @@ bool PIString::operator >(const PIString & str) const {
|
||||
|
||||
|
||||
PIString PIString::mid(const int start, const int len) const {
|
||||
PIString str;
|
||||
//PIString str;
|
||||
int s = start, l = len;
|
||||
if (l == 0) return str;
|
||||
if (l == 0) return PIString();
|
||||
if (s < 0) {
|
||||
l += s;
|
||||
s = 0;
|
||||
}
|
||||
if (l < 0) {
|
||||
for (uint i = s; i < size(); ++i)
|
||||
str += at(i);
|
||||
//for (uint i = s; i < size(); ++i)
|
||||
// str += at(i);
|
||||
return PIString(&(at(s)), size() - s);
|
||||
} else {
|
||||
if (l > length() - s)
|
||||
l = length() - s;
|
||||
for (int i = s; i < s + l; ++i)
|
||||
str += at(i);
|
||||
//for (int i = s; i < s + l; ++i)
|
||||
// str += at(i);
|
||||
return PIString(&(at(s)), l);
|
||||
}
|
||||
return str;
|
||||
return PIString();
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +256,9 @@ PIString & PIString::trim() {
|
||||
for (int i = length() - 1; i >= 0; --i)
|
||||
if (at(i) != ' ' && at(i) != '\t' && at(i) != '\n' && at(i) != '\r' && at(i) != char(12))
|
||||
{fn = i; break;}
|
||||
*this = mid(st, fn - st + 1);
|
||||
//*this = mid(st, fn - st + 1);
|
||||
if (fn < size_s() - 1) cutRight(size_s() - fn - 1);
|
||||
if (st > 0) cutLeft(st);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -281,6 +285,7 @@ PIString & PIString::replace(int from, int count, const PIString & with) {
|
||||
|
||||
|
||||
PIString & PIString::replace(const PIString & what, const PIString & with, bool * ok) {
|
||||
//piCout << "replace" << what << with;
|
||||
if (what.isEmpty()) {
|
||||
if (ok != 0) *ok = false;
|
||||
return *this;
|
||||
@@ -301,8 +306,9 @@ PIString & PIString::replaceAll(const PIString & what, const PIString & with) {
|
||||
|
||||
|
||||
PIString & PIString::insert(int index, const PIString & str) {
|
||||
uint c = str.length();
|
||||
for (uint i = 0; i < c; ++i) insert(index + i, str[i]);
|
||||
//uint c = str.length();
|
||||
//for (uint i = 0; i < c; ++i) insert(index + i, str[i]);
|
||||
PIDeque<PIChar>::insert(index, *((const PIDeque<PIChar>*)&str));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -740,10 +746,10 @@ PIStringList& PIStringList::removeDuplicates() {
|
||||
PIStringList l;
|
||||
PIString s;
|
||||
bool ae;
|
||||
for (uint i = 0; i < size(); ++i) {
|
||||
for (int i = 0; i < size_s(); ++i) {
|
||||
ae = false;
|
||||
s = at(i);
|
||||
for (uint j = 0; j < l.size(); ++j) {
|
||||
for (int j = 0; j < l.size_s(); ++j) {
|
||||
if (s != l[j]) continue;
|
||||
ae = true; break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user