File indexing completed on 2025-01-05 03:56:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-04-21 0007 * Description : photo information container 0008 * 0009 * SPDX-FileCopyrightText: 2006-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 "photoinfocontainer.h" 0016 0017 // Qt includes 0018 0019 #include <QDataStream> 0020 0021 namespace Digikam 0022 { 0023 0024 bool PhotoInfoContainer::operator==(const PhotoInfoContainer& t) const 0025 { 0026 bool b1 = (make == t.make); 0027 bool b2 = (model == t.model); 0028 bool b3 = (lens == t.lens); 0029 bool b4 = (exposureTime == t.exposureTime); 0030 bool b5 = (exposureMode == t.exposureMode); 0031 bool b6 = (exposureProgram == t.exposureProgram); 0032 bool b7 = (aperture == t.aperture); 0033 bool b8 = (focalLength == t.focalLength); 0034 bool b9 = (focalLength35mm == t.focalLength35mm); 0035 bool b10 = (sensitivity == t.sensitivity); 0036 bool b11 = (flash == t.flash); 0037 bool b12 = (whiteBalance == t.whiteBalance); 0038 bool b13 = (dateTime == t.dateTime); 0039 bool b14 = (hasCoordinates == t.hasCoordinates); 0040 0041 return (b1 && b2 && b3 && b4 && b5 && b6 && b7 && b8 && b9 && b10 && b11 && b12 && b13 && b14); 0042 } 0043 0044 bool PhotoInfoContainer::isEmpty() const 0045 { 0046 if (make.isEmpty() && 0047 model.isEmpty() && 0048 lens.isEmpty() && 0049 exposureTime.isEmpty() && 0050 exposureMode.isEmpty() && 0051 exposureProgram.isEmpty() && 0052 aperture.isEmpty() && 0053 focalLength.isEmpty() && 0054 focalLength35mm.isEmpty() && 0055 sensitivity.isEmpty() && 0056 flash.isEmpty() && 0057 whiteBalance.isEmpty() && 0058 !dateTime.isValid() && 0059 !hasCoordinates) 0060 { 0061 return true; 0062 } 0063 else 0064 { 0065 return false; 0066 } 0067 } 0068 0069 bool PhotoInfoContainer::isNull() const 0070 { 0071 return ( 0072 make.isNull() && 0073 model.isNull() && 0074 lens.isNull() && 0075 exposureTime.isNull() && 0076 exposureMode.isNull() && 0077 exposureProgram.isNull() && 0078 aperture.isNull() && 0079 focalLength.isNull() && 0080 focalLength35mm.isNull() && 0081 sensitivity.isNull() && 0082 flash.isNull() && 0083 whiteBalance.isNull() && 0084 dateTime.isNull() 0085 ); 0086 } 0087 0088 QDataStream& operator<<(QDataStream& ds, const PhotoInfoContainer& info) 0089 { 0090 ds << info.make; 0091 ds << info.model; 0092 ds << info.lens; 0093 ds << info.exposureTime; 0094 ds << info.exposureMode; 0095 ds << info.exposureProgram; 0096 ds << info.aperture; 0097 ds << info.focalLength; 0098 ds << info.focalLength35mm; 0099 ds << info.sensitivity; 0100 ds << info.flash; 0101 ds << info.whiteBalance; 0102 ds << info.dateTime; 0103 ds << info.hasCoordinates; 0104 0105 return ds; 0106 } 0107 0108 QDataStream& operator>>(QDataStream& ds, PhotoInfoContainer& info) 0109 { 0110 ds >> info.make; 0111 ds >> info.model; 0112 ds >> info.lens; 0113 ds >> info.exposureTime; 0114 ds >> info.exposureMode; 0115 ds >> info.exposureProgram; 0116 ds >> info.aperture; 0117 ds >> info.focalLength; 0118 ds >> info.focalLength35mm; 0119 ds >> info.sensitivity; 0120 ds >> info.flash; 0121 ds >> info.whiteBalance; 0122 ds >> info.dateTime; 0123 ds >> info.hasCoordinates; 0124 0125 return ds; 0126 } 0127 0128 QDebug operator<<(QDebug dbg, const PhotoInfoContainer& t) 0129 { 0130 dbg.nospace() << "PhotoInfoContainer::make: " 0131 << t.make << ", "; 0132 dbg.nospace() << "PhotoInfoContainer::model: " 0133 << t.model << ", "; 0134 dbg.nospace() << "PhotoInfoContainer::lens: " 0135 << t.lens << ", "; 0136 dbg.nospace() << "PhotoInfoContainer::exposureTime: " 0137 << t.exposureTime << ", "; 0138 dbg.nospace() << "PhotoInfoContainer::exposureMode: " 0139 << t.exposureMode << ", "; 0140 dbg.nospace() << "PhotoInfoContainer::exposureProgram: " 0141 << t.exposureProgram << ", "; 0142 dbg.nospace() << "PhotoInfoContainer::aperture: " 0143 << t.aperture << ", "; 0144 dbg.nospace() << "PhotoInfoContainer::focalLength: " 0145 << t.focalLength << ", "; 0146 dbg.nospace() << "PhotoInfoContainer::focalLength35mm: " 0147 << t.focalLength35mm << ", "; 0148 dbg.nospace() << "PhotoInfoContainer::sensitivity: " 0149 << t.sensitivity; 0150 dbg.nospace() << "PhotoInfoContainer::flash: " 0151 << t.flash; 0152 dbg.nospace() << "PhotoInfoContainer::whiteBalance: " 0153 << t.whiteBalance; 0154 dbg.nospace() << "PhotoInfoContainer::dateTime: " 0155 << t.dateTime; 0156 dbg.nospace() << "PhotoInfoContainer::hasCoordinates: " 0157 << t.hasCoordinates; 0158 0159 return dbg.space(); 0160 } 0161 0162 } // namespace Digikam