git-svn-id: svn://db.shs.com.ru/pip@535 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
22
main.cpp
22
main.cpp
@@ -1,22 +1,16 @@
|
||||
#include "pip.h"
|
||||
#include "pivector2d.h"
|
||||
#include "pistring.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/*PIKbdListener kbd;
|
||||
kbd.enableExitCapture();
|
||||
kbd.start();*/
|
||||
/*PIScreen s(false);
|
||||
PIScreenTile t;
|
||||
t.minimumHeight = t.minimumWidth = t.maximumHeight = t.maximumWidth = 1;
|
||||
t.back_format.color_back = PIScreenTypes::Green;
|
||||
s.rootTile()->addTile(&t);
|
||||
s.rootTile()->addTile(new PIScreenTile());
|
||||
s.enableExitCapture();
|
||||
s.start();
|
||||
piMSleep(100);
|
||||
piCout << t.x() << t.y() << t.width() << t.height();*/
|
||||
WAIT_FOR_EXIT
|
||||
PIString s = PIString::fromUTF8("hello, привет");
|
||||
piCout << s;
|
||||
PIByteArray ba = s.toUTF8();
|
||||
piCout << ba.toHex();
|
||||
PIString s2;
|
||||
s2 = PIString::fromUTF8(ba);
|
||||
piCout << s2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,9 +254,21 @@ PIString PIString::fromUTF8(const char * s) {
|
||||
PIString ret;
|
||||
if (l > 0) ret.appendFromChars(s, l
|
||||
#ifdef PIP_ICU
|
||||
, "UTF-8"
|
||||
, "UTF-8"
|
||||
#endif
|
||||
);
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
PIString PIString::fromUTF8(const PIByteArray & ba) {
|
||||
PIString ret;
|
||||
if (ba.isEmpty()) return ret;
|
||||
ret.appendFromChars((const char*)ba.data(), ba.size()
|
||||
#ifdef PIP_ICU
|
||||
, "UTF-8"
|
||||
#endif
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -675,6 +675,9 @@ public:
|
||||
//! \brief Return string constructed from UTF-8
|
||||
static PIString fromUTF8(const char * s);
|
||||
|
||||
//! \brief Return string constructed from UTF-8
|
||||
static PIString fromUTF8(const PIByteArray &ba);
|
||||
|
||||
//! \brief Return string constructed from ASCII
|
||||
static PIString fromAscii(const char * s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user