4#include "include/data_types/private/abstract_data_type.h"
36 inline QDate
get()
const {
return date_; }
44 void toSiDate(qint16 &day, qint16 &
year,
bool &is_leap_year)
const;
48 inline qint32
year()
const {
return date_.year(); }
69 QDate date_{1900, 2, 1};
72 friend QDataStream &operator>>(QDataStream &in,
Date &
data);
73 friend QDataStream &operator<<(QDataStream &out,
const Date &
data);
80 inline QVariant value(
const qint32 role = Qt::DisplayRole)
const override
87 void setValue(
const QVariant &value)
override;
91QDataStream &operator>>(QDataStream &in, Date &data);
92QDataStream &operator<<(QDataStream &out,
const Date &data);
The AbstractDataType class provides common virtual functions for all integral game data types.
Definition: abstract_data_type.h:11
QVariant data(const qint32 role=Qt::DisplayRole) const
Returns the data stored under the given role for the item.
The Date class acts as a QDate wrapper for EHM format SI_Date.
Definition: date.h:17
QDate get() const
Returns the date.
Definition: date.h:36
void set(qint16 day, qint16 year)
Sets the Date from an SI_Date format date.
ENUM_THRESHOLDS
The ENUM_THRESHOLDS enum denotes certain date thresholds.
Definition: date.h:62
@ FIRST_DAY_OF_THE_YEAR
Definition: date.h:65
@ FEBRUARY_28TH
Definition: date.h:64
@ MINIMUM_YEAR
Definition: date.h:63
Date()
Default constructor.
qint32 year() const
Returns the year.
Definition: date.h:48
void toSiDate(qint16 &day, qint16 &year, bool &is_leap_year) const
Converts the Date to SI_Date format. The day, year and is_leap_year must be passed by reference....
void readFromSavedGame(QDataStream &in)
Reads an SI_Date from a saved game which does not include a bool leap year value.
namespace ehm_dal::data_types
Definition: attribute.h:6