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 "pip.h"
|
||||||
#include "pivector2d.h"
|
#include "pivector2d.h"
|
||||||
|
#include "pistring.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
/*PIKbdListener kbd;
|
PIString s = PIString::fromUTF8("hello, привет");
|
||||||
kbd.enableExitCapture();
|
piCout << s;
|
||||||
kbd.start();*/
|
PIByteArray ba = s.toUTF8();
|
||||||
/*PIScreen s(false);
|
piCout << ba.toHex();
|
||||||
PIScreenTile t;
|
PIString s2;
|
||||||
t.minimumHeight = t.minimumWidth = t.maximumHeight = t.maximumWidth = 1;
|
s2 = PIString::fromUTF8(ba);
|
||||||
t.back_format.color_back = PIScreenTypes::Green;
|
piCout << s2;
|
||||||
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
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,6 +261,18 @@ PIString PIString::fromUTF8(const char * s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIString PIString::fromAscii(const char * s) {
|
PIString PIString::fromAscii(const char * s) {
|
||||||
PIString ret;
|
PIString ret;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
|
|||||||
@@ -675,6 +675,9 @@ public:
|
|||||||
//! \brief Return string constructed from UTF-8
|
//! \brief Return string constructed from UTF-8
|
||||||
static PIString fromUTF8(const char * s);
|
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
|
//! \brief Return string constructed from ASCII
|
||||||
static PIString fromAscii(const char * s);
|
static PIString fromAscii(const char * s);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user