Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AlphIO.h

Go to the documentation of this file.
00001 // AlphIO.h
00002 //
00004 //
00005 // Copyright (c) 2002 Iain Murray
00006 //
00008 
00009 
00010 #ifndef __AlphIO_h__
00011 #define __AlphIO_h__
00012 
00013 
00014 #include "DasherTypes.h"
00015 
00016 #include "MSVC_Unannoy.h"
00017 #include <string>
00018 #include <map>
00019 #include <vector>
00020 #include <utility> // for std::pair
00021 #include <stdio.h> // for C style file IO
00022 
00023 namespace Dasher {class CAlphIO;}
00024 class Dasher::CAlphIO
00025 {
00026 public:
00027         // This structure completely describes the characters used in alphabet
00028         struct AlphInfo
00029         {
00030                 // Basic information
00031                 std::string AlphID;
00032                 bool Mutable; // If from user we may play. If from system defaults this is immutable. User should take a copy.
00033                 
00034                 // Complete description of the alphabet:
00035                 std::string TrainingFile;
00036                 Opts::AlphabetTypes Encoding;
00037                 Opts::AlphabetTypes Type;
00038                 Opts::ScreenOrientations Orientation;
00039                 struct character
00040                 {
00041                         std::string Display;
00042                         std::string Text;
00043                         std::string Colour;
00044                         std::string Foreground;
00045                 };
00046                 struct group
00047                 {
00048                         std::string Description;
00049                         std::vector< character > Characters;
00050                 };
00051                 std::vector< group > Groups;
00052                 character SpaceCharacter; // display and edit text of Space character. Typically (" ", "_"). Use ("", "") if no space character.
00053         };
00054         
00055         CAlphIO(std::string SystemLocation, std::string UserLocation);
00056         void GetAlphabets(std::vector< std::string >* AlphabetList) const;
00057         const AlphInfo& GetInfo(const std::string& AlphID);
00058         void SetInfo(const AlphInfo& NewInfo);
00059         void Delete(const std::string& AlphID);
00060 private:
00061         AlphInfo BlankInfo;
00062         std::string SystemLocation;
00063         std::string UserLocation;
00064         std::map<std::string, AlphInfo> Alphabets; // map short names (file names) to descriptions
00065         
00066         void CreateDefault(); // Give the user an English alphabet rather than nothing if anything goes horribly wrong.
00067         
00068         
00069         // Alphabet types:
00070         std::map<std::string, Opts::AlphabetTypes> StoT;
00071         std::map<Opts::AlphabetTypes, std::string> TtoS;
00072         
00073         // Data gathered
00074         std::string CData; // Text gathered from when an elemnt starts to when it ends
00075         AlphInfo InputInfo;
00076         
00077 };
00078 
00079 
00080 #endif /* #ifndef __AlphIO_h__ */

Generated on Sat Nov 5 16:16:00 2005 for OPIE by  doxygen 1.4.2