summaryrefslogtreecommitdiffstats
path: root/kvoctrain/kvoctrain/kvt-core/langset.h
blob: f0da2a5a6aff5a0e0845ea98316d4da28b6d4c65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***************************************************************************

                     properties for a language

    -----------------------------------------------------------------------

    begin                : Thu Mar 11 20:50:53 MET 1999

    copyright            : (C) 1999-2001 Ewald Arnold
                           (C) 2001 The KDE-EDU team

    email                : kvoctrain@ewald-arnold.de

    -----------------------------------------------------------------------

 ***************************************************************************

 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/



#ifndef langset_h
#define langset_h

#include <vector>
using namespace std;

#include <qstring.h>


class LangSet
{
 public:

   LangSet () {}

   void addSet (QString shortId, QString longId, QString PixMapFile,
		const QString& shortId2 = QString::null,
		const QString& keyboardLayout = QString::null);

/*    void addSet (QString shortId, QString shortId2, QString longId, */
/* 		QString PixMapFile,  */
/* 		const QString& keyboardLayout = QString::null); */

   void appendSet(const LangSet &set);

   unsigned int size () const { return langs.size(); }
   void erase (int idx);
   void clear ();

   QString shortId (int index) const;
   QString shortId2 (int index) const;
   QString longId (int index) const;
   QString PixMapFile (int index) const;
   QString keyboardLayout (int index) const;

   int indexShortId (QString shortId) const;
   int indexLongId (QString longId) const;
   int indexPixMapFile (QString PixMapFile) const;
   // doesn't make sense for keyboard layouts since there is no 1-to-1 relation to languages

   void setShortId (const QString & shortId, int index);
   void setShortId2 (const QString & shortId2, int index);
   void setLongId (const QString & longId, int index);
   void setPixMapFile (const QString & PixMapFile, int index);
   void setKeyboardLayout(const QString & layout, int index);

   QString findShortId (const QString & longId)  const;
   QString findLongId  (const QString & shortId) const;

 private:

   struct LangDef {
     QString shortId,
             shortId2,
             longId,
       PixMapFile,
       keyboardLayout;
   };

   vector<LangDef> langs;
};


#endif // langset_h