summary refs log tree commit diff stats
path: root/lib/word.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/word.h')
-rw-r--r--lib/word.h100
1 files changed, 50 insertions, 50 deletions
diff --git a/lib/word.h b/lib/word.h index 7b3c0f7..ddcabe4 100644 --- a/lib/word.h +++ b/lib/word.h
@@ -12,157 +12,157 @@
12struct sqlite3_stmt; 12struct sqlite3_stmt;
13 13
14namespace verbly { 14namespace verbly {
15 15
16 class database; 16 class database;
17 17
18 class word { 18 class word {
19 public: 19 public:
20 20
21 // Default constructor 21 // Default constructor
22 22
23 word() = default; 23 word() = default;
24 24
25 // Construct from database 25 // Construct from database
26 26
27 word(const database& db, sqlite3_stmt* row); 27 word(const database& db, sqlite3_stmt* row);
28 28
29 // Accessors 29 // Accessors
30 30
31 operator bool() const 31 operator bool() const
32 { 32 {
33 return valid_; 33 return valid_;
34 } 34 }
35 35
36 int getId() const 36 int getId() const
37 { 37 {
38 if (!valid_) 38 if (!valid_)
39 { 39 {
40 throw std::domain_error("Bad access to uninitialized word"); 40 throw std::domain_error("Bad access to uninitialized word");
41 } 41 }
42 42
43 return id_; 43 return id_;
44 } 44 }
45 45
46 bool hasTagCount() const 46 bool hasTagCount() const
47 { 47 {
48 if (!valid_) 48 if (!valid_)
49 { 49 {
50 throw std::domain_error("Bad access to uninitialized word"); 50 throw std::domain_error("Bad access to uninitialized word");
51 } 51 }
52 52
53 return hasTagCount_; 53 return hasTagCount_;
54 } 54 }
55 55
56 int getTagCount() const 56 int getTagCount() const
57 { 57 {
58 if (!valid_) 58 if (!valid_)
59 { 59 {
60 throw std::domain_error("Bad access to uninitialized word"); 60 throw std::domain_error("Bad access to uninitialized word");
61 } 61 }
62 62
63 if (!hasTagCount_) 63 if (!hasTagCount_)
64 { 64 {
65 throw std::domain_error("Word has no tag count"); 65 throw std::domain_error("Word has no tag count");
66 } 66 }
67 67
68 return tagCount_; 68 return tagCount_;
69 } 69 }
70 70
71 bool hasAdjectivePositioning() const 71 bool hasAdjectivePositioning() const
72 { 72 {
73 if (!valid_) 73 if (!valid_)
74 { 74 {
75 throw std::domain_error("Bad access to uninitialized word"); 75 throw std::domain_error("Bad access to uninitialized word");
76 } 76 }
77 77
78 return (adjectivePosition_ != positioning::undefined); 78 return (adjectivePosition_ != positioning::undefined);
79 } 79 }
80 80
81 positioning getAdjectivePosition() const 81 positioning getAdjectivePosition() const
82 { 82 {
83 if (!valid_) 83 if (!valid_)
84 { 84 {
85 throw std::domain_error("Bad access to uninitialized word"); 85 throw std::domain_error("Bad access to uninitialized word");
86 } 86 }
87 87
88 if (adjectivePosition_ == positioning::undefined) 88 if (adjectivePosition_ == positioning::undefined)
89 { 89 {
90 throw std::domain_error("Word has no adjective position"); 90 throw std::domain_error("Word has no adjective position");
91 } 91 }
92 92
93 return adjectivePosition_; 93 return adjectivePosition_;
94 } 94 }
95 95
96 const notion& getNotion() const; 96 const notion& getNotion() const;
97 97
98 const lemma& getLemma() const; 98 const lemma& getLemma() const;
99 99
100 bool hasGroup() const 100 bool hasGroup() const
101 { 101 {
102 if (!valid_) 102 if (!valid_)
103 { 103 {
104 throw std::domain_error("Bad access to uninitialized word"); 104 throw std::domain_error("Bad access to uninitialized word");
105 } 105 }
106 106
107 return hasGroup_; 107 return hasGroup_;
108 } 108 }
109 109
110 const group& getGroup() const; 110 const group& getGroup() const;
111 111
112 // Convenience accessors 112 // Convenience accessors
113 113
114 std::string getBaseForm() const; 114 std::string getBaseForm() const;
115 115
116 std::vector<std::string> getInflections(inflection infl) const; 116 std::vector<std::string> getInflections(inflection infl) const;
117 117
118 // Type info 118 // Type info
119 119
120 static const object objectType; 120 static const object objectType;
121 121
122 static const std::list<std::string> select; 122 static const std::list<std::string> select;
123 123
124 // Query fields 124 // Query fields
125 125
126 static const field id; 126 static const field id;
127 static const field tagCount; 127 static const field tagCount;
128 static const field adjectivePosition; 128 static const field adjectivePosition;
129 129
130 operator filter() const 130 operator filter() const
131 { 131 {
132 return (id == id_); 132 return (id == id_);
133 } 133 }
134 134
135 // Relationships with other objects 135 // Relationships with other objects
136 136
137 static const field notion; 137 static const field notion;
138 static const field lemma; 138 static const field lemma;
139 static const field group; 139 static const field group;
140 140
141 // Relationships with self 141 // Relationships with self
142 142
143 static const field antonyms; 143 static const field antonyms;
144 144
145 static const field specifications; 145 static const field specifications;
146 static const field generalizations; 146 static const field generalizations;
147 147
148 static const field pertainyms; 148 static const field pertainyms;
149 static const field antiPertainyms; 149 static const field antiPertainyms;
150 150
151 static const field mannernyms; 151 static const field mannernyms;
152 static const field antiMannernyms; 152 static const field antiMannernyms;
153 153
154 static const field usageTerms; 154 static const field usageTerms;
155 static const field usageDomains; 155 static const field usageDomains;
156 156
157 static const field topicalTerms; 157 static const field topicalTerms;
158 static const field topicalDomains; 158 static const field topicalDomains;
159 159
160 static const field regionalTerms; 160 static const field regionalTerms;
161 static const field regionalDomains; 161 static const field regionalDomains;
162 162
163 private: 163 private:
164 bool valid_ = false; 164 bool valid_ = false;
165 165
166 int id_; 166 int id_;
167 bool hasTagCount_ = false; 167 bool hasTagCount_ = false;
168 int tagCount_; 168 int tagCount_;
@@ -171,15 +171,15 @@ namespace verbly {
171 int lemmaId_; 171 int lemmaId_;
172 bool hasGroup_ = false; 172 bool hasGroup_ = false;
173 int groupId_; 173 int groupId_;
174 174
175 const database* db_; 175 const database* db_;
176 176
177 mutable class notion notion_; 177 mutable class notion notion_;
178 mutable class lemma lemma_; 178 mutable class lemma lemma_;
179 mutable class group group_; 179 mutable class group group_;
180 180
181 }; 181 };
182 182
183}; 183};
184 184
185#endif /* end of include guard: WORD_H_DF91B1B4 */ 185#endif /* end of include guard: WORD_H_DF91B1B4 */