f940a3cdb6713a735461ccdc347a625c0d6e2996
[mverbiste] / gui / conjugation.h
1 /*  $Id: conjugation.h,v 1.12 2011/01/08 19:07:36 sarrazip Exp $
2     conjugation.h - Generic conjugation interface
3
4     verbiste - French conjugation system
5     Copyright (C) 2003-2006 Pierre Sarrazin <http://sarrazip.com/>
6
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.
11
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.
16
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
20     02111-1307, USA.
21 */
22
23 #ifndef _H_conjugation
24 #define _H_conjugation
25
26 #include <verbiste/FrenchVerbDictionary.h>
27
28 #include <vector>
29 #include <string>
30
31 typedef std::vector<std::string> VS;
32 typedef std::vector<VS> VVS;
33 typedef std::vector<VVS> VVVS;
34
35
36
37 /** Obtains the conjugation of the given infinitive.
38     @param  fvd             verb dictionary from which to obtain
39                             the conjugation
40     @param  infinitive      UTF-8 string containing the infinitive form
41                             of the verb to conjugate (e.g., "manger")
42     @param  tname           conjugation template name to use (e.g., "aim:er")
43     @param  dest            structure into which the conjugated is written
44     @param  includePronouns put pronouns before conjugated verbs in the
45                             modes where pronouns are used
46 */
47 void getConjugation(const verbiste::FrenchVerbDictionary &fvd,
48                         const std::string &infinitive,
49                         const std::string &tname,
50                         VVVS &dest,
51                         bool includePronouns = false);
52
53
54 /** Get the tense name for a certain cell of the conjugation table.
55     The conjugation table is a 4x4 grid and 11 of the 16 cells are
56     used by the tenses to be displayed.
57     @param      row             row number (0..3)
58     @param      col             column number (0..3)
59     @param      isItalian       language used (true for Italian, false for French)
60     @returns            an internationalized (and possibly abbreviated) name
61                         (in UTF-8) for the tense that goes in the cell
62                         designated by row and col;
63                         the returned string is empty if no tense (in the
64                         language used) goes in the designated cell
65 */
66 std::string getTenseNameForTableCell(int row, int col, bool isItalian);
67
68
69 /** Composes the text of the conjugation in a certain tense.
70     The words of this conjugation that match a certain user text
71     are marked specially.
72
73     @param        tense                 structure that represents a certain
74                                         tense of a certain verb
75     @param        lowerCaseUTF8UserText conjugated verb as entered by the
76                                         user, but converted to lower-case,
77                                         and assumed to be in UTF-8
78     @param        openMark              ASCII string to be used before verbs
79                                         that match lowerCaseUTF8UserText
80                                         (e.g., "<b>")
81     @param        closeMark             ASCII string to be used after verbs
82                                         that match lowerCaseUTF8UserText
83                                         (e.g., "</b>")
84     @returns                            a UTF-8 string containing several
85                                         lines of text, each line being
86                                         separated by a newline ('\n')
87                                         character; the string does not end
88                                         the last line with a newline however;
89                                         e.g., "aie\nayons\nayez"
90 */
91 std::string createTableCellText(verbiste::FrenchVerbDictionary &fvd,
92                                 const VVS &tense,
93                                 const std::string &lowerCaseUTF8UserText,
94                                 const std::string &openMark,
95                                 const std::string &closeMark);
96
97
98 #endif  /* _H_conjugation */