1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#ifndef INBOX_H
#define INBOX_H
/**
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
**/
#include <QObject>
#include <QString>
#include <QPair>
#include <QVariant>
#include "sqlite3.h"
#include "Message.h"
class Inbox
{
public:
explicit Inbox(QString path);
~Inbox();
// Low-Level Interface
bool isOpen();
bool open();
void close();
QString error();
int count(QString type, QString query, QString match);
QList<QPair<int, Message>> values(QString type, QString query, QString match, int offset, int limit);
Message value(int key);
int append(Message value);
bool set(int key, Message value);
bool del(int key);
// High-Level Interface
int countUnreadFrom(QString from);
QPair<int, Message> firstUnreadFrom(QString from);
signals:
public slots:
private:
QString path_;
sqlite3 * db_;
};
#endif // INBOX_H
|