UString integration done

- now UString works for both Qt (uses QString) and non-Qt (uses modified
CBString) builds
This commit is contained in:
Nikolaj Schlej 2016-07-05 16:18:55 +02:00
parent 9bd71281b9
commit 804a55ba64
8 changed files with 20 additions and 19 deletions

View file

@ -317,7 +317,7 @@ struct CBString : public tagbstring {
void findreplacecaseless (const char * find, const char * repl, int pos = 0);
// Extraction method.
const CBString midstr (int left, int len) const;
CBString midstr (int left, int len) const;
// Standard manipulation methods.
void setsubstr (int pos, const CBString& b, unsigned char fill = ' ');
@ -362,8 +362,11 @@ struct CBString : public tagbstring {
int read (bNread readPtr, void * parm);
// QString compatibility methods
CBString toLocal8Bit() { return *this; }
bool isEmpty() const { return slen == 0; }
void clear() { *this = ""; }
CBString left(int len) { return midstr(0, len); }
CBString mid(int pos, int len) { return midstr(pos, len); }
static CBString fromUtf16(const ushort* str) { // Naive implementation assuming that only ASCII part of UCS2 is used
CBString msg; while (*str) { msg += *(char*)str; str++; } return msg;
}