26 #ifndef DIGIKAM_CORE_DB_FIELDS_H
27 #define DIGIKAM_CORE_DB_FIELDS_H
29 #include "digikam_config.h"
52 namespace DatabaseFields
250 #define DECLARE_FIELDMETAINFO(FieldName) \
251 template<> class DIGIKAM_DATABASE_EXPORT FieldMetaInfo <FieldName> \
254 static const FieldName##Field First = FieldName##First; \
255 static const FieldName##Field Last = FieldName##Last; \
256 typedef FieldName##MinSizeType MinSizeType; \
257 inline static MinSizeType toMinSizeType(const FieldName value) { return MinSizeType(value); } \
258 inline static FieldName fromMinSizeType(const MinSizeType value) { return FieldName(value); } \
315 if (! (*i & values) )
347 const FieldName values;
350 #define DATABASEFIELDS_ENUM_ITERATOR(Flag) \
351 typedef DatabaseFieldsEnumIterator<Flag> Flag##Iterator; \
352 typedef DatabaseFieldsEnumIteratorSetOnly<Flag> Flag##IteratorSetOnly;
371 #define DATABASEFIELDS_SET_DECLARE_METHODS(Flag, variable) \
372 explicit Set(const Flag& f) { initialize(); variable = f; } \
373 explicit Set(const Flag##Field& f) { initialize(); variable = f; } \
374 inline Flag& operator=(const Flag& f) { return variable.operator=(f); } \
375 inline Flag& operator|=(Flag f) { return variable.operator|=(f); } \
376 inline Flag& operator^=(Flag f) { return variable.operator^=(f); } \
377 inline Flag operator|(Flag f) const { return variable.operator|(f); } \
378 inline Flag operator^(Flag f) const { return variable.operator^(f); } \
379 inline Flag operator&(Flag f) const { return variable.operator&(f); } \
380 inline operator Flag() const { return variable; } \
381 inline bool hasFieldsFrom##Flag() const { return variable & Flag##All; } \
382 inline Flag get##Flag() const { return variable; }
406 customEnum = CustomEnum();
419 inline
bool operator&(const
Set& other)
421 return (images & other.images) ||
422 (imageInformation & other.imageInformation) ||
423 (imageMetadata & other.imageMetadata) ||
424 (imageComments & other.imageComments) ||
425 (imagePositions & other.imagePositions) ||
426 (imageHistory & other.imageHistory) ||
427 (customEnum & other.customEnum) ||
428 (videoMetadata & other.videoMetadata);
435 images |= otherSet.images;
436 imageInformation |= otherSet.imageInformation;
437 imageMetadata |= otherSet.imageMetadata;
438 imageComments |= otherSet.imageComments;
439 imagePositions |= otherSet.imagePositions;
440 imageHistory |= otherSet.imageHistory;
441 customEnum |= otherSet.customEnum;
442 videoMetadata |= otherSet.videoMetadata;
449 return customEnum.operator=(f);
454 return customEnum.operator|=(f);
459 return customEnum.operator^=(f);
464 return customEnum.operator|(f);
469 return customEnum.operator^(f);
474 return customEnum.operator&(f);
486 ItemInformation imageInformation;
487 ImageMetadata imageMetadata;
488 VideoMetadata videoMetadata;
490 ItemPositions imagePositions;
491 ImageHistoryInfo imageHistory;
492 CustomEnum customEnum;
495 #define DATABASEFIELDS_HASH_DECLARE_METHODS(Key, method) \
496 void insertField(const Key& key, const T& value) { QHash<unsigned int, T>::insert(method(key), value); } \
497 int remove(const Key& key) { return QHash<unsigned int, T>::remove(method(key)); } \
498 int removeAllFields(const Key& key) \
500 int removedCount = 0; \
502 for (DatabaseFieldsEnumIteratorSetOnly<Key> it(key) ; !it.atEnd() ; ++it) \
504 removedCount += remove(*it); \
507 return removedCount; \
510 T take(const Key& key) { return QHash<unsigned int, T>::take(method(key)); } \
512 bool contains(const Key& key) const { return QHash<unsigned int, T>::contains(method(key)); } \
513 const T value(const Key& key) const { return QHash<unsigned int, T>::value(method(key)); } \
514 const T value(const Key& key, const T& defaultValue) const { return QHash<unsigned int, T>::value(method(key), defaultValue); } \
516 T& operator[](const Key& key) { return QHash<unsigned int, T>::operator[](method(key)); } \
517 const T operator[](const Key& key) const { return QHash<unsigned int, T>::operator[](method(key)); } \
519 QList<T> values(const Key& key) const { return QHash<unsigned int, T>::value(method(key)); } \
520 int count(const Key& key) const { return QHash<unsigned int, T>::count(method(key)); }
533 class Hash :
public QHash<unsigned int, T>
541 return (
int)f | (0 << 26);
546 return (
int)f | (1 << 26);
551 return (
int)f | (2 << 26);
556 return (
int)f | (3 << 26);
561 return (
int)f | (4 << 26);
564 static inline unsigned int uniqueKey(ImageHistoryInfo f)
566 return (
int)f | (5 << 26);
571 return (
int)f | (6 << 26);
576 return f | (63 << 26);
595 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::Images)
596 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ItemInformation)
597 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ImageMetadata)
598 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::VideoMetadata)
599 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ItemComments)
600 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ItemPositions)
601 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DatabaseFields::ImageHistoryInfo)
Abstract base class for all album types.
Definition: album.h:67
Definition: coredbfields.h:308
FieldName operator*() const
Definition: coredbfields.h:339
void operator++()
Definition: coredbfields.h:326
bool atEnd() const
Definition: coredbfields.h:321
DatabaseFieldsEnumIteratorSetOnly(const FieldName setValues)
Definition: coredbfields.h:311
Definition: coredbfields.h:275
FieldName operator*() const
Definition: coredbfields.h:294
DatabaseFieldsEnumIterator()
Definition: coredbfields.h:279
bool atEnd() const
Definition: coredbfields.h:284
void operator++()
Definition: coredbfields.h:289
Definition: coredbfields.h:534
DATABASEFIELDS_HASH_DECLARE_METHODS(ImageMetadata, uniqueKey)
DATABASEFIELDS_HASH_DECLARE_METHODS(ImageHistoryInfo, uniqueKey)
DATABASEFIELDS_HASH_DECLARE_METHODS(ItemPositions, uniqueKey)
DATABASEFIELDS_HASH_DECLARE_METHODS(ItemComments, uniqueKey)
static unsigned int uniqueKey(ItemInformation f)
Definition: coredbfields.h:544
static unsigned int uniqueKey(ItemComments f)
Definition: coredbfields.h:554
DATABASEFIELDS_HASH_DECLARE_METHODS(ItemInformation, uniqueKey)
static unsigned int uniqueKey(ImageMetadata f)
Definition: coredbfields.h:549
static unsigned int uniqueKey(Images f)
Definition: coredbfields.h:539
DATABASEFIELDS_HASH_DECLARE_METHODS(CustomEnum, uniqueKey)
static unsigned int uniqueKey(ImageHistoryInfo f)
Definition: coredbfields.h:564
static unsigned int uniqueKey(VideoMetadata f)
Definition: coredbfields.h:569
DATABASEFIELDS_HASH_DECLARE_METHODS(Images, uniqueKey)
DATABASEFIELDS_HASH_DECLARE_METHODS(VideoMetadata, uniqueKey)
static unsigned int uniqueKey(ItemPositions f)
Definition: coredbfields.h:559
static unsigned int uniqueKey(CustomEnum f)
Definition: coredbfields.h:574
Definition: coredbfields.h:389
Set & setFields(const Set &otherSet)
Definition: coredbfields.h:433
CustomEnum operator^(CustomEnum f) const
Definition: coredbfields.h:467
Set()
Definition: coredbfields.h:392
CustomEnum & operator|=(CustomEnum f)
Definition: coredbfields.h:452
CustomEnum & operator^=(CustomEnum f)
Definition: coredbfields.h:457
void initialize()
Definition: coredbfields.h:397
CustomEnum operator|(CustomEnum f) const
Definition: coredbfields.h:462
CustomEnum operator&(CustomEnum f) const
Definition: coredbfields.h:472
CustomEnum & operator=(const CustomEnum &f)
Definition: coredbfields.h:447
#define DECLARE_FIELDMETAINFO(FieldName)
Definition: coredbfields.h:250
#define DATABASEFIELDS_ENUM_ITERATOR(Flag)
Definition: coredbfields.h:350
#define DATABASEFIELDS_SET_DECLARE_METHODS(Flag, variable)
Definition: coredbfields.h:371
uint16_t ItemPositionsMinSizeType
Definition: coredbfields.h:179
CustomEnumFlags
Definition: coredbfields.h:367
ItemInformationField
Definition: coredbfields.h:81
@ ItemInformationNone
Definition: coredbfields.h:82
@ Width
Definition: coredbfields.h:87
@ ItemInformationLast
Definition: coredbfields.h:106
@ ItemInformationAll
Definition: coredbfields.h:94
@ CreationDate
Definition: coredbfields.h:84
@ DigitizationDate
Definition: coredbfields.h:85
@ PickLabel
Definition: coredbfields.h:93
@ Rating
Definition: coredbfields.h:83
@ Orientation
Definition: coredbfields.h:86
@ Height
Definition: coredbfields.h:88
@ ColorModel
Definition: coredbfields.h:91
@ ItemInformationFirst
Definition: coredbfields.h:105
@ ColorDepth
Definition: coredbfields.h:90
@ Format
Definition: coredbfields.h:89
uint8_t VideoMetadataMinSizeType
Definition: coredbfields.h:236
ImagesField
Definition: coredbfields.h:56
@ ImagesAll
Definition: coredbfields.h:66
@ Status
Definition: coredbfields.h:60
@ ManualOrder
Definition: coredbfields.h:65
@ Album
Definition: coredbfields.h:58
@ Name
Definition: coredbfields.h:59
@ FileSize
Definition: coredbfields.h:63
@ ImagesFirst
Definition: coredbfields.h:74
@ ModificationDate
Definition: coredbfields.h:62
@ Category
Definition: coredbfields.h:61
@ ImagesLast
Definition: coredbfields.h:75
@ UniqueHash
Definition: coredbfields.h:64
@ ImagesNone
Definition: coredbfields.h:57
ItemCommentsField
Definition: coredbfields.h:182
@ CommentDate
Definition: coredbfields.h:187
@ Comment
Definition: coredbfields.h:188
@ ItemCommentsFirst
Definition: coredbfields.h:194
@ CommentAuthor
Definition: coredbfields.h:186
@ CommentType
Definition: coredbfields.h:184
@ ItemCommentsLast
Definition: coredbfields.h:195
@ ItemCommentsNone
Definition: coredbfields.h:183
@ ItemCommentsAll
Definition: coredbfields.h:189
@ CommentLanguage
Definition: coredbfields.h:185
VideoMetadataField
Definition: coredbfields.h:216
@ VideoMetadataFirst
Definition: coredbfields.h:232
@ VideoCodec
Definition: coredbfields.h:224
@ AudioCodec
Definition: coredbfields.h:221
@ VideoMetadataNone
Definition: coredbfields.h:217
@ Duration
Definition: coredbfields.h:222
@ FrameRate
Definition: coredbfields.h:223
@ AspectRatio
Definition: coredbfields.h:218
@ VideoMetadataAll
Definition: coredbfields.h:225
@ AudioChannelType
Definition: coredbfields.h:220
@ VideoMetadataLast
Definition: coredbfields.h:233
@ AudioBitRate
Definition: coredbfields.h:219
uint8_t ImagesMinSizeType
Definition: coredbfields.h:78
uint8_t ItemCommentsMinSizeType
Definition: coredbfields.h:198
uint16_t ImageMetadataMinSizeType
Definition: coredbfields.h:150
uint8_t ImageHistoryInfoMinSizeType
Definition: coredbfields.h:213
uint16_t ItemInformationMinSizeType
Definition: coredbfields.h:109
ImageHistoryInfoField
Definition: coredbfields.h:201
@ ImageHistoryInfoLast
Definition: coredbfields.h:210
@ ImageHistory
Definition: coredbfields.h:204
@ ImageHistoryInfoFirst
Definition: coredbfields.h:209
@ ImageHistoryInfoNone
Definition: coredbfields.h:202
@ ImageHistoryInfoAll
Definition: coredbfields.h:206
@ ImageRelations
Definition: coredbfields.h:205
@ ImageUUID
Definition: coredbfields.h:203
ItemPositionsField
Definition: coredbfields.h:153
@ ItemPositionsLast
Definition: coredbfields.h:176
@ Altitude
Definition: coredbfields.h:159
@ PositionRoll
Definition: coredbfields.h:162
@ ItemPositionsNone
Definition: coredbfields.h:154
@ PositionAccuracy
Definition: coredbfields.h:163
@ Latitude
Definition: coredbfields.h:155
@ LatitudeNumber
Definition: coredbfields.h:156
@ Longitude
Definition: coredbfields.h:157
@ ItemPositionsFirst
Definition: coredbfields.h:175
@ LongitudeNumber
Definition: coredbfields.h:158
@ PositionTilt
Definition: coredbfields.h:161
@ PositionDescription
Definition: coredbfields.h:164
@ PositionOrientation
Definition: coredbfields.h:160
@ ItemPositionsAll
Definition: coredbfields.h:165
ImageMetadataField
Definition: coredbfields.h:112
@ ImageMetadataFirst
Definition: coredbfields.h:146
@ FlashMode
Definition: coredbfields.h:124
@ ExposureMode
Definition: coredbfields.h:122
@ FocalLength
Definition: coredbfields.h:118
@ Make
Definition: coredbfields.h:114
@ ImageMetadataAll
Definition: coredbfields.h:130
@ SubjectDistance
Definition: coredbfields.h:128
@ ImageMetadataLast
Definition: coredbfields.h:147
@ ExposureProgram
Definition: coredbfields.h:121
@ Sensitivity
Definition: coredbfields.h:123
@ FocalLength35
Definition: coredbfields.h:119
@ ExposureTime
Definition: coredbfields.h:120
@ MeteringMode
Definition: coredbfields.h:127
@ ImageMetadataNone
Definition: coredbfields.h:113
@ SubjectDistanceCategory
Definition: coredbfields.h:129
@ WhiteBalanceColorTemperature
Definition: coredbfields.h:126
@ Lens
Definition: coredbfields.h:116
@ Aperture
Definition: coredbfields.h:117
@ Model
Definition: coredbfields.h:115
@ WhiteBalance
Definition: coredbfields.h:125
Definition: datefolderview.cpp:43
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition: dbengineparameters.cpp:863
QDataStream & operator>>(QDataStream &ds, PhotoInfoContainer &info)
Definition: photoinfocontainer.cpp:117
ColorLabel
Definition: digikam_globals.h:103
PickLabel
Definition: digikam_globals.h:122