File indexing completed on 2024-05-05 04:33:15

0001 /*
0002     SPDX-FileCopyrightText: 2004-2018 Gilles Caulier <caulier dot gilles at gmail dot com>
0003     SPDX-FileCopyrightText: 2006-2012 Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0004     SPDX-FileCopyrightText: 2004-2005 Renchi Raju <renchi dot raju at gmail dot com>
0005     SPDX-FileCopyrightText: 2004-2005 Jesper K. Pedersen <blackie at kde dot org>
0006     SPDX-FileCopyrightText: 2004-2005 Aurelien Gateau <aurelien dot gateau at free dot fr>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef KIPI_IMAGEINFOSHARED_H
0012 #define KIPI_IMAGEINFOSHARED_H
0013 
0014 // Std includes
0015 
0016 #include <memory>
0017 
0018 // Qt includes
0019 
0020 #include <QString>
0021 #include <QMap>
0022 #include <QDateTime>
0023 #include <QVariant>
0024 #include <QUrl>
0025 
0026 // Local includes
0027 
0028 #include "imageinfo.h"
0029 #include "libkipi_export.h"
0030 
0031 namespace KIPI
0032 {
0033 
0034 class Interface;
0035 class FileReadWriteLock;
0036 
0037 /**
0038  * @class ImageInfoShared imageinfoshared.h <KIPI/ImageInfoShared>
0039  *
0040  * See ImageInfo documentation for details.
0041  */
0042 class LIBKIPI_EXPORT ImageInfoShared
0043 {
0044 
0045 public:
0046 
0047     ImageInfoShared(Interface* const interface, const QUrl &url);
0048     virtual ~ImageInfoShared();
0049 
0050     QUrl url() const;
0051 
0052     /** Convenience methods calling the respective methods in the interface for this item.
0053      */
0054     bool               reserveForAction(QObject* const reservingObject, const QString& descriptionOfAction) const;
0055     void               clearReservation(QObject* const reservingObject);
0056     bool               itemIsReserved(QString* const descriptionOfAction = nullptr) const;
0057     FileReadWriteLock* createReadWriteLock() const;
0058 
0059     /** These methods must be re-implemented in your KIPI host application to manage image attributes with plugins.
0060      */
0061     virtual QMap<QString, QVariant> attributes() = 0;
0062     virtual void                    clearAttributes() = 0;
0063     virtual void                    addAttributes(const QMap<QString, QVariant>&) = 0;
0064     virtual void                    delAttributes(const QStringList&) = 0;
0065 
0066     virtual void cloneData(ImageInfoShared* const other);
0067 
0068 protected:
0069 
0070     QUrl _url;
0071 
0072 private:
0073 
0074     ImageInfoShared();    // Disable
0075 
0076     /// Used by ImageInfo class.
0077     void addRef();
0078     void removeRef();
0079 
0080 private:
0081 
0082     class Private;
0083     std::unique_ptr<Private> const d;
0084 
0085     friend class ImageInfo;
0086 };
0087 
0088 } // namespace KIPI
0089 
0090 #endif /* IMAGEINFOSHARED_H */