author | wimpie <wimpie> | 2004-04-09 18:04:30 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-09 18:04:30 (UTC) |
commit | 028717962deec0c2ff0e382221cbc2242393b79e (patch) (side-by-side diff) | |
tree | a5f00a3b3d229f838b6e40e34ca12f248b317813 /inputmethods/dasher/AlphabetMap.cpp | |
parent | d17b9f7b64e004dcc301866f8122171218553b42 (diff) | |
download | opie-028717962deec0c2ff0e382221cbc2242393b79e.zip opie-028717962deec0c2ff0e382221cbc2242393b79e.tar.gz opie-028717962deec0c2ff0e382221cbc2242393b79e.tar.bz2 |
Removed warnings about initialization sequence in constructores
and unused variables and arguments
Diffstat (limited to 'inputmethods/dasher/AlphabetMap.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/dasher/AlphabetMap.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/inputmethods/dasher/AlphabetMap.cpp b/inputmethods/dasher/AlphabetMap.cpp index 09e2c72..c687e45 100644 --- a/inputmethods/dasher/AlphabetMap.cpp +++ b/inputmethods/dasher/AlphabetMap.cpp @@ -1,86 +1,86 @@ // AlphabetMap.cpp // ///////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002 Iain Murray // ///////////////////////////////////////////////////////////////////////////// #include "AlphabetMap.h" using namespace Dasher; using namespace std; alphabet_map::alphabet_map(unsigned int InitialTableSize) - : Undefined(0), HashTable(InitialTableSize<<1) + : HashTable(InitialTableSize<<1), Undefined(0) { Entries.reserve(InitialTableSize); } void alphabet_map::Add(const string& Key, symbol Value) { RecursiveAdd(Key, Value, false); } void alphabet_map::RecursiveAdd(const string& Key, symbol Value, bool PrefixFlag) { Entry*& HashEntry = HashTable[Hash(Key)]; // Loop through Entries with the correct Hash value. for (Entry* i = HashEntry; i; i=i->Next) { if (i->Key==Key) { if (PrefixFlag) { // Just tagging - don't change symbol. Recurse if necessary i->KeyIsPrefix = true; if (Key.size()>1) RecursiveAdd(Key.substr(Key.size()-1), Undefined, true); } else { // Add symbol and leave i->Symbol = Value; } return; } } // When hash table gets 1/2 full... // (no I haven't optimised when to resize) if (Entries.size()<<1 >= HashTable.size()) { // Double up all the storage HashTable.clear(); HashTable.resize(Entries.size()<<2); Entries.reserve(Entries.size()<<1); // Rehash as the pointers will all be mangled. for (uint j=0; j<Entries.size(); j++) { Entry*& HashEntry2 = HashTable[Hash(Entries[j].Key)]; Entries[j].Next = HashEntry2; HashEntry2 = &Entries[j]; } // Have to recall this function as the key's hash needs recalculating RecursiveAdd(Key, Value, PrefixFlag); return; } Entries.push_back(Entry(Key, Value, HashEntry)); HashEntry = &Entries.back(); } symbol alphabet_map::Get(const string& Key, bool* KeyIsPrefix) const { // Loop through Entries with the correct Hash value. for (Entry* i = HashTable[Hash(Key)]; i; i=i->Next) { if (i->Key==Key) { if (KeyIsPrefix!=0) *KeyIsPrefix = i->KeyIsPrefix; return i->Symbol; } } if (KeyIsPrefix!=0) *KeyIsPrefix = false; return Undefined; } |