From 6746da6edd7d9d50efe374eabbb79a3cac882d81 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 16 Jan 2017 18:02:50 -0500 Subject: Started structural rewrite The new object structure was designed to build on the existing WordNet structure, while also adding in all of the data that we get from other sources. More information about this can be found on the project wiki. The generator has already been completely rewritten to generate a datafile that uses the new structure. In addition, a number of indexes are created, which does double the size of the datafile, but also allows for much faster lookups. Finally, the new generator is written modularly and is a lot more readable than the old one. The verbly interface to the new object structure has mostly been completed, but has not been tested fully. There is a completely new search API which utilizes a lot of operator overloading; documentation on how to use it should go up at some point. Token processing and verb frames are currently unimplemented. Source for these have been left in the repository for now. --- generator/database.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 generator/database.h (limited to 'generator/database.h') diff --git a/generator/database.h b/generator/database.h new file mode 100644 index 0000000..15cdff5 --- /dev/null +++ b/generator/database.h @@ -0,0 +1,73 @@ +#ifndef DATABASE_H_0B0A47D2 +#define DATABASE_H_0B0A47D2 + +#include +#include +#include + +struct sqlite3; + +namespace verbly { + namespace generator { + + class field; + + class sqlite3_error : public std::exception { + public: + + sqlite3_error(const std::string& what, const std::string& db_err); + + const char* what() const noexcept override; + const char* db_err() const noexcept; + + private: + std::string what_; + std::string db_err_; + + }; + + class database { + public: + + // Constructor + + explicit database(std::string path); + + // Disable copying + + database(const database& other) = delete; + database& operator=(const database& other) = delete; + + // Move constructor and move assignment + + database(database&& other); + database& operator=(database&& other); + + // Swap + + friend void swap(database& first, database& second); + + // Destructor + + ~database(); + + // Actions + + void runQuery(std::string query); + + void insertIntoTable(std::string table, std::list fields); + + private: + + database() + { + } + + sqlite3* ppdb_ = nullptr; + + }; + + }; +}; + +#endif /* end of include guard: DATABASE_H_0B0A47D2 */ -- cgit 1.4.1