summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-01-23 12:04:44 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-01-23 12:04:44 -0500
commitb7c34c6f019a67f159b325d83000db9d04e8a270 (patch)
tree57cd5f9dbc92a280661604007804f9394f4a88ef /lib
parentc4743dd4dd15681b1ff9d2be64c8307d0dce53b9 (diff)
downloadverbly-b7c34c6f019a67f159b325d83000db9d04e8a270.tar.gz
verbly-b7c34c6f019a67f159b325d83000db9d04e8a270.tar.bz2
verbly-b7c34c6f019a67f159b325d83000db9d04e8a270.zip
Added ability to filter on existence of inflection
Diffstat (limited to 'lib')
-rw-r--r--lib/form.cpp7
-rw-r--r--lib/form.h4
-rw-r--r--lib/lemma.cpp5
-rw-r--r--lib/lemma.h4
4 files changed, 17 insertions, 3 deletions
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 {
33 { 33 {
34 return (form::lemmaJoin %= (joinCondition && (form::inflectionCategory == check.getCategory()))); 34 return (form::lemmaJoin %= (joinCondition && (form::inflectionCategory == check.getCategory())));
35 } 35 }
36 36
37 form::inflection_field::operator filter() const
38 {
39 return (form::lemmaJoin %= (form::inflectionCategory == category_));
40 }
41
37 const std::vector<pronunciation>& form::getPronunciations() const 42 const std::vector<pronunciation>& form::getPronunciations() const
38 { 43 {
39 if (!valid_) 44 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 {
117 { 117 {
118 return category_; 118 return category_;
119 } 119 }
120 120
121 operator filter() const;
122
121 private: 123 private:
122 124
123 const inflection category_; 125 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 {
21 return (lemma::formJoin %= joinCondition) && (lemma::inflectionCategory == check.getCategory()); 21 return (lemma::formJoin %= joinCondition) && (lemma::inflectionCategory == check.getCategory());
22 } 22 }
23 23
24 lemma::inflection_field::operator filter() const
25 {
26 return (lemma::inflectionCategory == category_);
27 }
28
24 lemma::lemma(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) 29 lemma::lemma(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true)
25 { 30 {
26 id_ = sqlite3_column_int(row, 0); 31 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 @@
6#include <list> 6#include <list>
7#include <map> 7#include <map>
8#include "field.h" 8#include "field.h"
9#include "form.h"
9#include "enums.h" 10#include "enums.h"
10#include "filter.h" 11#include "filter.h"
11 12
@@ -13,7 +14,6 @@ struct sqlite3_stmt;
13 14
14namespace verbly { 15namespace verbly {
15 16
16 class form;
17 class database; 17 class database;
18 18
19 class lemma { 19 class lemma {
@@ -86,6 +86,8 @@ namespace verbly {
86 return category_; 86 return category_;
87 } 87 }
88 88
89 operator filter() const;
90
89 private: 91 private:
90 92
91 const inflection category_; 93 const inflection category_;