digiKam
itemtagpair.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-07-05
7  * Description : Access to the properties of an Item / Tag pair, i.e., a tag associated to an item
8  *
9  * Copyright (C) 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_ITEM_TAG_PAIR_H
25 #define DIGIKAM_ITEM_TAG_PAIR_H
26 
27 // Qt includes
28 
29 #include <QString>
30 #include <QStringList>
31 #include <QList>
32 #include <QExplicitlySharedDataPointer>
33 #include <QMultiMap>
34 
35 // Local includes
36 
37 #include "digikam_export.h"
38 
39 namespace Digikam
40 {
41 
42 class ItemInfo;
43 class ItemTagPairPriv;
44 
45 class DIGIKAM_DATABASE_EXPORT ItemTagPair
46 {
47 public:
48 
56  ItemTagPair();
57 
61  ItemTagPair(qlonglong imageId, int tagId);
62  ItemTagPair(const ItemInfo& info, int tagId);
63 
64  ~ItemTagPair();
65  ItemTagPair(const ItemTagPair& other);
66  ItemTagPair& operator=(const ItemTagPair& other);
67 
68  bool isNull() const;
69 
74  static QList<ItemTagPair> availablePairs(qlonglong imageId);
75  static QList<ItemTagPair> availablePairs(const ItemInfo& info);
76 
77  qlonglong imageId() const;
78  int tagId() const;
79 
83  bool isAssigned() const;
84 
88  void assignTag();
89 
93  void unAssignTag();
94 
96  bool hasProperty(const QString& key) const;
98  bool hasAnyProperty(const QStringList& keys) const;
100  bool hasValue(const QString& key, const QString& value) const;
102  QString value(const QString& key) const;
104  QStringList allValues(const QStringList& keys) const;
106  QStringList values(const QString& key) const;
108  QStringList propertyKeys() const;
110  QMultiMap<QString, QString> properties() const;
111 
113  void setProperty(const QString& key, const QString& value);
114 
120  void addProperty(const QString& key, const QString& value);
121 
123  void removeProperty(const QString& key, const QString& value);
125  void removeProperties(const QString& key);
127  void clearProperties();
128 
129 private:
130 
131  QExplicitlySharedDataPointer<ItemTagPairPriv> d;
132 };
133 
134 } // namespace
135 
136 #endif // DIGIKAM_ITEM_TAG_PAIR_H
Definition: iteminfo.h:78
Definition: itemtagpair.h:46
Definition: piwigotalker.h:48
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43