1 /* $Id: conjugation.h,v 1.12 2011/01/08 19:07:36 sarrazip Exp $
2 conjugation.h - Generic conjugation interface
4 verbiste - French conjugation system
5 Copyright (C) 2003-2006 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 #ifndef _H_conjugation
24 #define _H_conjugation
26 #include <verbiste/FrenchVerbDictionary.h>
30 #include <QtCore/QVector>
31 #include <QtCore/QString>
33 typedef std::vector<std::string> VS;
34 typedef std::vector<VS> VVS;
35 typedef std::vector<VVS> VVVS;
38 #include <QtCore/QElapsedTimer>
39 #include <QtCore/QDebug>
42 /** Obtains the conjugation of the given infinitive.
43 @param fvd verb dictionary from which to obtain
45 @param infinitive UTF-8 string containing the infinitive form
46 of the verb to conjugate (e.g., "manger")
47 @param tname conjugation template name to use (e.g., "aim:er")
48 @param dest structure into which the conjugated is written
49 @param includePronouns put pronouns before conjugated verbs in the
50 modes where pronouns are used
52 void getConjugation(const verbiste::FrenchVerbDictionary &fvd,
53 const std::string &infinitive,
54 const std::string &tname,
56 bool includePronouns = false);
59 /** Get the tense name for a certain cell of the conjugation table.
60 The conjugation table is a 4x4 grid and 11 of the 16 cells are
61 used by the tenses to be displayed.
62 @param row row number (0..3)
63 @param col column number (0..3)
64 @param isItalian language used (true for Italian, false for French)
65 @returns an internationalized (and possibly abbreviated) name
66 (in UTF-8) for the tense that goes in the cell
67 designated by row and col;
68 the returned string is empty if no tense (in the
69 language used) goes in the designated cell
71 std::string getTenseNameForTableCell(int row, int col, bool isItalian);
74 /** Composes the text of the conjugation in a certain tense.
75 The words of this conjugation that match a certain user text
78 @param tense structure that represents a certain
79 tense of a certain verb
80 @param lowerCaseUTF8UserText conjugated verb as entered by the
81 user, but converted to lower-case,
82 and assumed to be in UTF-8
83 @param openMark ASCII string to be used before verbs
84 that match lowerCaseUTF8UserText
86 @param closeMark ASCII string to be used after verbs
87 that match lowerCaseUTF8UserText
89 @returns a UTF-8 string containing several
90 lines of text, each line being
91 separated by a newline ('\n')
92 character; the string does not end
93 the last line with a newline however;
94 e.g., "aie\nayons\nayez"
96 std::string createTableCellText(verbiste::FrenchVerbDictionary &fvd,
98 const std::string &lowerCaseUTF8UserText,
99 const std::string &openMark,
100 const std::string &closeMark);
103 * Qt version of createTableCellText() above.
104 * Return a vertor of QStrings, which are conjugations.
106 QVector<QString> qgetConjugates(verbiste::FrenchVerbDictionary &fvd,
108 const std::string &lowerCaseUTF8UserText,
109 const std::string &openMark,
110 const std::string &closeMark);
111 #endif /* _H_conjugation */