9.10.2011 - stable backup commit
This commit is contained in:
16
pistring.h
16
pistring.h
@@ -14,6 +14,7 @@ public:
|
||||
//inline PIString & operator +=(const char c) {push_back(c); return *this;}
|
||||
PIString & operator +=(const PIChar c) {push_back(c); return *this;}
|
||||
PIString & operator +=(const char * str);
|
||||
PIString & operator +=(const wchar_t * str);
|
||||
PIString & operator +=(const string & str) {appendFromChars(str.c_str(), str.length()); return *this;}
|
||||
PIString & operator +=(const PIByteArray & ba) {appendFromChars((const char * )ba.data(), ba.size_s()); return *this;}
|
||||
PIString & operator +=(const PIString & str);
|
||||
@@ -22,21 +23,18 @@ public:
|
||||
//PIString(const char c) {*this += c;}
|
||||
PIString(const PIChar c) {*this += c;}
|
||||
PIString(const char * str) {*this += str;}
|
||||
PIString(const wchar_t * str) {*this += str;}
|
||||
PIString(const string & str) {*this += str;}
|
||||
PIString(const wstring & str) {*this += str;}
|
||||
PIString(const PIString & str) {*this += str;}
|
||||
PIString(const PIByteArray & ba) {*this += ba;}
|
||||
PIString(const char * str, const int len) {*this += string(str, len);}
|
||||
PIString(const int len, const char c) {for (int i = 0; i < len; ++i) push_back(c);}
|
||||
PIString(const int len, const PIChar & c) {for (int i = 0; i < len; ++i) push_back(c);}
|
||||
PIString(const PIString & str) {*this += str;}
|
||||
|
||||
operator const char*() {return data();}
|
||||
operator const string() {if (size() == 0) return string(); string s; for (int i = 0; i < length(); ++i) s.push_back(at(i).toAscii()); return s;}
|
||||
#ifdef WINDOWS
|
||||
PIChar operator [](const int pos) const __attribute__ ((optimize(0))) {return at(pos);}
|
||||
#else
|
||||
PIChar operator [](const int pos) const {return at(pos);}
|
||||
#endif
|
||||
PIChar & operator [](const int pos) {return at(pos);}
|
||||
|
||||
bool operator ==(const PIString & str) const;
|
||||
@@ -79,6 +77,7 @@ public:
|
||||
//inline PIString & operator <<(const char c) {*this += c; return *this;}
|
||||
PIString & operator <<(const PIChar c) {*this += c; return *this;}
|
||||
PIString & operator <<(const char * str) {*this += str; return *this;}
|
||||
PIString & operator <<(const wchar_t * str) {*this += str; return *this;}
|
||||
PIString & operator <<(const string & str) {*this += str; return *this;}
|
||||
PIString & operator <<(const int & num) {*this += PIString::fromNumber(num); return *this;}
|
||||
PIString & operator <<(const short & num) {*this += PIString::fromNumber(num); return *this;}
|
||||
@@ -107,10 +106,10 @@ public:
|
||||
PIString & expandRightTo(const int len, const PIChar & c) {if (len > length()) resize(len, c); return *this;}
|
||||
PIString & expandLeftTo(const int len, const PIChar & c) {if (len > length()) insert(0, PIString(len - length(), c)); return *this;}
|
||||
|
||||
const char * data() {std_string = convertToStd(); return std_string.c_str();}
|
||||
const char * data() {return convertToStd().c_str();}
|
||||
const string stdString() const {return convertToStd();}
|
||||
wstring stdWString() const {return convertToWString();}
|
||||
PIByteArray toByteArray() {convertToStd(); return PIByteArray(std_string.c_str(), std_string.length());}
|
||||
PIByteArray toByteArray() {string s(convertToStd()); return PIByteArray(s.c_str(), s.length());}
|
||||
PIStringList split(const PIString & delim) const;
|
||||
|
||||
PIString toUpperCase() const;
|
||||
@@ -162,7 +161,7 @@ private:
|
||||
string convertToStd() const;
|
||||
wstring convertToWString() const {wstring s; for (int i = 0; i < length(); ++i) s.push_back(at(i).toWChar()); return s;}
|
||||
|
||||
string std_string;
|
||||
//string std_string;
|
||||
|
||||
};
|
||||
|
||||
@@ -198,6 +197,7 @@ public:
|
||||
uint contentSize() {uint s = 0; for (uint i = 0; i < size(); ++i) s += at(i).size(); return s;}
|
||||
|
||||
PIStringList & operator <<(const PIString & str) {push_back(str); return *this;}
|
||||
PIStringList & operator <<(const PIStringList & sl) {piForeachC (PIString & i, sl) push_back(i); return *this;}
|
||||
//inline PIStringList & operator <<(const char c) {push_back(PIString(c)); return *this;}
|
||||
PIStringList & operator <<(const char * str) {push_back(PIString(str)); return *this;}
|
||||
PIStringList & operator <<(const string & str) {push_back(str); return *this;}
|
||||
|
||||
Reference in New Issue
Block a user