![]() |
OpenMS
|
#include <OpenMS/DATASTRUCTURES/Date.h>
Public Member Functions | |
| Date () | |
| Default constructor. | |
| Date (const Date &date) | |
| Copy constructor. | |
| Date (const QDate &date) | |
| Copy constructor from Qt base class. | |
| Date (Date &&) noexcept | |
| Move constructor. | |
| ~Date () | |
| Destructor. | |
| Date & | operator= (const Date &source) |
| Assignment operator. | |
| Date & | operator= (Date &&) &noexcept |
| Move assignment operator. | |
| bool | operator== (const Date &rhs) const |
| Equality operator. | |
| bool | operator!= (const Date &rhs) const |
| Inequality operator. | |
| bool | operator< (const Date &rhs) const |
| Less than operator. | |
| void | set (const String &date) |
| sets data from a string | |
| void | set (UInt month, UInt day, UInt year) |
| sets data from three integers | |
| String | get () const |
| Returns a string representation of the date. | |
| void | get (UInt &month, UInt &day, UInt &year) const |
| Fills the arguments with the date. | |
| void | clear () |
| Sets the undefined date: 00/00/0000. | |
| bool | isValid () const |
| Returns if the date is valid. | |
| bool | isNull () const |
| Returns if the date is null. | |
| int | year () const |
| Returns the year. | |
| int | month () const |
| Returns the month. | |
| int | day () const |
| Returns the day. | |
Static Public Member Functions | |
| static Date | today () |
| Returns the current date. | |
Private Attributes | |
| std::unique_ptr< QDate > | date_ |
| Internal QDate representation. | |
Date Class.
This class implements date handling. Import and export to/from both string and integers is possible.
| Date | ( | ) |
Default constructor.
Fills the object with an undefined date: 00/00/0000
| Date | ( | const QDate & | date | ) |
Copy constructor from Qt base class.
| ~Date | ( | ) |
Destructor.
| void clear | ( | ) |
Sets the undefined date: 00/00/0000.
| int day | ( | ) | const |
Returns the day.
| String get | ( | ) | const |
Returns a string representation of the date.
Uses the iso/ansi date format: 'yyyy-mm-dd'
Fills the arguments with the date.
Give the numbers in the following order: month, day and year.
| bool isNull | ( | ) | const |
Returns if the date is null.
| bool isValid | ( | ) | const |
Returns if the date is valid.
| int month | ( | ) | const |
Returns the month.
| bool operator!= | ( | const Date & | rhs | ) | const |
Inequality operator.
| bool operator< | ( | const Date & | rhs | ) | const |
Less than operator.
| bool operator== | ( | const Date & | rhs | ) | const |
Equality operator.
| void set | ( | const String & | date | ) |
sets data from a string
The following date formats are supported:
| Exception::ParseError | is thrown if the date is given in the wrong format |
sets data from three integers
| Exception::ParseError | is thrown if an invalid date is given |
|
static |
Returns the current date.
| int year | ( | ) | const |
Returns the year.
|
private |
Internal QDate representation.