From 867ac96b4df0f5e20aa007fc169bcd8a3b806328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Sat, 30 Jul 2011 19:47:24 +0000 Subject: [PATCH] Defined some useful string conversion macros --- dic/encoding.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dic/encoding.h b/dic/encoding.h index 2b872cb..d1df327 100644 --- a/dic/encoding.h +++ b/dic/encoding.h @@ -128,5 +128,19 @@ unsigned int writeInUTF8(const wstring &iWString, char *oBuffer, */ string writeInUTF8(const wstring &iWString, const string &iContext); + +// Useful macros + +// Convert between wstring and string +#define wfl(s) convertToWc(s) +#define lfw(s) convertToMb(s) +// Convert between wstring and utf-8 string +#define ufw(s) writeInUTF8((s), "ufw") +#define wfu(s) readFromUTF8((s), "wfu") +// Convert between string and utf-8 string +#define ufl(s) ufw(wfl(s)) +#define lfu(s) lfw(wfu(s)) + + #endif