1 /* $Id: misc-types.cpp,v 1.10 2010/07/04 05:49:51 sarrazip Exp $
2 misc-types.cpp - Miscellaneous types used by the dictionary class.
4 verbiste - French conjugation system
5 Copyright (C) 2003-2010 Pierre Sarrazin <http://sarrazip.com/>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 #include <verbiste/misc-types.h>
24 #include <verbiste/FrenchVerbDictionary.h>
27 using namespace verbiste;
31 ModeTensePersonNumber::set(const char *modeName,
32 const char *tenseName,
38 mode = FrenchVerbDictionary::convertModeName(modeName);
39 tense = FrenchVerbDictionary::convertTenseName(tenseName);
41 if (mode == IMPERATIVE_MODE)
47 case 1: person = 2; plural = false; break;
48 case 2: person = 3; plural = false; break;
49 case 3: person = 1; plural = true; break;
50 case 4: person = 2; plural = true; break;
51 case 5: person = 3; plural = true; break;
52 default: assert(false); person = 0; plural = false;
62 else if (personNum == 2)
67 else if (personNum == 3)
79 else if (mode == INFINITIVE_MODE
80 || mode == INVALID_MODE
81 || personNum < 1 || personNum > 6)
86 else if (mode == PARTICIPLE_MODE)
88 assert(personNum >= 1 && personNum <= 4);
89 person = static_cast<unsigned char>(personNum <= 2 ? 4 : 5);
90 // convention: 4=masculine, 5=feminine
91 plural = (personNum == 2 || personNum == 4);
93 else if (mode == GERUND_MODE)
100 person = static_cast<unsigned char>((personNum - 1) % 3 + 1);
101 plural = (personNum > 3);
107 ModeTensePersonNumber::dump(Verbiste_ModeTensePersonNumber &destination) const
109 destination.mode = (Verbiste_Mode) mode;
110 destination.tense = (Verbiste_Tense) tense;
111 destination.person = (int) person;
112 destination.plural = (int) plural;
113 destination.correct = (int) correct;