[Digikam-devel] [Bug 301357] Support incomplete dates (without time, day, month), like TIFF DateTime supports

Marcel Wiesweg marcel.wiesweg at gmx.de
Sun Jul 29 13:20:55 BST 2012


https://bugs.kde.org/show_bug.cgi?id=301357

--- Comment #8 from Marcel Wiesweg <marcel.wiesweg at gmx.de> ---
I would do the extra field with flags:

enum ValidFieldFlag
{
HasYear = 1 << 0,
HasMonth = 1 << 1,
HasDay = 1 << 2,
HasHour = 1 << 3,
HasMinute = 1 << 4,
HasSecond = 1 << 5,
HasMicrosecond = 1 << 6,

HasYearOnly = HasYear,
HasYearAndMonthOnly = HasYear | HasMonth
HasDate = HasYear | HasMonth | HasDay
HasTime = HasHour | HasMinute | HasSecond
HasDateTime = HasDate | HasTime
// ... (+subseconds ...)
};
Q_DECLARE_FLAGS(ValidFieldFlags, ValidFieldFlag)
// (declare flags operators outside namespace at the bottom)

ValidFieldFlags validFieldFlags;

// some convenience accessors
bool isComplete() { return (validFieldFlags & HasDateTime) == HasDateTime; }
etc.

// conversion to QDateTime
QDateTime toDateTime() const;

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Digikam-devel mailing list