fba806edf02d48ec75de6b166ac013dcf172650a
[situare] / src / situareservice / database.h
1 #ifndef DATABASE_H
2 #define DATABASE_H
3
4 #include <QObject>
5
6 #include <QtSql/QSqlDatabase>
7 #include <QtSql/QSqlError>
8 #include <QFile>
9 #include <QStringList>
10
11 #include "coordinates/geocoordinate.h"
12 #include "message.h"
13
14 class Database : public QObject
15 {
16     Q_OBJECT
17 public:
18     Database(QObject *parent = 0);
19     ~Database();
20
21     bool addTag(qulonglong userId, const QString &tag);
22     QByteArray getNotifications(qulonglong userId);
23     QHash<QString, QString> getTags(qulonglong userId);
24     QByteArray getInterestingPeople(qulonglong userId,
25                                      const GeoCoordinate &southWestCoordinates,
26                                      const GeoCoordinate &northEastCoordinates);
27
28     bool createNotificationTable();
29     bool createTagTable();
30     bool createUserTagTable();
31     bool createUserTable();
32     bool openDatabase();
33     bool removeTags(qulonglong userId, const QStringList &tags);
34     bool sendMessage(qulonglong senderId, qulonglong receiverId, const QString &message);
35
36 private:
37     QSqlDatabase m_database;
38     QList<Message*> m_notifications;
39 };
40
41 #endif // DATABASE_H