summary refs log tree commit diff stats
path: root/lib/group.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/group.h')
-rw-r--r--lib/group.h91
1 files changed, 0 insertions, 91 deletions
diff --git a/lib/group.h b/lib/group.h deleted file mode 100644 index fe62d39..0000000 --- a/lib/group.h +++ /dev/null
@@ -1,91 +0,0 @@
1#ifndef GROUP_H_BD6933C0
2#define GROUP_H_BD6933C0
3
4#include <stdexcept>
5#include <list>
6#include <vector>
7#include "field.h"
8#include "filter.h"
9#include "frame.h"
10#include "role.h"
11
12struct sqlite3_stmt;
13
14namespace verbly {
15
16 class database;
17
18 class group {
19 public:
20
21 // Default constructor
22
23 group() = default;
24
25 // Construct from database
26
27 group(const database& db, sqlite3_stmt* row);
28
29 // Accessors
30
31 operator bool() const
32 {
33 return valid_;
34 }
35
36 int getId() const
37 {
38 if (!valid_)
39 {
40 throw std::domain_error("Bad access to uninitialized group");
41 }
42
43 return id_;
44 }
45
46 const std::vector<frame>& getFrames() const;
47
48 const role& getRole(std::string roleName) const;
49
50 // Type info
51
52 static const object objectType;
53
54 static const std::list<std::string> select;
55
56 // Query fields
57
58 static const field id;
59
60 operator filter() const
61 {
62 if (!valid_)
63 {
64 throw std::domain_error("Bad access to uninitialized group");
65 }
66
67 return (id == id_);
68 }
69
70 // Relationships to other objects
71
72 static const field frame;
73
74 static const field word;
75
76 private:
77 bool valid_ = false;
78
79 int id_;
80 std::map<std::string, role> roles_;
81
82 const database* db_;
83
84 mutable bool initializedFrames_ = false;
85 mutable std::vector<class frame> frames_;
86
87 };
88
89};
90
91#endif /* end of include guard: GROUP_H_BD6933C0 */