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
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* ============================================================
 *
 * This file is a part of digiKam project
 * https://www.digikam.org
 *
 * Date        : 2009-06-20
 * Description : Template information container.
 *
 * SPDX-FileCopyrightText: 2009-2025 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * ============================================================ */

#pragma once

// Qt includes

#include <QMetaType>
#include <QString>
#include <QStringList>
#include <QDebug>

// Local includes

#include "metadatainfo.h"
#include "digikam_export.h"
#include "metaengine.h"

namespace Digikam
{

class TemplatePrivate;

class DIGIKAM_EXPORT Template
{
public:

    Template()  = default;
    ~Template() = default;

    /**
     * Return true if Template title is null
     */
    bool isNull()                               const;

    /**
     * Return true if Template contents is empty
     */
    bool isEmpty()                              const;

    /**
     * Merge the metadata from another Template
     */
    void merge(const Template& t);

    /**
     * Compare for metadata equality, not including "templateTitle" value.
     */
    bool operator==(const Template& t)          const;

    void setTemplateTitle(const QString& title);
    QString templateTitle()                     const;<--- Function 'templateTitle()' should return member 'm_templateTitle' by const reference.

    void setAuthors(const QStringList& authors);
    void setAuthorsPosition(const QString& authorPosition);
    void setCredit(const QString& credit);
    void setCopyright(const MetaEngine::AltLangMap& copyright);
    void setRightUsageTerms(const MetaEngine::AltLangMap& rightUsageTerms);
    void setSource(const QString& source);
    void setInstructions(const QString& instructions);
    void setLocationInfo(const IptcCoreLocationInfo& inf);
    void setContactInfo(const IptcCoreContactInfo& inf);
    void setIptcSubjects(const QStringList& subjects);

    QStringList            authors()            const;<--- Function 'authors()' should return member 'm_authors' by const reference.
    QString                authorsPosition()    const;<--- Function 'authorsPosition()' should return member 'm_authorsPosition' by const reference.
    QString                credit()             const;<--- Function 'credit()' should return member 'm_credit' by const reference.
    MetaEngine::AltLangMap copyright()          const;<--- Function 'copyright()' should return member 'm_copyright' by const reference.
    MetaEngine::AltLangMap rightUsageTerms()    const;<--- Function 'rightUsageTerms()' should return member 'm_rightUsageTerms' by const reference.
    QString                source()             const;<--- Function 'source()' should return member 'm_source' by const reference.
    QString                instructions()       const;<--- Function 'instructions()' should return member 'm_instructions' by const reference.
    IptcCoreLocationInfo   locationInfo()       const;<--- Function 'locationInfo()' should return member 'm_locationInfo' by const reference.
    IptcCoreContactInfo    contactInfo()        const;<--- Function 'contactInfo()' should return member 'm_contactInfo' by const reference.
    QStringList            IptcSubjects()       const;<--- Function 'IptcSubjects()' should return member 'm_subjects' by const reference.

    static QString removeTemplateTitle()
    {
        return QLatin1String("_REMOVE_TEMPLATE_");
    };

protected:

    /**
     * Template title used internally. This value always exist and cannot be empty.
     */
    QString                  m_templateTitle;

    /**
     * List of author names.
     */
    QStringList              m_authors;

    /**
     * Description of authors position.
     */
    QString                  m_authorsPosition;

    /**
     * Credit description.
     */
    QString                  m_credit;

    /**
     * Language alternative copyright notices.
     */
    MetaEngine::AltLangMap   m_copyright;

    /**
     * Language alternative right term usages.
     */
    MetaEngine::AltLangMap   m_rightUsageTerms;

    /**
     * Descriptions of contents source.
     */
    QString                  m_source;

    /**
     * Special instructions to process with contents.
     */
    QString                  m_instructions;

    /**
     * IPTC Location Information.
     */
    IptcCoreLocationInfo     m_locationInfo;

    /**
     * IPTC Contact Information.
     */
    IptcCoreContactInfo      m_contactInfo;

    /**
     * IPTC Subjects Information.
     */
    QStringList              m_subjects;
};

//! qDebug() stream operator. Writes Template to the debug output in a nicely formatted way.
DIGIKAM_EXPORT QDebug operator<<(QDebug dbg, const Template& t);

} // namespace Digikam

Q_DECLARE_METATYPE(Digikam::Template)