1 /*
2     Copyright (C) 2014 Aseman
3     http://aseman.co
4 
5     This project is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9 
10     This project is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef ASEMANHASHOBJECT_H
20 #define ASEMANHASHOBJECT_H
21 
22 #include <QObject>
23 #include <QVariant>
24 
25 class AsemanHashObjectPrivate;
26 class AsemanHashObject : public QObject
27 {
28     Q_OBJECT
29     Q_PROPERTY(int count READ count NOTIFY countChanged)
30 
31 public:
32     AsemanHashObject(QObject *parent = 0);
33     ~AsemanHashObject();
34 
35     Q_INVOKABLE void insert(const QString & key, const QVariant & value );
36     Q_INVOKABLE void insertMulti(const QString & key, const QVariant & value );
37     Q_INVOKABLE void remove( const QString & key );
38     Q_INVOKABLE void remove( const QString & key, const QVariant & value );
39 
40     Q_INVOKABLE QVariant key( const QVariant & value );
41     Q_INVOKABLE QStringList keys( const QVariant & value );
42     Q_INVOKABLE QStringList keys();
43     Q_INVOKABLE QVariant value( const QString & key );
44     Q_INVOKABLE QVariantList values( const QString & key );
45 
46     Q_INVOKABLE QVariant containt( const QString & key );
47     Q_INVOKABLE QVariant containt( const QString & key, const QVariant & value );
48     Q_INVOKABLE QVariant contains( const QString & key );
49     Q_INVOKABLE QVariant contains( const QString & key, const QVariant & value );
50 
51     Q_INVOKABLE void clear();
52 
53     Q_INVOKABLE int count();
54 
55 signals:
56     void countChanged();
57 
58 private:
59     AsemanHashObjectPrivate *p;
60 };
61 
62 #endif // ASEMANHASHOBJECT_H
63