From 73262c8d16e86bd6fc328b037652d80c01fd3a3e Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 28 Jul 2019 01:42:57 +0200 Subject: [PATCH] Documented Database. --- src/lib/sqlite.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/sqlite.hpp b/src/lib/sqlite.hpp index 75a403b..8f61525 100644 --- a/src/lib/sqlite.hpp +++ b/src/lib/sqlite.hpp @@ -33,9 +33,11 @@ namespace remwharead using std::chrono::system_clock; using time_point = system_clock::time_point; + //! Store and retrieve files from/to SQLite. class Database { public: + //! Describes a database entry. typedef struct entry { string uri; @@ -46,20 +48,23 @@ namespace remwharead string description; string fulltext; - //! Returns true if date & time are equal. + //! Returns true if date and time are equal. friend bool operator ==(const Database::entry &a, const Database::entry &b); //! The full text in one line. const string fulltext_oneline() const; } entry; + //! Connects to the database and creates it if necessary. Database(); + + //! Returns true if connected to the database. operator bool() const; - //! Store in database. + //! Store a Database::entry in the database. void store(const entry &data) const; - //! retrieve from database. + //! Retrieve a vector of Database::entry from the database. const vector retrieve( const time_point &start = time_point(), const time_point &end = system_clock::now()) const;