summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/Alphabet.cpp
Unidiff
Diffstat (limited to 'inputmethods/dasher/Alphabet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/Alphabet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/inputmethods/dasher/Alphabet.cpp b/inputmethods/dasher/Alphabet.cpp
index dc58b35..6327d8a 100644
--- a/inputmethods/dasher/Alphabet.cpp
+++ b/inputmethods/dasher/Alphabet.cpp
@@ -1,58 +1,58 @@
1// Alphabet.cpp 1// Alphabet.cpp
2// 2//
3///////////////////////////////////////////////////////////////////////////// 3/////////////////////////////////////////////////////////////////////////////
4// 4//
5// Copyright (c) 2001-2002 David Ward 5// Copyright (c) 2001-2002 David Ward
6// 6//
7///////////////////////////////////////////////////////////////////////////// 7/////////////////////////////////////////////////////////////////////////////
8 8
9#include "Alphabet.h" 9#include "Alphabet.h"
10#include "AlphabetMap.h" 10#include "AlphabetMap.h"
11 11
12//#include <iostream> 12//#include <iostream>
13//WinCE doesn't have iostream! 13//WinCE doesn't have iostream!
14 14
15using namespace Dasher; 15using namespace Dasher;
16using namespace std; 16using namespace std;
17 17
18 18
19CAlphabet::CAlphabet() : m_Groups(0), m_DefaultEncoding(Opts::Western), m_Orientation(Opts::LeftToRight) 19CAlphabet::CAlphabet() : m_DefaultEncoding(Opts::Western), m_Orientation(Opts::LeftToRight), m_Groups(0)
20{ 20{
21 m_Characters.push_back(""); 21 m_Characters.push_back("");
22 m_Display.push_back(""); 22 m_Display.push_back("");
23 m_Colours.push_back(""); 23 m_Colours.push_back("");
24 m_Foreground.push_back(""); 24 m_Foreground.push_back("");
25 m_Group.push_back(0); 25 m_Group.push_back(0);
26} 26}
27 27
28 28
29void CAlphabet::GetSymbols(vector<symbol>* Symbols, string* Input, bool IsMore) 29void CAlphabet::GetSymbols(vector<symbol>* Symbols, string* Input, bool IsMore)
30{ 30{
31 string Tmp; 31 string Tmp;
32 symbol CurSymbol=0, TmpSymbol=0; 32 symbol CurSymbol=0, TmpSymbol=0;
33 bool KeyIsPrefix; 33 bool KeyIsPrefix;
34 int z= Input->size(); 34 // int z= Input->size();
35 int extras; 35 int extras;
36 unsigned int bit; 36 unsigned int bit;
37 37
38 for (unsigned int i=0; i<Input->size(); i++) { 38 for (unsigned int i=0; i<Input->size(); i++) {
39 39
40 Tmp = (*Input)[i]; 40 Tmp = (*Input)[i];
41 41
42 /* The string we've been given is in UTF-8. The symbols are 42 /* The string we've been given is in UTF-8. The symbols are
43 also in UTF-8, so we need to pass the entire UTF-8 character 43 also in UTF-8, so we need to pass the entire UTF-8 character
44 which may be several bytes long. RFC 2279 describes this 44 which may be several bytes long. RFC 2279 describes this
45 encoding */ 45 encoding */
46 46
47 if ((*Input)[i] & 0x80) { // Character is more than 1 byte long 47 if ((*Input)[i] & 0x80) { // Character is more than 1 byte long
48 extras = 1; 48 extras = 1;
49 for (bit = 0x20; ((*Input)[i] & bit) != 0; bit >>= 1) 49 for (bit = 0x20; ((*Input)[i] & bit) != 0; bit >>= 1)
50 extras++; 50 extras++;
51 if (extras > 5) { 51 if (extras > 5) {
52 } // Malformed character 52 } // Malformed character
53 while (extras-->0) { 53 while (extras-->0) {
54 Tmp += (*Input)[++i]; 54 Tmp += (*Input)[++i];
55 } 55 }
56 } 56 }
57 57
58 CurSymbol = TextMap.Get(Tmp, &KeyIsPrefix); 58 CurSymbol = TextMap.Get(Tmp, &KeyIsPrefix);