Nepomuk
#include <DateRange>
Public Types | |
enum | DateRangeFlag { NoDateRangeFlags = 0x0, ExcludeFutureDays = 0x1 } |
Public Member Functions | |
DateRange (const QDate &s=QDate(), const QDate &e=QDate()) | |
DateRange (const DateRange &other) | |
~DateRange () | |
QDate | end () const |
bool | isValid () const |
DateRange & | operator= (const DateRange &other) |
void | setEnd (const QDate &date) |
void | setStart (const QDate &date) |
QDate | start () const |
Static Public Member Functions | |
static DateRange | lastNDays (int n) |
static DateRange | lastNMonths (int n) |
static DateRange | lastNWeeks (int n) |
static DateRange | monthOf (const QDate &date, DateRangeFlags flags=NoDateRangeFlags) |
static DateRange | thisMonth (DateRangeFlags flags=NoDateRangeFlags) |
static DateRange | thisWeek (DateRangeFlags flags=NoDateRangeFlags) |
static DateRange | thisYear (DateRangeFlags flags=NoDateRangeFlags) |
static DateRange | today () |
static DateRange | weekOf (const QDate &date, DateRangeFlags flags=NoDateRangeFlags) |
static DateRange | yearOf (const QDate &date, DateRangeFlags flags=NoDateRangeFlags) |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator!= (const DateRange &r1, const DateRange &r2) |
QDebug | operator<< (QDebug dbg, const DateRange &range) |
bool | operator== (const DateRange &r1, const DateRange &r2) |
uint | qHash (const DateRange &range) |
Detailed Description
A simple data structure storing a start and an end date.
DateRange is a very simple data structure storing a start and an end date. The really interesting parts are the static factory methods which take the current calendar system into account and, thus, create accurate values.
Definition at line 41 of file daterange.h.
Member Enumeration Documentation
The flags allow to change the result returned by several of the static factory methods provided by DateRange such as thisWeek() or thisMonth().
Enumerator | |
---|---|
NoDateRangeFlags |
No flags. |
ExcludeFutureDays |
Exclude days that are in the future. thisWeek() for example will not include the days in the week that come after the current day. |
Definition at line 102 of file daterange.h.
Constructor & Destructor Documentation
DateRange::DateRange | ( | const QDate & | s = QDate() , |
const QDate & | e = QDate() |
||
) |
Create a new range.
DateRange::DateRange | ( | const DateRange & | other | ) |
Copy constructor.
DateRange::~DateRange | ( | ) |
Destructor.
Member Function Documentation
QDate DateRange::end | ( | ) | const |
End date of the range.
bool DateRange::isValid | ( | ) | const |
Checks if both start and end are valid dates and if end is after start.
|
static |
- Returns
- A DateRange which spans the last
n
days.
|
static |
- Returns
- A DateRange which spans the last
n
months, including the already passed days in the current month.
|
static |
- Returns
- A DateRange which spans the last
n
weeks, including the already passed days in the current week.
|
static |
- Parameters
-
flags ExcludeFutureDays does only makes sense for a date in the current month. For future months it is ignored.
- Returns
- A DateRange which includes all days of the month in which
date
falls.
- See also
- DateRangeFlag
void DateRange::setEnd | ( | const QDate & | date | ) |
Set the end to date
.
void DateRange::setStart | ( | const QDate & | date | ) |
Set the start to date
.
QDate DateRange::start | ( | ) | const |
Start date of the range.
|
static |
- Returns
- A DateRange which includes all days of the current month.
- See also
- DateRangeFlag
|
static |
Takes KLocale::weekStartDay() into account.
- See also
- DateRangeFlag
|
static |
- Returns
- A DateRange which includes all days of the current year.
- See also
- DateRangeFlag
|
static |
- Returns
- a DateRange with both start and end dates set to QDate::currentDate()
|
static |
Takes KLocale::weekStartDay() into account.
- Parameters
-
flags ExcludeFutureDays does only makes sense for a date in the current week. For future weeks it is ignored.
- See also
- DateRangeFlag
|
static |
- Parameters
-
flags ExcludeFutureDays does only makes sense for a date in the current year. For future years it is ignored.
- Returns
- A DateRange which includes all days of the year in which
date
falls.
- See also
- DateRangeFlags
Friends And Related Function Documentation
|
related |
Debug streaming operator.
|
related |
Allows using DateRange in hashed structures such as QHash or QMap.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.