Documented Database.

This commit is contained in:
tastytea 2019-07-28 01:42:57 +02:00
parent 57e3fc0289
commit 73262c8d16
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 3 deletions

View File

@ -33,9 +33,11 @@ namespace remwharead
using std::chrono::system_clock; using std::chrono::system_clock;
using time_point = system_clock::time_point; using time_point = system_clock::time_point;
//! Store and retrieve files from/to SQLite.
class Database class Database
{ {
public: public:
//! Describes a database entry.
typedef struct entry typedef struct entry
{ {
string uri; string uri;
@ -46,20 +48,23 @@ namespace remwharead
string description; string description;
string fulltext; string fulltext;
//! Returns true if date & time are equal. //! Returns true if date and time are equal.
friend bool operator ==(const Database::entry &a, friend bool operator ==(const Database::entry &a,
const Database::entry &b); const Database::entry &b);
//! The full text in one line. //! The full text in one line.
const string fulltext_oneline() const; const string fulltext_oneline() const;
} entry; } entry;
//! Connects to the database and creates it if necessary.
Database(); Database();
//! Returns true if connected to the database.
operator bool() const; operator bool() const;
//! Store in database. //! Store a Database::entry in the database.
void store(const entry &data) const; void store(const entry &data) const;
//! retrieve from database. //! Retrieve a vector of Database::entry from the database.
const vector<entry> retrieve( const vector<entry> retrieve(
const time_point &start = time_point(), const time_point &start = time_point(),
const time_point &end = system_clock::now()) const; const time_point &end = system_clock::now()) const;