blob: 9719f83a4167a2c815d1fde5528b0c6bd39b7701 (
plain)
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
|
#ifndef JSKITLOCALSTORAGE_P_H
#define JSKITLOCALSTORAGE_P_H
#include <QSettings>
#include <QJSEngine>
#include <QUuid>
class JSKitLocalStorage : public QObject
{
Q_OBJECT
Q_PROPERTY(int length READ length)
public:
explicit JSKitLocalStorage(QJSEngine *engine, const QString &storagePath, const QUuid &uuid);
int length() const;
Q_INVOKABLE QJSValue getItem(const QJSValue &key) const;
Q_INVOKABLE bool setItem(const QJSValue &key, const QJSValue &value);
Q_INVOKABLE bool removeItem(const QJSValue &key);
Q_INVOKABLE void clear();
Q_INVOKABLE QJSValue key(int index);
Q_INVOKABLE QJSValue get(const QJSValue &proxy, const QJSValue &key) const;
Q_INVOKABLE bool set(const QJSValue &proxy, const QJSValue &key, const QJSValue &value);
Q_INVOKABLE bool has(const QJSValue &proxy, const QJSValue &key);
Q_INVOKABLE bool deleteProperty(const QJSValue &proxy, const QJSValue &key);
Q_INVOKABLE QJSValue keys(const QJSValue &proxy=0);
Q_INVOKABLE QJSValue enumerate();
private:
static QString getStorageFileFor(const QString &storageDir, const QUuid &uuid);
private:
QJSEngine *m_engine;
QSettings *m_storage;
};
#endif // JSKITLOCALSTORAGE_P_H
|