moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / kvt-core / GrammerManager.h
blobc66edf637beed6437fe3e94d61b3c3d850c5e3d4
1 /***************************************************************************
3 $Id$
5 manage grammer parts (articles, conjugation)
7 -----------------------------------------------------------------------
9 begin : Sat Nov 27 09:50:53 MET 1999
11 copyright : (C) 1999-2001 Ewald Arnold
12 (C) 2001 The KDE-EDU team
13 email : kvoctrain@ewald-arnold.de
15 -----------------------------------------------------------------------
17 ***************************************************************************/
19 /***************************************************************************
20 * *
21 * This program is free software; you can redistribute it and/or modify *
22 * it under the terms of the GNU General Public License as published by *
23 * the Free Software Foundation; either version 2 of the License, or *
24 * (at your option) any later version. *
25 * *
26 ***************************************************************************/
29 #ifndef GrammerManager_included
30 #define GrammerManager_included
32 #include <qdatastream.h>
34 #include <vector>
35 using namespace std;
37 #define CONJ_SIMPLE_PRESENT "PrSi" // I live at home what you frequently do
38 #define CONJ_PRESENT_PROGR "PrPr" // I am working what you currently are doing
39 #define CONJ_PRESENT_PERFECT "PrPe" // I have cleaned tell, #that# something has happened
41 #define CONJ_SIMPLE_PAST "PaSi" // the train left 2 min ago when did it happen
42 #define CONJ_PAST_PROGR "PaPr" // it was raining what happen at a given time in the past
43 #define CONJ_PAST_PARTICIPLE "PaPa" // I cleaned tell, #that# it happened
45 #define CONJ_FUTURE "FuSi"
47 #define CONJ_PREFIX "--" // definition of prefixes (I, you, ..)
49 #define UL_USER_TENSE "#" // designates number of user tense
51 class Article
54 public:
56 Article() {}
58 Article (
59 const QString &fem_def, const QString &fem_indef,
60 const QString &mal_def, const QString &mal_indef,
61 const QString &nat_def, const QString &nat_indef
64 void setFemale (const QString &def, const QString &indef);
65 void setMale (const QString &def, const QString &indef);
66 void setNatural (const QString &def, const QString &indef);
68 void female (QString &def, QString &indef) const;
69 void male (QString &def, QString &indef) const;
70 void natural (QString &def, QString &indef) const;
72 protected:
74 QString fem_def, fem_indef,
75 mal_def, mal_indef,
76 nat_def, nat_indef;
80 class Comparison
83 public:
85 Comparison() {}
87 Comparison (
88 const QString &l1,
89 const QString &l2,
90 const QString &l3
93 void setL1 (const QString &s) { ls1 = s; }
94 void setL2 (const QString &s) { ls2 = s; }
95 void setL3 (const QString &s) { ls3 = s; }
97 QString l1 () const { return ls1; }
98 QString l2 () const { return ls2; }
99 QString l3 () const { return ls3; }
101 bool isEmpty() const;
102 void clear();
104 protected:
106 QString ls1, ls2, ls3;
110 class TenseRelation
112 public:
114 TenseRelation (const QString & _short, const QString & _long)
115 : shortId (_short), longId(_long) {}
117 inline QString shortStr() const { return shortId; }
118 inline QString longStr() const { return longId; }
120 protected:
122 QString shortId, longId;
126 class Conjugation
129 public:
131 Conjugation () {}
133 int numEntries() const;
135 static vector<TenseRelation> getRelation ();
136 static void setTenseNames (vector<QString> names);
138 static QString getName (const QString &abbrev);
139 static QString getName (int index);
140 static QString getAbbrev (const QString &name);
141 static QString getAbbrev (int index);
142 static int numInternalNames();
143 static int numTenses();
145 QString getType (int index);
146 void setType (int index, const QString & type);
147 void cleanUp();
148 bool isEmpty (int idx);
150 QString pers1Singular(const QString &type) const;
151 QString pers2Singular(const QString &type) const;
152 bool pers3SingularCommon(const QString &type) const;
153 QString pers3FemaleSingular(const QString &type) const;
154 QString pers3MaleSingular(const QString &type) const;
155 QString pers3NaturalSingular(const QString &type) const;
157 QString pers1Plural(const QString &type) const;
158 QString pers2Plural(const QString &type) const;
159 bool pers3PluralCommon(const QString &type) const;
160 QString pers3FemalePlural(const QString &type) const;
161 QString pers3MalePlural(const QString &type) const;
162 QString pers3NaturalPlural(const QString &type) const;
164 void setPers1Singular(const QString &type, const QString &str);
165 void setPers2Singular(const QString &type, const QString &str);
166 void setPers3SingularCommon(const QString &type, bool f);
167 void setPers3FemaleSingular(const QString &type, const QString &str);
168 void setPers3MaleSingular(const QString &type, const QString &str);
169 void setPers3NaturalSingular(const QString &type, const QString &str);
171 void setPers1Plural(const QString &type, const QString &str);
172 void setPers2Plural(const QString &type, const QString &str);
173 void setPers3PluralCommon(const QString &type, bool f);
174 void setPers3FemalePlural(const QString &type, const QString &str);
175 void setPers3MalePlural(const QString &type, const QString &str);
176 void setPers3NaturalPlural(const QString &type, const QString &str);
178 private:
180 struct conjug_t {
182 conjug_t() {
183 p3common = false;
184 s3common = false;
187 QString type;
188 bool p3common,
189 s3common;
190 QString pers1_sing,
191 pers2_sing,
192 pers3_m_sing,
193 pers3_f_sing,
194 pers3_n_sing,
195 pers1_plur,
196 pers2_plur,
197 pers3_m_plur,
198 pers3_f_plur,
199 pers3_n_plur;
202 struct conjug_name_t {
203 const char *abbrev;
204 const char *name;
207 protected:
209 vector<conjug_t> conjugations;
211 static conjug_name_t names [];
212 static vector<QString> userTenses;
216 #endif // GrammerManager_included