diff options
Diffstat (limited to 'lib/lemma.h')
| -rw-r--r-- | lib/lemma.h | 97 |
1 files changed, 0 insertions, 97 deletions
| diff --git a/lib/lemma.h b/lib/lemma.h deleted file mode 100644 index bba5572..0000000 --- a/lib/lemma.h +++ /dev/null | |||
| @@ -1,97 +0,0 @@ | |||
| 1 | #ifndef LEMMA_H_0A180D30 | ||
| 2 | #define LEMMA_H_0A180D30 | ||
| 3 | |||
| 4 | #include <stdexcept> | ||
| 5 | #include <vector> | ||
| 6 | #include <list> | ||
| 7 | #include <map> | ||
| 8 | #include "field.h" | ||
| 9 | #include "form.h" | ||
| 10 | #include "enums.h" | ||
| 11 | #include "filter.h" | ||
| 12 | |||
| 13 | struct sqlite3_stmt; | ||
| 14 | |||
| 15 | namespace verbly { | ||
| 16 | |||
| 17 | class database; | ||
| 18 | |||
| 19 | class lemma { | ||
| 20 | public: | ||
| 21 | |||
| 22 | // Default constructor | ||
| 23 | |||
| 24 | lemma() = default; | ||
| 25 | |||
| 26 | // Construct from database | ||
| 27 | |||
| 28 | lemma(const database& db, sqlite3_stmt* row); | ||
| 29 | |||
| 30 | // Accessors | ||
| 31 | |||
| 32 | operator bool() const | ||
| 33 | { | ||
| 34 | return valid_; | ||
| 35 | } | ||
| 36 | |||
| 37 | int getId() const | ||
| 38 | { | ||
| 39 | if (!valid_) | ||
| 40 | { | ||
| 41 | throw std::domain_error("Bad access to uninitialized lemma"); | ||
| 42 | } | ||
| 43 | |||
| 44 | return id_; | ||
| 45 | } | ||
| 46 | |||
| 47 | const form& getBaseForm() const; | ||
| 48 | |||
| 49 | bool hasInflection(inflection category) const; | ||
| 50 | |||
| 51 | const std::vector<form>& getInflections(inflection category) const; | ||
| 52 | |||
| 53 | // Type info | ||
| 54 | |||
| 55 | static const object objectType; | ||
| 56 | |||
| 57 | static const std::list<std::string> select; | ||
| 58 | |||
| 59 | // Query fields | ||
| 60 | |||
| 61 | static const field id; | ||
| 62 | |||
| 63 | operator filter() const | ||
| 64 | { | ||
| 65 | if (!valid_) | ||
| 66 | { | ||
| 67 | throw std::domain_error("Bad access to uninitialized lemma"); | ||
| 68 | } | ||
| 69 | |||
| 70 | return (id == id_); | ||
| 71 | } | ||
| 72 | |||
| 73 | // Relationships to other objects | ||
| 74 | |||
| 75 | static const field words; | ||
| 76 | |||
| 77 | static field forms(inflection category); | ||
| 78 | |||
| 79 | private: | ||
| 80 | |||
| 81 | void initializeForm(inflection category) const; | ||
| 82 | |||
| 83 | bool valid_ = false; | ||
| 84 | |||
| 85 | int id_; | ||
| 86 | |||
| 87 | mutable std::map<inflection, std::vector<form>> forms_; | ||
| 88 | |||
| 89 | const database* db_; | ||
| 90 | |||
| 91 | static const field inflectionCategory; | ||
| 92 | |||
| 93 | }; | ||
| 94 | |||
| 95 | }; | ||
| 96 | |||
| 97 | #endif /* end of include guard: LEMMA_H_0A180D30 */ | ||
