From 7c335ede527eaf4a3053ef35b1299141d34aaf40 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 19 Nov 2010 05:54:14 +0000 Subject: I now think that this may not work out at all. It looks like if we want proper Unicode handling we'll need to implement a series of codecs and converters as well as tables of codepages and lookups. It'll be interesting, I guess, but it makes me care a lot less about proper encoding. Anyway, UtfString uses shorts instead of chars, so it's a step in the right direction, but still not enough to be able to handle proper UTF-16 encoding, maybe UCS-2 encoding, but... ...that's lame. Bu::FBasicString has been generalized a bit with optimizations from libc for char based strings. It also, unfortunately, still uses char-only functions in several places, those all rely on char casting strings at the moment just to get the thing to compile. Basically, it's not a good UTF-16 solution yet, and it may never be and remain compatible with char based strings. --- src/utfstring.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/utfstring.h (limited to 'src/utfstring.h') diff --git a/src/utfstring.h b/src/utfstring.h new file mode 100644 index 0000000..bbacb74 --- /dev/null +++ b/src/utfstring.h @@ -0,0 +1,24 @@ +#ifndef BU_UTF_STRING_H +#define BU_UTF_STRING_H + +#include "bu/fbasicstring.h" + +namespace Bu +{ + typedef FBasicString UtfString; + + template + uint32_t __calcHashCode( const T &k ); + + template + bool __cmpHashKeys( const T &a, const T &b ); + + template<> uint32_t __calcHashCode( const UtfString &k ); + template<> bool __cmpHashKeys( + const UtfString &a, const UtfString &b ); + + template void __tracer_format( const t &v ); + template<> void __tracer_format( const UtfString &v ); +} + +#endif -- cgit v1.2.3