summary refs log tree commit diff stats
path: root/lib/part.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/part.h')
-rw-r--r--lib/part.h64
1 files changed, 52 insertions, 12 deletions
diff --git a/lib/part.h b/lib/part.h index 3a15638..9a01312 100644 --- a/lib/part.h +++ b/lib/part.h
@@ -4,21 +4,20 @@
4#include <string> 4#include <string>
5#include <vector> 5#include <vector>
6#include <set> 6#include <set>
7#include <list>
7#include "selrestr.h" 8#include "selrestr.h"
9#include "field.h"
10#include "filter.h"
11#include "enums.h"
12
13struct sqlite3_stmt;
8 14
9namespace verbly { 15namespace verbly {
10 16
17 class database;
18
11 class part { 19 class part {
12 public: 20 public:
13 enum class type {
14 invalid = -1,
15 noun_phrase = 0,
16 verb = 1,
17 preposition = 2,
18 adjective = 3,
19 adverb = 4,
20 literal = 5
21 };
22 21
23 // Static factories 22 // Static factories
24 23
@@ -40,6 +39,10 @@ namespace verbly {
40 { 39 {
41 } 40 }
42 41
42 // Construct from database
43
44 part(const database& db, sqlite3_stmt* row);
45
43 // Copy and move constructors 46 // Copy and move constructors
44 47
45 part(const part& other); 48 part(const part& other);
@@ -60,7 +63,12 @@ namespace verbly {
60 63
61 // General accessors 64 // General accessors
62 65
63 type getType() const 66 operator bool() const
67 {
68 return (type_ != part_type::invalid);
69 }
70
71 part_type getType() const
64 { 72 {
65 return type_; 73 return type_;
66 } 74 }
@@ -85,11 +93,43 @@ namespace verbly {
85 93
86 std::string getLiteralValue() const; 94 std::string getLiteralValue() const;
87 95
96 // Type info
97
98 static const object objectType;
99
100 static const std::list<std::string> select;
101
102 // Query fields
103
104 static const field index;
105 static const field type;
106
107 static const field role;
108
109 // Relationships to other objects
110
111 static const field frame;
112
113 // Noun synrestr relationship
114
115 class synrestr_field {
116 public:
117
118 filter operator%=(std::string synrestr) const;
119
120 private:
121
122 static const field synrestrJoin;
123 static const field synrestrField;
124 };
125
126 static const synrestr_field synrestr;
127
88 private: 128 private:
89 129
90 // Private constructors 130 // Private constructors
91 131
92 part(type t) : type_(t) 132 part(part_type t) : type_(t)
93 { 133 {
94 } 134 }
95 135
@@ -108,7 +148,7 @@ namespace verbly {
108 std::string literal_; 148 std::string literal_;
109 }; 149 };
110 150
111 type type_ = type::invalid; 151 part_type type_ = part_type::invalid;
112 152
113 }; 153 };
114 154