File indexing completed on 2025-01-19 03:53:37

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2005-04-21
0007  * Description : Handling access to one item and associated data - private
0008  *
0009  * SPDX-FileCopyrightText: 2005      by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2007-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0011  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  * SPDX-FileCopyrightText: 2013      by Michael G. Hansen <mike at mghansen dot de>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_ITEM_INFO_P_H
0019 #define DIGIKAM_ITEM_INFO_P_H
0020 
0021 #include "iteminfo.h"
0022 
0023 // Qt includes
0024 
0025 #include <QFile>
0026 #include <QFileInfo>
0027 #include <QHash>
0028 
0029 // Local includes
0030 
0031 #include "digikam_debug.h"
0032 #include "digikam_globals.h"
0033 #include "coredb.h"
0034 #include "coredbaccess.h"
0035 #include "coredbinfocontainers.h"
0036 #include "coredboperationgroup.h"
0037 #include "dimagehistory.h"
0038 #include "collectionmanager.h"
0039 #include "collectionlocation.h"
0040 #include "iteminfodata.h"
0041 #include "iteminfocache.h"
0042 #include "itemlister.h"
0043 #include "itemlisterrecord.h"
0044 #include "iteminfolist.h"
0045 #include "itemcomments.h"
0046 #include "itemcopyright.h"
0047 #include "itemextendedproperties.h"
0048 #include "itemposition.h"
0049 #include "itemscanner.h"
0050 #include "itemtagpair.h"
0051 #include "facetagseditor.h"
0052 #include "tagscache.h"
0053 #include "template.h"
0054 #include "thumbnailinfo.h"
0055 #include "photoinfocontainer.h"
0056 #include "videoinfocontainer.h"
0057 
0058 namespace Digikam
0059 {
0060 
0061 MetadataInfo::Field DatabaseVideoMetadataFieldsToMetadataInfoField(const DatabaseFields::VideoMetadata videoMetadataField);
0062 MetadataInfo::Field DatabaseImageMetadataFieldsToMetadataInfoField(const DatabaseFields::ImageMetadata imageMetadataField);
0063 
0064 #define RETURN_IF_CACHED(x)                            \
0065                                                        \
0066     {                                                  \
0067         ItemInfoReadLocker lock;                       \
0068                                                        \
0069         if (m_data->x##Cached)                         \
0070         {                                              \
0071             return m_data->x;                          \
0072         }                                              \
0073     }
0074 
0075 #define RETURN_ASPECTRATIO_IF_IMAGESIZE_CACHED()       \
0076                                                        \
0077     {                                                  \
0078         ItemInfoReadLocker lock;                       \
0079                                                        \
0080         if (m_data->imageSizeCached)                   \
0081         {                                              \
0082             return (double)m_data->imageSize.width() / \
0083                            m_data->imageSize.height(); \
0084         }                                              \
0085     }
0086 
0087 #define STORE_IN_CACHE_AND_RETURN(x, retrieveMethod)   \
0088                                                        \
0089     {                                                  \
0090         ItemInfoWriteLocker lock;                      \
0091                                                        \
0092         if (!values.isEmpty())                         \
0093         {                                              \
0094             m_data.data()->x##Cached = true;           \
0095             m_data.data()->x         = retrieveMethod; \
0096         }                                              \
0097                                                        \
0098         return m_data->x;                              \
0099     }
0100 
0101 } // namespace Digikam
0102 
0103 #endif // DIGIKAM_ITEM_INFO_P_H