summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/AlphIO.h
Unidiff
Diffstat (limited to 'inputmethods/dasher/AlphIO.h') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/AlphIO.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/inputmethods/dasher/AlphIO.h b/inputmethods/dasher/AlphIO.h
new file mode 100644
index 0000000..ad31554
--- a/dev/null
+++ b/inputmethods/dasher/AlphIO.h
@@ -0,0 +1,80 @@
1// AlphIO.h
2//
3/////////////////////////////////////////////////////////////////////////////
4//
5// Copyright (c) 2002 Iain Murray
6//
7/////////////////////////////////////////////////////////////////////////////
8
9
10#ifndef __AlphIO_h__
11#define __AlphIO_h__
12
13
14#include "DasherTypes.h"
15
16#include "MSVC_Unannoy.h"
17#include <string>
18#include <map>
19#include <vector>
20#include <utility> // for std::pair
21#include <stdio.h> // for C style file IO
22
23namespace Dasher {class CAlphIO;}
24class Dasher::CAlphIO
25{
26public:
27 // This structure completely describes the characters used in alphabet
28 struct AlphInfo
29 {
30 // Basic information
31 std::string AlphID;
32 bool Mutable; // If from user we may play. If from system defaults this is immutable. User should take a copy.
33
34 // Complete description of the alphabet:
35 std::string TrainingFile;
36 Opts::AlphabetTypes Encoding;
37 Opts::AlphabetTypes Type;
38 Opts::ScreenOrientations Orientation;
39 struct character
40 {
41 std::string Display;
42 std::string Text;
43 std::string Colour;
44 std::string Foreground;
45 };
46 struct group
47 {
48 std::string Description;
49 std::vector< character > Characters;
50 };
51 std::vector< group > Groups;
52 character SpaceCharacter; // display and edit text of Space character. Typically (" ", "_"). Use ("", "") if no space character.
53 };
54
55 CAlphIO(std::string SystemLocation, std::string UserLocation);
56 void GetAlphabets(std::vector< std::string >* AlphabetList) const;
57 const AlphInfo& GetInfo(const std::string& AlphID);
58 void SetInfo(const AlphInfo& NewInfo);
59 void Delete(const std::string& AlphID);
60private:
61 AlphInfo BlankInfo;
62 std::string SystemLocation;
63 std::string UserLocation;
64 std::map<std::string, AlphInfo> Alphabets; // map short names (file names) to descriptions
65
66 void CreateDefault(); // Give the user an English alphabet rather than nothing if anything goes horribly wrong.
67
68
69 // Alphabet types:
70 std::map<std::string, Opts::AlphabetTypes> StoT;
71 std::map<Opts::AlphabetTypes, std::string> TtoS;
72
73 // Data gathered
74 std::string CData; // Text gathered from when an elemnt starts to when it ends
75 AlphInfo InputInfo;
76
77};
78
79
80#endif /* #ifndef __AlphIO_h__ */