From 9bd863c9002b525b7827f9158d9136143393be5c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 23 Jan 2017 11:49:51 -0500 Subject: Added verb frame parsing --- lib/frame.h | 60 ++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'lib/frame.h') diff --git a/lib/frame.h b/lib/frame.h index 68a4346..97473a0 100644 --- a/lib/frame.h +++ b/lib/frame.h @@ -5,74 +5,86 @@ #include #include "field.h" #include "filter.h" +#include "part.h" struct sqlite3_stmt; namespace verbly { - + class database; - + class frame { public: - + // Default constructor - + frame() = default; - + // Construct from database - + frame(const database& db, sqlite3_stmt* row); - + // Accessors - + operator bool() const { return valid_; } - + int getId() const { if (!valid_) { throw std::domain_error("Bad access to uninitialized frame"); } - + return id_; } - + + const std::vector& getParts() const + { + if (!valid_) + { + throw std::domain_error("Bad access to uninitialized frame"); + } + + return parts_; + } + // Type info - + static const object objectType; - + static const std::list select; - + // Query fields - + static const field id; - + operator filter() const { if (!valid_) { throw std::domain_error("Bad access to uninitialized frame"); } - + return (id == id_); } - + // Relationships to other objects - + static const field group; - + private: bool valid_ = false; - + int id_; - + std::vector parts_; + const database* db_; - + }; - + }; #endif /* end of include guard: FRAME_H_EA29065A */ -- cgit 1.4.1