diff options
Diffstat (limited to 'lib/pronunciation.cpp')
| -rw-r--r-- | lib/pronunciation.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
| diff --git a/lib/pronunciation.cpp b/lib/pronunciation.cpp index 3ddb1c5..fa471ec 100644 --- a/lib/pronunciation.cpp +++ b/lib/pronunciation.cpp | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #include "pronunciation.h" | 1 | #include "pronunciation.h" |
| 2 | #include <sqlite3.h> | 2 | #include <sqlite3.h> |
| 3 | #include "form.h" | 3 | #include "form.h" |
| 4 | #include "lemma.h" | ||
| 5 | #include "word.h" | 4 | #include "word.h" |
| 6 | #include "util.h" | 5 | #include "util.h" |
| 7 | 6 | ||
| @@ -20,6 +19,9 @@ namespace verbly { | |||
| 20 | const field pronunciation::prerhyme = field::stringField(object::pronunciation, "prerhyme", true); | 19 | const field pronunciation::prerhyme = field::stringField(object::pronunciation, "prerhyme", true); |
| 21 | const field pronunciation::rhyme = field::stringField(object::pronunciation, "rhyme", true); | 20 | const field pronunciation::rhyme = field::stringField(object::pronunciation, "rhyme", true); |
| 22 | 21 | ||
| 22 | const field pronunciation::rhymes_field::rhymeJoin = field::joinField(object::pronunciation, "rhyme", object::pronunciation); | ||
| 23 | const pronunciation::rhymes_field pronunciation::rhymes = {}; | ||
| 24 | |||
| 23 | pronunciation::pronunciation(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) | 25 | pronunciation::pronunciation(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) |
| 24 | { | 26 | { |
| 25 | id_ = sqlite3_column_int(row, 0); | 27 | id_ = sqlite3_column_int(row, 0); |
| @@ -39,31 +41,22 @@ namespace verbly { | |||
| 39 | } | 41 | } |
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | filter pronunciation::rhymesWith(const pronunciation& arg) | 44 | filter pronunciation::rhymes_field::operator%=(filter joinCondition) const |
| 43 | { | 45 | { |
| 44 | return (prerhyme != arg.getPrerhyme()) && (rhyme == arg.getRhyme()); | 46 | return (rhymeJoin %= ( |
| 45 | } | 47 | joinCondition |
| 46 | 48 | && filter( | |
| 47 | /*filter pronunciation::rhymesWith(const class form& arg) | 49 | verbly::pronunciation::prerhyme, |
| 48 | { | 50 | filter::comparison::field_does_not_equal, |
| 49 | filter result; | 51 | verbly::pronunciation::prerhyme))); |
| 50 | |||
| 51 | for (const pronunciation& p : arg.getPronunciations()) | ||
| 52 | { | ||
| 53 | result |= rhymesWith(p); | ||
| 54 | } | ||
| 55 | |||
| 56 | return result; | ||
| 57 | } | 52 | } |
| 58 | 53 | ||
| 59 | filter pronunciation::rhymesWith(const lemma& arg) | 54 | pronunciation::rhymes_field::operator filter() const |
| 60 | { | 55 | { |
| 61 | return rhymesWith(arg.getBaseForm()); | 56 | return (rhymeJoin %= filter( |
| 57 | verbly::pronunciation::prerhyme, | ||
| 58 | filter::comparison::field_does_not_equal, | ||
| 59 | verbly::pronunciation::prerhyme)); | ||
| 62 | } | 60 | } |
| 63 | 61 | ||
| 64 | filter pronunciation::rhymesWith(const word& arg) | ||
| 65 | { | ||
| 66 | return rhymesWith(arg.getLemma()); | ||
| 67 | }*/ | ||
| 68 | |||
| 69 | }; | 62 | }; |
