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

scancodemap.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: scancodemap.h,v 1.4 2003/11/14 14:05:51 fruit Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #ifndef KEROSIN_SCANCODEMAP_H
00023 #define KEROSIN_SCANCODEMAP_H
00024 
00025 /*      \class ScanCodeMap
00026         $Id: scancodemap.h,v 1.4 2003/11/14 14:05:51 fruit Exp $
00027 
00028         ScanCodeMap
00029 
00030         This object can be used to translate from characters to scancodes and vice
00031         versa. It is necessary to allow for country specific keyboard layouts.
00032 
00033         NOTE:
00034 
00035         HISTORY:
00036                 30.09.02 - MK
00037                         - Initial version
00038 
00039         TODO:
00040 
00041         TOFIX:
00042 */
00043 
00044 #include <map>
00045 #include "inputserver.h"
00046 
00047 namespace kerosin
00048 {
00049 
00050 class ScanCodeMap
00051 {
00052     //
00053     // types
00054     //
00055 public:
00056     // character representations of the scancode this struct is associated with
00057     // the altModifier is only really used on German keyboards
00058     struct TScanCodeEntry
00059     {
00060         std::string name;                       // name of the key
00061         char            noModifier;             // no modifiers         '<'
00062         char            shiftModifier;  // shift modifier       '>'
00063         char            altModifier;    // alt modifier         '|'
00064 
00065         void Set(const std::string &keyName, char noMod, char shiftMod, char altMod)
00066         {
00067             name = keyName;
00068             noModifier = noMod;
00069             shiftModifier = shiftMod;
00070             altModifier = altMod;
00071         }
00072     };
00073 protected:
00074     typedef std::map<kerosin::InputServer::TInputCode, TScanCodeEntry*>     TScanCodeEntryMap;
00075     //
00076     // functions
00077     //
00078 public:
00079     ScanCodeMap();
00080     ~ScanCodeMap();
00081 
00082     InputServer::TInputCode GetCode(const std::string &name) const;
00083     bool                                    TranslateCode(InputServer::TInputCode code, unsigned long state, char &ch) const;
00084 
00085     void                                    Reset();
00086     void                                    AddCode(InputServer::TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod);
00087 protected:
00089     TScanCodeEntryMap       mScanCodes;
00090 };
00091 
00092 } //namespace kerosin
00093 
00094 #endif //KEROSIN_SCANCODEMAP_H

Generated on Thu Apr 6 15:25:39 2006 for rcssserver3d by  doxygen 1.4.4