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 : 2007-09-12 0007 * Description : Metadata info containers 0008 * 0009 * SPDX-FileCopyrightText: 2007-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 // Local includes 0017 0018 #include "metadatainfo.h" 0019 0020 namespace Digikam 0021 { 0022 0023 bool IptcCoreContactInfo::isNull() const 0024 { 0025 return ( 0026 city.isNull() && 0027 country.isNull() && 0028 address.isNull() && 0029 postalCode.isNull() && 0030 provinceState.isNull() && 0031 email.isNull() && 0032 phone.isNull() && 0033 webUrl.isNull() 0034 ); 0035 } 0036 0037 bool IptcCoreContactInfo::isEmpty() const 0038 { 0039 return ( 0040 city.isEmpty() && 0041 country.isEmpty() && 0042 address.isEmpty() && 0043 postalCode.isEmpty() && 0044 provinceState.isEmpty() && 0045 email.isEmpty() && 0046 phone.isEmpty() && 0047 webUrl.isEmpty() 0048 ); 0049 } 0050 0051 bool IptcCoreContactInfo::operator==(const IptcCoreContactInfo& t) const 0052 { 0053 bool b1 = (city == t.city); 0054 bool b2 = (country == t.country); 0055 bool b3 = (address == t.address); 0056 bool b4 = (postalCode == t.postalCode); 0057 bool b5 = (provinceState == t.provinceState); 0058 bool b6 = (email == t.email); 0059 bool b7 = (phone == t.phone); 0060 bool b8 = (webUrl == t.webUrl); 0061 0062 return (b1 && b2 && b3 && b4 && b5 && b6 && b7 && b8); 0063 } 0064 0065 void IptcCoreContactInfo::merge(const IptcCoreContactInfo& t) 0066 { 0067 if (!t.city.isEmpty()) 0068 { 0069 city = t.city; 0070 } 0071 0072 if (!t.country.isEmpty()) 0073 { 0074 country = t.country; 0075 } 0076 0077 if (!t.address.isEmpty()) 0078 { 0079 address = t.address; 0080 } 0081 0082 if (!t.postalCode.isEmpty()) 0083 { 0084 postalCode = t.postalCode; 0085 } 0086 0087 if (!t.provinceState.isEmpty()) 0088 { 0089 provinceState = t.provinceState; 0090 } 0091 0092 if (!t.email.isEmpty()) 0093 { 0094 email = t.email; 0095 } 0096 0097 if (!t.phone.isEmpty()) 0098 { 0099 phone = t.phone; 0100 } 0101 0102 if (!t.webUrl.isEmpty()) 0103 { 0104 webUrl = t.webUrl; 0105 } 0106 } 0107 0108 QDebug operator<<(QDebug dbg, const IptcCoreContactInfo& inf) 0109 { 0110 dbg.nospace() << "IptcCoreContactInfo::city: " 0111 << inf.city << ", "; 0112 dbg.nospace() << "IptcCoreContactInfo::country: " 0113 << inf.country << ", "; 0114 dbg.nospace() << "IptcCoreContactInfo::address: " 0115 << inf.address << ", "; 0116 dbg.nospace() << "IptcCoreContactInfo::postalCode: " 0117 << inf.postalCode << ", "; 0118 dbg.nospace() << "IptcCoreContactInfo::provinceState: " 0119 << inf.provinceState << ", "; 0120 dbg.nospace() << "IptcCoreContactInfo::email: " 0121 << inf.email << ", "; 0122 dbg.nospace() << "IptcCoreContactInfo::phone: " 0123 << inf.phone << ", "; 0124 dbg.nospace() << "IptcCoreContactInfo::webUrl: " 0125 << inf.webUrl; 0126 0127 return dbg.space(); 0128 } 0129 0130 // ------------------------------------------------------------------------- 0131 0132 bool IptcCoreLocationInfo::isEmpty() const 0133 { 0134 return ( 0135 country.isEmpty() && 0136 countryCode.isEmpty() && 0137 provinceState.isEmpty() && 0138 city.isEmpty() && 0139 location.isEmpty() 0140 ); 0141 } 0142 0143 bool IptcCoreLocationInfo::isNull() const 0144 { 0145 return ( 0146 country.isNull() && 0147 countryCode.isNull() && 0148 provinceState.isNull() && 0149 city.isNull() && 0150 location.isNull() 0151 ); 0152 } 0153 0154 bool IptcCoreLocationInfo::operator==(const IptcCoreLocationInfo& t) const 0155 { 0156 bool b1 = (country == t.country); 0157 bool b2 = (countryCode == t.countryCode); 0158 bool b3 = (provinceState == t.provinceState); 0159 bool b4 = (city == t.city); 0160 bool b5 = (location == t.location); 0161 0162 return (b1 && b2 && b3 && b4 && b5); 0163 } 0164 0165 void IptcCoreLocationInfo::merge(const IptcCoreLocationInfo& t) 0166 { 0167 if (!t.country.isEmpty()) 0168 { 0169 country = t.country; 0170 } 0171 0172 if (!t.countryCode.isEmpty()) 0173 { 0174 countryCode = t.countryCode; 0175 } 0176 0177 if (!t.provinceState.isEmpty()) 0178 { 0179 provinceState = t.provinceState; 0180 } 0181 0182 if (!t.city.isEmpty()) 0183 { 0184 city = t.city; 0185 } 0186 0187 if (!t.location.isEmpty()) 0188 { 0189 location = t.location; 0190 } 0191 } 0192 0193 QDebug operator<<(QDebug dbg, const IptcCoreLocationInfo& inf) 0194 { 0195 dbg.nospace() << "IptcCoreLocationInfo::country: " 0196 << inf.country << ", "; 0197 dbg.nospace() << "IptcCoreLocationInfo::countryCode: " 0198 << inf.countryCode << ", "; 0199 dbg.nospace() << "IptcCoreLocationInfo::provinceState: " 0200 << inf.provinceState << ", "; 0201 dbg.nospace() << "IptcCoreLocationInfo::city: " 0202 << inf.city << ", "; 0203 dbg.nospace() << "IptcCoreLocationInfo::location: " 0204 << inf.location; 0205 0206 return dbg.space(); 0207 } 0208 0209 } // namespace Digikam