File indexing completed on 2025-03-09 03:54:58

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam
0004  *
0005  * Date        : 2013-05-18
0006  * Description : Wrapper class for face recognition
0007  *
0008  * SPDX-FileCopyrightText:      2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0009  * SPDX-FileCopyrightText: 2014-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "identity.h"
0016 
0017 namespace Digikam
0018 {
0019 
0020 class Q_DECL_HIDDEN Identity::Private : public QSharedData
0021 {
0022 public:
0023 
0024     explicit Private()
0025         : id(-1)
0026     {
0027     }
0028 
0029 public:
0030 
0031     int                    id;
0032     QMultiMap<QString, QString> attributes;
0033 };
0034 
0035 Identity::Identity()
0036     : d(new Private)
0037 {
0038 }
0039 
0040 Identity::Identity(const Identity& other)
0041     : d(other.d)
0042 {
0043 }
0044 
0045 Identity& Identity::operator=(const Identity& other)
0046 {
0047     d = other.d;
0048 
0049     return *this;
0050 }
0051 
0052 Identity::~Identity()
0053 {
0054 }
0055 
0056 bool Identity::isNull() const
0057 {
0058     return (d->id == -1);
0059 }
0060 
0061 bool Identity::operator==(const Identity& other) const
0062 {
0063     return (d->id == other.d->id);
0064 }
0065 
0066 int Identity::id() const
0067 {
0068     return d->id;
0069 }
0070 
0071 void Identity::setId(int id)
0072 {
0073     d->id = id;
0074 }
0075 
0076 QString Identity::attribute(const QString& att) const
0077 {
0078     return d->attributes.value(att);
0079 }
0080 
0081 void Identity::setAttribute(const QString& att, const QString& val)
0082 {
0083     d->attributes.insert(att, val);
0084 }
0085 
0086 QMultiMap<QString, QString> Identity::attributesMap() const
0087 {
0088     return d->attributes;
0089 }
0090 
0091 void Identity::setAttributesMap(const QMultiMap<QString, QString>& attributes)
0092 {
0093     d->attributes = attributes;
0094 }
0095 
0096 } // namespace Digikam