diff options
Diffstat (limited to 'lib/form.cpp')
| -rw-r--r-- | lib/form.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
| diff --git a/lib/form.cpp b/lib/form.cpp index 5d4c343..4811f14 100644 --- a/lib/form.cpp +++ b/lib/form.cpp | |||
| @@ -16,11 +16,9 @@ namespace verbly { | |||
| 16 | const field form::complexity = field::integerField(object::form, "complexity"); | 16 | const field form::complexity = field::integerField(object::form, "complexity"); |
| 17 | const field form::proper = field::booleanField(object::form, "proper"); | 17 | const field form::proper = field::booleanField(object::form, "proper"); |
| 18 | 18 | ||
| 19 | const field form::lemma = field::joinField(object::form, "form_id", object::lemma); | ||
| 19 | const field form::pronunciation = field::joinThrough(object::form, "form_id", object::pronunciation, "forms_pronunciations", "pronunciation_id"); | 20 | const field form::pronunciation = field::joinThrough(object::form, "form_id", object::pronunciation, "forms_pronunciations", "pronunciation_id"); |
| 20 | 21 | ||
| 21 | const field form::lemmaJoin = field::joinField(object::form, "form_id", object::lemma); | ||
| 22 | const field form::inflectionCategory = field::integerField("lemmas_forms", "category"); | ||
| 23 | |||
| 24 | form::form(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) | 22 | form::form(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) |
| 25 | { | 23 | { |
| 26 | id_ = sqlite3_column_int(row, 0); | 24 | id_ = sqlite3_column_int(row, 0); |
| @@ -29,16 +27,6 @@ namespace verbly { | |||
| 29 | proper_ = (sqlite3_column_int(row, 3) == 1); | 27 | proper_ = (sqlite3_column_int(row, 3) == 1); |
| 30 | } | 28 | } |
| 31 | 29 | ||
| 32 | filter operator%=(form::inflection_field check, filter joinCondition) | ||
| 33 | { | ||
| 34 | return (form::lemmaJoin %= (joinCondition && (form::inflectionCategory == check.getCategory()))); | ||
| 35 | } | ||
| 36 | |||
| 37 | form::inflection_field::operator filter() const | ||
| 38 | { | ||
| 39 | return (form::lemmaJoin %= (form::inflectionCategory == category_)); | ||
| 40 | } | ||
| 41 | |||
| 42 | const std::vector<pronunciation>& form::getPronunciations() const | 30 | const std::vector<pronunciation>& form::getPronunciations() const |
| 43 | { | 31 | { |
| 44 | if (!valid_) | 32 | if (!valid_) |
| @@ -48,7 +36,7 @@ namespace verbly { | |||
| 48 | 36 | ||
| 49 | if (!initializedPronunciations_) | 37 | if (!initializedPronunciations_) |
| 50 | { | 38 | { |
| 51 | pronunciations_ = db_->pronunciations(pronunciation::form %= *this, false, -1).all(); | 39 | pronunciations_ = db_->pronunciations(pronunciation::form %= *this, verbly::pronunciation::id, -1).all(); |
| 52 | initializedPronunciations_ = true; | 40 | initializedPronunciations_ = true; |
| 53 | } | 41 | } |
| 54 | 42 | ||
