aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-08-24 18:15:11 +0000
committerMike Buland <eichlan@xagasoft.com>2012-08-24 18:15:11 +0000
commitda642482dee91921fc16786208aa497d3ee31d94 (patch)
treebae598fca2bb2b55661bc1c854b43a1393aced23 /src
parentf5ac2c1ba333ce6aa6d385d9a63b658caaa46503 (diff)
downloadlibbu++-da642482dee91921fc16786208aa497d3ee31d94.tar.gz
libbu++-da642482dee91921fc16786208aa497d3ee31d94.tar.bz2
libbu++-da642482dee91921fc16786208aa497d3ee31d94.tar.xz
libbu++-da642482dee91921fc16786208aa497d3ee31d94.zip
Adding new Bu::Settings system, which works more or less like QSettings from Qt,
only...without qt. It's the first real system in libbu++ that is going to be all unicode, which is exciting, but I'm having to actually finish the Bu::UtfString class while I work on it. Also exciting.
Diffstat (limited to 'src')
-rw-r--r--src/tests/settings.cpp9
-rw-r--r--src/tests/utf.cpp6
-rw-r--r--src/unstable/settings.cpp40
-rw-r--r--src/unstable/settings.h34
-rw-r--r--src/unstable/settingsdriver.cpp10
-rw-r--r--src/unstable/settingsdriver.h26
-rw-r--r--src/unstable/settingsdrivertaf.cpp29
-rw-r--r--src/unstable/settingsdrivertaf.h24
-rw-r--r--src/unstable/utfstring.cpp78
-rw-r--r--src/unstable/utfstring.h105
10 files changed, 336 insertions, 25 deletions
diff --git a/src/tests/settings.cpp b/src/tests/settings.cpp
new file mode 100644
index 0000000..0738cb7
--- /dev/null
+++ b/src/tests/settings.cpp
@@ -0,0 +1,9 @@
1#include "bu/settings.h"
2
3int main()
4{
5 Bu::Settings s("Xagasoft", "Settings");
6
7
8}
9
diff --git a/src/tests/utf.cpp b/src/tests/utf.cpp
index 3418e68..923b611 100644
--- a/src/tests/utf.cpp
+++ b/src/tests/utf.cpp
@@ -1,9 +1,15 @@
1#include <bu/file.h> 1#include <bu/file.h>
2#include <bu/string.h> 2#include <bu/string.h>
3#include <bu/utfstring.h> 3#include <bu/utfstring.h>
4#include <bu/sio.h>
5
6using namespace Bu;
4 7
5int main() 8int main()
6{ 9{
10 sio << "Code: " << Bu::__calcHashCode( Bu::UtfString("Hello there") )
11 << sio.nl;
12
7 Bu::File fIn("utf8.in", Bu::File::Read ); 13 Bu::File fIn("utf8.in", Bu::File::Read );
8 Bu::String sUtf8; 14 Bu::String sUtf8;
9 char buf[4096]; 15 char buf[4096];
diff --git a/src/unstable/settings.cpp b/src/unstable/settings.cpp
new file mode 100644
index 0000000..e993250
--- /dev/null
+++ b/src/unstable/settings.cpp
@@ -0,0 +1,40 @@
1#include "bu/settings.h"
2
3#include "bu/settingsdrivertaf.h"
4
5Bu::Settings::Settings( const Bu::UtfString &sCompany,
6 const Bu::UtfString &sProduct, Bu::Settings::Driver eDriver ) :
7 sCompany( sCompany ),
8 sProduct( sProduct ),
9 pDriver( NULL )
10{
11 switch( eDriver )
12 {
13 case DriverNative:
14#if defined( WIN32 )
15#else
16 pDriver = new Bu::SettingsDriverTaf();
17#endif
18 break;
19
20 case DriverTaf:
21 pDriver = new Bu::SettingsDriverTaf();
22 break;
23
24 case DriverIni:
25 throw Bu::ExceptionBase("Not supported");
26 break;
27 }
28
29 pDriver->init( sCompany, sProduct );
30}
31
32Bu::Settings::~Settings()
33{
34 delete pDriver;
35}
36
37void Bu::Settings::set( const Bu::UtfString &sKey, const Bu::UtfString &sValue )
38{
39}
40
diff --git a/src/unstable/settings.h b/src/unstable/settings.h
new file mode 100644
index 0000000..0736ee5
--- /dev/null
+++ b/src/unstable/settings.h
@@ -0,0 +1,34 @@
1#ifndef BU_SETTINGS_H
2#define BU_SETTINGS_H
3
4#include "bu/utfstring.h"
5
6namespace Bu
7{
8 /**
9 * Simple access to configuration data. Provides a consistant, cross
10 * platform interface to configuration data using native storage.
11 */
12 class Settings
13 {
14 public:
15 enum Driver
16 {
17 DriverNative,
18 DriverTaf,
19 DriverIni
20 };
21 Settings( const Bu::UtfString &sCompany, const Bu::UtfString &sProduct,
22 Driver driver=DriverNative );
23 virtual ~Settings();
24
25 void set( const Bu::UtfString &sKey, const Bu::UtfString &sValue );
26
27 private:
28 Bu::UtfString sCompany;
29 Bu::UtfString sProduct;
30 class SettingsDriver *pDriver;
31 };
32};
33
34#endif
diff --git a/src/unstable/settingsdriver.cpp b/src/unstable/settingsdriver.cpp
new file mode 100644
index 0000000..92cac77
--- /dev/null
+++ b/src/unstable/settingsdriver.cpp
@@ -0,0 +1,10 @@
1#include "bu/settingsdriver.h"
2
3Bu::SettingsDriver::SettingsDriver()
4{
5}
6
7Bu::SettingsDriver::~SettingsDriver()
8{
9}
10
diff --git a/src/unstable/settingsdriver.h b/src/unstable/settingsdriver.h
new file mode 100644
index 0000000..0a63106
--- /dev/null
+++ b/src/unstable/settingsdriver.h
@@ -0,0 +1,26 @@
1#ifndef BU_SETTINGS_DRIVER_H
2#define BU_SETTINGS_DRIVER_H
3
4#include "bu/utfstring.h"
5
6namespace Bu
7{
8 class Settings;
9
10 /**
11 * Base class for i/o interfaces for Bu::Settings. By subclassing this you
12 * can provide custom storage for application settings.
13 */
14 class SettingsDriver
15 {
16 friend class Bu::Settings;
17 public:
18 SettingsDriver();
19 virtual ~SettingsDriver();
20
21 protected:
22 virtual void init( const Bu::UtfString &sCompany, const Bu::UtfString &sProduct )=0;
23 };
24};
25
26#endif
diff --git a/src/unstable/settingsdrivertaf.cpp b/src/unstable/settingsdrivertaf.cpp
new file mode 100644
index 0000000..164bf0b
--- /dev/null
+++ b/src/unstable/settingsdrivertaf.cpp
@@ -0,0 +1,29 @@
1#include "bu/settingsdrivertaf.h"
2
3#include "bu/file.h"
4#include "bu/taf.h"
5
6#include <stdlib.h>
7
8Bu::SettingsDriverTaf::SettingsDriverTaf() :
9 pRoot( NULL )
10{
11}
12
13Bu::SettingsDriverTaf::~SettingsDriverTaf()
14{
15}
16
17void Bu::SettingsDriverTaf::init( const Bu::UtfString &sCompany,
18 const Bu::UtfString &sProduct )
19{
20 Bu::UtfString us( getenv("HOME") );
21 us += "/";
22 us += sCompany;
23 us += "/";
24 us += sProduct;
25 Bu::File fIn( us.get(), Bu::File::Read|Bu::File::Create );
26 Bu::TafReader tr( fIn );
27 pRoot = tr.readGroup();
28}
29
diff --git a/src/unstable/settingsdrivertaf.h b/src/unstable/settingsdrivertaf.h
new file mode 100644
index 0000000..d7d751b
--- /dev/null
+++ b/src/unstable/settingsdrivertaf.h
@@ -0,0 +1,24 @@
1#ifndef BU_SETTINGS_DRIVER_TAF_H
2#define BU_SETTINGS_DRIVER_TAF_H
3
4#include "bu/settingsdriver.h"
5
6namespace Bu
7{
8 class TafGroup;
9
10 class SettingsDriverTaf : public SettingsDriver
11 {
12 public:
13 SettingsDriverTaf();
14 virtual ~SettingsDriverTaf();
15
16 protected:
17 virtual void init( const Bu::UtfString &sCompany, const Bu::UtfString &sProduct );
18
19 private:
20 class Bu::TafGroup *pRoot;
21 };
22};
23
24#endif
diff --git a/src/unstable/utfstring.cpp b/src/unstable/utfstring.cpp
index 1c6813c..9fe2d02 100644
--- a/src/unstable/utfstring.cpp
+++ b/src/unstable/utfstring.cpp
@@ -23,10 +23,25 @@ Bu::UtfString::UtfString( const Bu::String &sInput, Encoding eEnc )
23 set( sInput, eEnc ); 23 set( sInput, eEnc );
24} 24}
25 25
26Bu::UtfString::UtfString( const char *sInput, Encoding eEnc )
27{
28 set( sInput, eEnc );
29}
30
26Bu::UtfString::~UtfString() 31Bu::UtfString::~UtfString()
27{ 32{
28} 33}
29 34
35Bu::UtfString::iterator Bu::UtfString::begin()
36{
37 return Bu::UtfString::iterator( this, 0 );
38}
39
40Bu::UtfString::const_iterator Bu::UtfString::begin() const
41{
42 return Bu::UtfString::const_iterator( this, 0 );
43}
44
30void Bu::UtfString::set( const Bu::String &sInput, Encoding eEnc ) 45void Bu::UtfString::set( const Bu::String &sInput, Encoding eEnc )
31{ 46{
32 switch( eEnc ) 47 switch( eEnc )
@@ -258,7 +273,7 @@ void Bu::UtfString::setUtf32le( const Bu::String &sInput )
258 } 273 }
259} 274}
260 275
261void Bu::UtfString::write( Bu::Stream &sOut, Encoding eEnc ) 276void Bu::UtfString::write( Bu::Stream &sOut, Encoding eEnc ) const
262{ 277{
263 switch( eEnc ) 278 switch( eEnc )
264 { 279 {
@@ -306,7 +321,7 @@ void Bu::UtfString::write( Bu::Stream &sOut, Encoding eEnc )
306 } 321 }
307} 322}
308 323
309void Bu::UtfString::writeUtf8( Bu::Stream &sOut ) 324void Bu::UtfString::writeUtf8( Bu::Stream &sOut ) const
310{ 325{
311 int iPos = 0; 326 int iPos = 0;
312 while( iPos < aData.getSize() ) 327 while( iPos < aData.getSize() )
@@ -359,12 +374,12 @@ void Bu::UtfString::writeUtf16( Bu::Stream &sOut )
359{ 374{
360} 375}
361*/ 376*/
362void Bu::UtfString::writeUtf16be( Bu::Stream &sOut ) 377void Bu::UtfString::writeUtf16be( Bu::Stream &sOut ) const
363{ 378{
364#if BYTE_ORDER == BIG_ENDIAN 379#if BYTE_ORDER == BIG_ENDIAN
365 uint16_t iTmp = 0xFEFF; // Byte Order Marker 380 uint16_t iTmp = 0xFEFF; // Byte Order Marker
366 sOut.write( &iTmp, 2 ); 381 sOut.write( &iTmp, 2 );
367 for( Array<uint16_t>::iterator i = aData.begin(); i; i++ ) 382 for( Array<uint16_t>::const_iterator i = aData.begin(); i; i++ )
368 { 383 {
369 iTmp = *i; 384 iTmp = *i;
370 sOut.write( &iTmp, 2 ); 385 sOut.write( &iTmp, 2 );
@@ -373,7 +388,7 @@ void Bu::UtfString::writeUtf16be( Bu::Stream &sOut )
373 uint16_t iTmp = 0xFEFF; // Byte Order Marker 388 uint16_t iTmp = 0xFEFF; // Byte Order Marker
374 iTmp = (iTmp>>8) | (iTmp<<8); 389 iTmp = (iTmp>>8) | (iTmp<<8);
375 sOut.write( &iTmp, 2 ); 390 sOut.write( &iTmp, 2 );
376 for( Array<uint16_t>::iterator i = aData.begin(); i; i++ ) 391 for( Array<uint16_t>::const_iterator i = aData.begin(); i; i++ )
377 { 392 {
378 iTmp = *i; 393 iTmp = *i;
379 iTmp = (iTmp>>8) | (iTmp<<8); 394 iTmp = (iTmp>>8) | (iTmp<<8);
@@ -382,12 +397,12 @@ void Bu::UtfString::writeUtf16be( Bu::Stream &sOut )
382#endif 397#endif
383} 398}
384 399
385void Bu::UtfString::writeUtf16le( Bu::Stream &sOut ) 400void Bu::UtfString::writeUtf16le( Bu::Stream &sOut ) const
386{ 401{
387#if BYTE_ORDER == LITTLE_ENDIAN 402#if BYTE_ORDER == LITTLE_ENDIAN
388 uint16_t iTmp = 0xFEFF; // Byte Order Marker 403 uint16_t iTmp = 0xFEFF; // Byte Order Marker
389 sOut.write( &iTmp, 2 ); 404 sOut.write( &iTmp, 2 );
390 for( Array<uint16_t>::iterator i = aData.begin(); i; i++ ) 405 for( Array<uint16_t>::const_iterator i = aData.begin(); i; i++ )
391 { 406 {
392 iTmp = *i; 407 iTmp = *i;
393 sOut.write( &iTmp, 2 ); 408 sOut.write( &iTmp, 2 );
@@ -396,7 +411,7 @@ void Bu::UtfString::writeUtf16le( Bu::Stream &sOut )
396 uint16_t iTmp = 0xFEFF; // Byte Order Marker 411 uint16_t iTmp = 0xFEFF; // Byte Order Marker
397 iTmp = (iTmp>>8) | (iTmp<<8); 412 iTmp = (iTmp>>8) | (iTmp<<8);
398 sOut.write( &iTmp, 2 ); 413 sOut.write( &iTmp, 2 );
399 for( Array<uint16_t>::iterator i = aData.begin(); i; i++ ) 414 for( Array<uint16_t>::const_iterator i = aData.begin(); i; i++ )
400 { 415 {
401 iTmp = *i; 416 iTmp = *i;
402 iTmp = (iTmp>>8) | (iTmp<<8); 417 iTmp = (iTmp>>8) | (iTmp<<8);
@@ -405,7 +420,7 @@ void Bu::UtfString::writeUtf16le( Bu::Stream &sOut )
405#endif 420#endif
406} 421}
407 422
408void Bu::UtfString::writeUtf32be( Bu::Stream &sOut ) 423void Bu::UtfString::writeUtf32be( Bu::Stream &sOut ) const
409{ 424{
410#if BYTE_ORDER == BIG_ENDIAN 425#if BYTE_ORDER == BIG_ENDIAN
411 uint32_t iTmp = 0xFEFF; // Byte Order Marker 426 uint32_t iTmp = 0xFEFF; // Byte Order Marker
@@ -430,7 +445,7 @@ void Bu::UtfString::writeUtf32be( Bu::Stream &sOut )
430#endif 445#endif
431} 446}
432 447
433void Bu::UtfString::writeUtf32le( Bu::Stream &sOut ) 448void Bu::UtfString::writeUtf32le( Bu::Stream &sOut ) const
434{ 449{
435#if BYTE_ORDER == LITTLE_ENDIAN 450#if BYTE_ORDER == LITTLE_ENDIAN
436 uint32_t iTmp = 0xFEFF; // Byte Order Marker 451 uint32_t iTmp = 0xFEFF; // Byte Order Marker
@@ -455,12 +470,12 @@ void Bu::UtfString::writeUtf32le( Bu::Stream &sOut )
455#endif 470#endif
456} 471}
457 472
458Bu::UtfChar Bu::UtfString::get( int iIndex ) 473Bu::UtfChar Bu::UtfString::get( int iIndex ) const
459{ 474{
460 return nextChar( iIndex ); 475 return nextChar( iIndex );
461} 476}
462 477
463Bu::UtfChar Bu::UtfString::nextChar( int &iIndex ) 478Bu::UtfChar Bu::UtfString::nextChar( int &iIndex ) const
464{ 479{
465 Bu::UtfChar i = aData[iIndex++]; 480 Bu::UtfChar i = aData[iIndex++];
466 switch( i&0xFC00 ) 481 switch( i&0xFC00 )
@@ -476,14 +491,31 @@ Bu::UtfChar Bu::UtfString::nextChar( int &iIndex )
476 } 491 }
477} 492}
478 493
479Bu::String Bu::UtfString::get( Encoding eEnc ) 494bool Bu::UtfString::operator==( const Bu::UtfString &rhs ) const
495{
496 return aData == rhs.aData;
497}
498
499Bu::UtfString &Bu::UtfString::operator+=( const Bu::UtfString &rhs )
500{
501 append( rhs );
502 return *this;
503}
504
505Bu::UtfString &Bu::UtfString::operator+=( const UtfChar &rhs )
506{
507 append( rhs );
508 return *this;
509}
510
511Bu::String Bu::UtfString::get( Encoding eEnc ) const
480{ 512{
481 Bu::MemBuf mb; 513 Bu::MemBuf mb;
482 write( mb, eEnc ); 514 write( mb, eEnc );
483 return mb.getString(); 515 return mb.getString();
484} 516}
485 517
486void Bu::UtfString::debug() 518void Bu::UtfString::debug() const
487{ 519{
488 sio << "Raw Utf16: "; 520 sio << "Raw Utf16: ";
489 for( int i = 0; i < aData.getSize(); i++ ) 521 for( int i = 0; i < aData.getSize(); i++ )
@@ -552,3 +584,21 @@ void Bu::UtfString::debugUtf8( const Bu::String &sUtf8 )
552 sio << sio.nl; 584 sio << sio.nl;
553} 585}
554*/ 586*/
587
588template<> uint32_t Bu::__calcHashCode<Bu::UtfString>( const Bu::UtfString &k )
589{
590 uint32_t uCode = 0;
591
592 for( Bu::UtfString::const_iterator i = k.begin(); i; i++ )
593 {
594 uCode = *i + (uCode<<6) + (uCode<<16) - uCode;
595 }
596
597 return uCode;
598}
599
600template<> bool Bu::__cmpHashKeys<Bu::UtfString>(
601 const Bu::UtfString &a, const Bu::UtfString &b )
602{
603 return a == b;
604}
diff --git a/src/unstable/utfstring.h b/src/unstable/utfstring.h
index af233e8..1bd4cce 100644
--- a/src/unstable/utfstring.h
+++ b/src/unstable/utfstring.h
@@ -72,10 +72,12 @@ namespace Bu
72 72
73 UtfString(); 73 UtfString();
74 UtfString( const Bu::String &sInput, Encoding eEnc=Utf8 ); 74 UtfString( const Bu::String &sInput, Encoding eEnc=Utf8 );
75 UtfString( const char *sInput, Encoding eEnc=Utf8 );
75 virtual ~UtfString(); 76 virtual ~UtfString();
76 77
77 class iterator 78 class iterator
78 { 79 {
80 friend class UtfString;
79 private: 81 private:
80 iterator( UtfString *pSrc, int iCodePos ) : 82 iterator( UtfString *pSrc, int iCodePos ) :
81 pSrc( pSrc ), iCodePos( iCodePos ) 83 pSrc( pSrc ), iCodePos( iCodePos )
@@ -92,13 +94,77 @@ namespace Bu
92 { 94 {
93 if( !pSrc ) 95 if( !pSrc )
94 throw Bu::ExceptionBase("invalid UtfString::iterator dereferenced."); 96 throw Bu::ExceptionBase("invalid UtfString::iterator dereferenced.");
95 return pSrc->nextChar( iCodePos ); 97 return pSrc->get( iCodePos );
98 }
99
100 iterator operator++()
101 {
102 pSrc->nextChar( iCodePos );
103 return *this;
104 }
105
106 iterator operator++( int )
107 {
108 pSrc->nextChar( iCodePos );
109 return *this;
110 }
111
112 operator bool() const
113 {
114 return iCodePos < pSrc->aData.getSize();
96 } 115 }
97 116
98 private: 117 private:
99 UtfString *pSrc; 118 UtfString *pSrc;
100 int iCodePos; 119 int iCodePos;
101 }; 120 };
121
122 class const_iterator
123 {
124 friend class UtfString;
125 private:
126 const_iterator( const UtfString *pSrc, int iCodePos ) :
127 pSrc( pSrc ), iCodePos( iCodePos )
128 {
129 }
130
131 public:
132 const_iterator() :
133 pSrc( NULL ), iCodePos( 0 )
134 {
135 }
136
137 UtfChar operator*()
138 {
139 if( !pSrc )
140 throw Bu::ExceptionBase("invalid UtfString::iterator dereferenced.");
141 return pSrc->get( iCodePos );
142 }
143
144 const_iterator operator++()
145 {
146 pSrc->nextChar( iCodePos );
147 return *this;
148 }
149
150 const_iterator operator++( int )
151 {
152 pSrc->nextChar( iCodePos );
153 return *this;
154 }
155
156 operator bool() const
157 {
158 return iCodePos < pSrc->aData.getSize();
159 }
160
161 private:
162 const UtfString *pSrc;
163 int iCodePos;
164 };
165
166 iterator begin();
167 const_iterator begin() const;
102 168
103 /** 169 /**
104 * Append a UtfChar (A unicode code point) to the string. This can be 170 * Append a UtfChar (A unicode code point) to the string. This can be
@@ -122,23 +188,23 @@ namespace Bu
122 * the provided stream. all Utf16 and Utf32 encodings will have the 188 * the provided stream. all Utf16 and Utf32 encodings will have the
123 * correct BOM (byte order marker) at the begining. 189 * correct BOM (byte order marker) at the begining.
124 */ 190 */
125 void write( Bu::Stream &sOut, Encoding eEnc=Utf8 ); 191 void write( Bu::Stream &sOut, Encoding eEnc=Utf8 ) const;
126 192
127 /** 193 /**
128 * This encodes the UtfString in the given encoding and returns it as 194 * This encodes the UtfString in the given encoding and returns it as
129 * a binary Bu::String. Like write, this also includes the proper BOM 195 * a binary Bu::String. Like write, this also includes the proper BOM
130 * at the begining. 196 * at the begining.
131 */ 197 */
132 Bu::String get( Encoding eEnc=Utf8 ); 198 Bu::String get( Encoding eEnc=Utf8 ) const;
133 199
134 void debug(); 200 void debug() const;
135 201
136 /** 202 /**
137 * This may or may not stick around, given an index, this returns a 203 * This may or may not stick around, given an index, this returns a
138 * codepoint, however there isn't necesarilly a 1:1 ratio between 204 * codepoint, however there isn't necesarilly a 1:1 ratio between
139 * indexes and code points. 205 * indexes and code points.
140 */ 206 */
141 UtfChar get( int iIndex ); 207 UtfChar get( int iIndex ) const;
142 208
143 /** 209 /**
144 * This is what to use if you want to iterate through a section of the 210 * This is what to use if you want to iterate through a section of the
@@ -147,7 +213,11 @@ namespace Bu
147 * will return the codepoint at that position and increment iIndex an 213 * will return the codepoint at that position and increment iIndex an
148 * appropriate amount for it to point to the next code point. 214 * appropriate amount for it to point to the next code point.
149 */ 215 */
150 UtfChar nextChar( int &iIndex ); 216 UtfChar nextChar( int &iIndex ) const;
217
218 bool operator==( const Bu::UtfString &rhs ) const;
219 UtfString &operator+=( const Bu::UtfString &rhs );
220 UtfString &operator+=( const UtfChar &rhs );
151 221
152 private: 222 private:
153 void append16( uint16_t i ) { aData.append( i ); } 223 void append16( uint16_t i ) { aData.append( i ); }
@@ -160,17 +230,30 @@ namespace Bu
160 void setUtf32be( const Bu::String &sInput ); 230 void setUtf32be( const Bu::String &sInput );
161 void setUtf32le( const Bu::String &sInput ); 231 void setUtf32le( const Bu::String &sInput );
162 232
163 void writeUtf8( Bu::Stream &sOut ); 233 void writeUtf8( Bu::Stream &sOut ) const;
164 void writeUtf16be( Bu::Stream &sOut ); 234 void writeUtf16be( Bu::Stream &sOut ) const;
165 void writeUtf16le( Bu::Stream &sOut ); 235 void writeUtf16le( Bu::Stream &sOut ) const;
166 void writeUtf32be( Bu::Stream &sOut ); 236 void writeUtf32be( Bu::Stream &sOut ) const;
167 void writeUtf32le( Bu::Stream &sOut ); 237 void writeUtf32le( Bu::Stream &sOut ) const;
168 238
169 private: 239 private:
170 Bu::Array<uint16_t> aData; 240 Bu::Array<uint16_t> aData;
171 int iRawLen; 241 int iRawLen;
172 int iCharLen; 242 int iCharLen;
173 }; 243 };
244
245 //
246 // Hash support
247 //
248 template<typename T>
249 uint32_t __calcHashCode( const T &k );
250
251 template<typename T>
252 bool __cmpHashKeys( const T &a, const T &b );
253
254 template<> uint32_t __calcHashCode<UtfString>( const UtfString &k );
255 template<> bool __cmpHashKeys<UtfString>(
256 const UtfString &a, const UtfString &b );
174}; 257};
175 258
176#endif 259#endif