From b7c34c6f019a67f159b325d83000db9d04e8a270 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 23 Jan 2017 12:04:44 -0500 Subject: Added ability to filter on existence of inflection --- lib/form.cpp | 7 ++++++- lib/form.h | 4 +++- lib/lemma.cpp | 5 +++++ lib/lemma.h | 4 +++- 4 files changed, 17 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/form.cpp b/lib/form.cpp index 778e5d3..ef9703a 100644 --- a/lib/form.cpp +++ b/lib/form.cpp @@ -33,7 +33,12 @@ namespace verbly { { return (form::lemmaJoin %= (joinCondition && (form::inflectionCategory == check.getCategory()))); } - + + form::inflection_field::operator filter() const + { + return (form::lemmaJoin %= (form::inflectionCategory == category_)); + } + const std::vector& form::getPronunciations() const { if (!valid_) diff --git a/lib/form.h b/lib/form.h index c9c2a9e..aca5b2f 100644 --- a/lib/form.h +++ b/lib/form.h @@ -117,7 +117,9 @@ namespace verbly { { return category_; } - + + operator filter() const; + private: const inflection category_; diff --git a/lib/lemma.cpp b/lib/lemma.cpp index f9e9fcc..7fdc360 100644 --- a/lib/lemma.cpp +++ b/lib/lemma.cpp @@ -21,6 +21,11 @@ namespace verbly { return (lemma::formJoin %= joinCondition) && (lemma::inflectionCategory == check.getCategory()); } + lemma::inflection_field::operator filter() const + { + return (lemma::inflectionCategory == category_); + } + lemma::lemma(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) { id_ = sqlite3_column_int(row, 0); diff --git a/lib/lemma.h b/lib/lemma.h index 9a07f16..8c8d1c1 100644 --- a/lib/lemma.h +++ b/lib/lemma.h @@ -6,6 +6,7 @@ #include #include #include "field.h" +#include "form.h" #include "enums.h" #include "filter.h" @@ -13,7 +14,6 @@ struct sqlite3_stmt; namespace verbly { - class form; class database; class lemma { @@ -86,6 +86,8 @@ namespace verbly { return category_; } + operator filter() const; + private: const inflection category_; -- cgit 1.4.1