File: Inbox.h

package info (click to toggle)
js8call 2.2.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,416 kB
  • sloc: cpp: 563,285; f90: 9,265; ansic: 937; python: 132; sh: 93; makefile: 6
file content (49 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (3)
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