diff options
Diffstat (limited to 'lib/field.cpp')
| -rw-r--r-- | lib/field.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
| diff --git a/lib/field.cpp b/lib/field.cpp new file mode 100644 index 0000000..d7adbb3 --- /dev/null +++ b/lib/field.cpp | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | #include "field.h" | ||
| 2 | #include "filter.h" | ||
| 3 | |||
| 4 | namespace verbly { | ||
| 5 | |||
| 6 | filter field::operator==(int value) const | ||
| 7 | { | ||
| 8 | return filter(*this, filter::comparison::int_equals, value); | ||
| 9 | } | ||
| 10 | |||
| 11 | filter field::operator!=(int value) const | ||
| 12 | { | ||
| 13 | return filter(*this, filter::comparison::int_does_not_equal, value); | ||
| 14 | } | ||
| 15 | |||
| 16 | filter field::operator<(int value) const | ||
| 17 | { | ||
| 18 | return filter(*this, filter::comparison::int_is_less_than, value); | ||
| 19 | } | ||
| 20 | |||
| 21 | filter field::operator<=(int value) const | ||
| 22 | { | ||
| 23 | return filter(*this, filter::comparison::int_is_at_most, value); | ||
| 24 | } | ||
| 25 | |||
| 26 | filter field::operator>(int value) const | ||
| 27 | { | ||
| 28 | return filter(*this, filter::comparison::int_is_greater_than, value); | ||
| 29 | } | ||
| 30 | |||
| 31 | filter field::operator>=(int value) const | ||
| 32 | { | ||
| 33 | return filter(*this, filter::comparison::int_is_at_least, value); | ||
| 34 | } | ||
| 35 | |||
| 36 | filter field::operator==(part_of_speech value) const | ||
| 37 | { | ||
| 38 | return filter(*this, filter::comparison::int_equals, static_cast<int>(value)); | ||
| 39 | } | ||
| 40 | |||
| 41 | filter field::operator==(positioning value) const | ||
| 42 | { | ||
| 43 | return filter(*this, filter::comparison::int_equals, static_cast<int>(value)); | ||
| 44 | } | ||
| 45 | |||
| 46 | filter field::operator==(inflection value) const | ||
| 47 | { | ||
| 48 | return filter(*this, filter::comparison::int_equals, static_cast<int>(value)); | ||
| 49 | } | ||
| 50 | |||
| 51 | filter field::operator==(bool value) const | ||
| 52 | { | ||
| 53 | return filter(*this, filter::comparison::boolean_equals, value); | ||
| 54 | } | ||
| 55 | |||
| 56 | filter field::operator==(std::string value) const | ||
| 57 | { | ||
| 58 | return filter(*this, filter::comparison::string_equals, std::move(value)); | ||
| 59 | } | ||
| 60 | |||
| 61 | filter field::operator!=(std::string value) const | ||
| 62 | { | ||
| 63 | return filter(*this, filter::comparison::string_does_not_equal, std::move(value)); | ||
| 64 | } | ||
| 65 | |||
| 66 | filter field::operator%=(std::string value) const | ||
| 67 | { | ||
| 68 | return filter(*this, filter::comparison::string_is_like, std::move(value)); | ||
| 69 | } | ||
| 70 | |||
| 71 | field::operator filter() const | ||
| 72 | { | ||
| 73 | return filter(*this, filter::comparison::is_not_null); | ||
| 74 | } | ||
| 75 | |||
| 76 | filter field::operator!() const | ||
| 77 | { | ||
| 78 | return filter(*this, filter::comparison::is_null); | ||
| 79 | } | ||
| 80 | |||
| 81 | filter field::operator%=(filter joinCondition) const | ||
| 82 | { | ||
| 83 | if (type_ == type::hierarchal_join) | ||
| 84 | { | ||
| 85 | return filter(*this, filter::comparison::hierarchally_matches, std::move(joinCondition)); | ||
| 86 | } else { | ||
| 87 | return filter(*this, filter::comparison::matches, std::move(joinCondition)); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | }; | ||
