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>
33 typedef std::vector<std::string> VS;
34 typedef std::vector<VS> VVS;
35 typedef std::vector<VVS> VVVS;
39 /** Obtains the conjugation of the given infinitive.
40 @param fvd verb dictionary from which to obtain
42 @param infinitive UTF-8 string containing the infinitive form
43 of the verb to conjugate (e.g., "manger")
44 @param tname conjugation template name to use (e.g., "aim:er")
45 @param dest structure into which the conjugated is written
46 @param includePronouns put pronouns before conjugated verbs in the
47 modes where pronouns are used
49 void getConjugation(const verbiste::FrenchVerbDictionary &fvd,
50 const std::string &infinitive,
51 const std::string &tname,
53 bool includePronouns = false);
56 /** Get the tense name for a certain cell of the conjugation table.
57 The conjugation table is a 4x4 grid and 11 of the 16 cells are
58 used by the tenses to be displayed.
59 @param row row number (0..3)
60 @param col column number (0..3)
61 @param isItalian language used (true for Italian, false for French)
62 @returns an internationalized (and possibly abbreviated) name
63 (in UTF-8) for the tense that goes in the cell
64 designated by row and col;
65 the returned string is empty if no tense (in the
66 language used) goes in the designated cell
68 std::string getTenseNameForTableCell(int row, int col, bool isItalian);
71 /** Composes the text of the conjugation in a certain tense.
72 The words of this conjugation that match a certain user text
75 @param tense structure that represents a certain
76 tense of a certain verb
77 @param lowerCaseUTF8UserText conjugated verb as entered by the
78 user, but converted to lower-case,
79 and assumed to be in UTF-8
80 @param openMark ASCII string to be used before verbs
81 that match lowerCaseUTF8UserText
83 @param closeMark ASCII string to be used after verbs
84 that match lowerCaseUTF8UserText
86 @returns a UTF-8 string containing several
87 lines of text, each line being
88 separated by a newline ('\n')
89 character; the string does not end
90 the last line with a newline however;
91 e.g., "aie\nayons\nayez"
93 std::string createTableCellText(verbiste::FrenchVerbDictionary &fvd,
95 const std::string &lowerCaseUTF8UserText,
96 const std::string &openMark,
97 const std::string &closeMark);
100 * Qt version of createTableCellText() above.
101 * Return a vertor of QStrings, which are conjugations.
103 QVector<QString> qgetConjugates(verbiste::FrenchVerbDictionary &fvd,
105 const std::string &lowerCaseUTF8UserText,
106 const std::string &openMark,
107 const std::string &closeMark);
108 #endif /* _H_conjugation */