diff options
Diffstat (limited to 'generator/word.h')
-rw-r--r-- | generator/word.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/generator/word.h b/generator/word.h new file mode 100644 index 0000000..bfed586 --- /dev/null +++ b/generator/word.h | |||
@@ -0,0 +1,110 @@ | |||
1 | #ifndef WORD_H_91F99D46 | ||
2 | #define WORD_H_91F99D46 | ||
3 | |||
4 | #include <cassert> | ||
5 | #include "enums.h" | ||
6 | |||
7 | namespace verbly { | ||
8 | namespace generator { | ||
9 | |||
10 | class notion; | ||
11 | class lemma; | ||
12 | class database; | ||
13 | class group; | ||
14 | |||
15 | class word { | ||
16 | public: | ||
17 | |||
18 | // Constructors | ||
19 | |||
20 | word(notion& n, lemma& l); | ||
21 | |||
22 | word(notion& n, lemma& l, int tagCount); | ||
23 | |||
24 | // Mutators | ||
25 | |||
26 | void setAdjectivePosition(positioning adjectivePosition); | ||
27 | |||
28 | void setVerbGroup(const group& verbGroup); | ||
29 | |||
30 | // Accessors | ||
31 | |||
32 | int getId() const | ||
33 | { | ||
34 | return id_; | ||
35 | } | ||
36 | |||
37 | notion& getNotion() | ||
38 | { | ||
39 | return notion_; | ||
40 | } | ||
41 | |||
42 | const notion& getNotion() const | ||
43 | { | ||
44 | return notion_; | ||
45 | } | ||
46 | |||
47 | lemma& getLemma() | ||
48 | { | ||
49 | return lemma_; | ||
50 | } | ||
51 | |||
52 | const lemma& getLemma() const | ||
53 | { | ||
54 | return lemma_; | ||
55 | } | ||
56 | |||
57 | bool hasTagCount() const | ||
58 | { | ||
59 | return hasTagCount_; | ||
60 | } | ||
61 | |||
62 | int getTagCount() const | ||
63 | { | ||
64 | // Calling code should always call hasTagCount first. | ||
65 | assert(hasTagCount_); | ||
66 | |||
67 | return tagCount_; | ||
68 | } | ||
69 | |||
70 | positioning getAdjectivePosition() const | ||
71 | { | ||
72 | return adjectivePosition_; | ||
73 | } | ||
74 | |||
75 | bool hasVerbGroup() const | ||
76 | { | ||
77 | return (verbGroup_ != nullptr); | ||
78 | } | ||
79 | |||
80 | const group& getVerbGroup() const | ||
81 | { | ||
82 | // Calling code should always call hasVerbGroup first. | ||
83 | assert(verbGroup_ != nullptr); | ||
84 | |||
85 | return *verbGroup_; | ||
86 | } | ||
87 | |||
88 | private: | ||
89 | |||
90 | static int nextId_; | ||
91 | |||
92 | const int id_; | ||
93 | notion& notion_; | ||
94 | lemma& lemma_; | ||
95 | const int tagCount_ = 0; | ||
96 | const bool hasTagCount_ = false; | ||
97 | |||
98 | positioning adjectivePosition_ = positioning::undefined; | ||
99 | const group* verbGroup_ = nullptr; | ||
100 | |||
101 | }; | ||
102 | |||
103 | // Serializer | ||
104 | |||
105 | database& operator<<(database& db, const word& arg); | ||
106 | |||
107 | }; | ||
108 | }; | ||
109 | |||
110 | #endif /* end of include guard: WORD_H_91F99D46 */ | ||