• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk

Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
DateRange Class Reference

#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.

Author
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org

Definition at line 41 of file daterange.h.

Member Enumeration Documentation

enum DateRange::DateRangeFlag

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 DateRange DateRange::lastNDays ( int  n)
static
Returns
A DateRange which spans the last n days.
static DateRange DateRange::lastNMonths ( int  n)
static
Returns
A DateRange which spans the last n months, including the already passed days in the current month.
static DateRange DateRange::lastNWeeks ( int  n)
static
Returns
A DateRange which spans the last n weeks, including the already passed days in the current week.
static DateRange DateRange::monthOf ( const QDate &  date,
DateRangeFlags  flags = NoDateRangeFlags 
)
static
Parameters
flagsExcludeFutureDays 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
DateRange& DateRange::operator= ( const DateRange &  other)

Make this range a copy of other.

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 DateRange DateRange::thisMonth ( DateRangeFlags  flags = NoDateRangeFlags)
static
Returns
A DateRange which includes all days of the current month.
See also
DateRangeFlag
static DateRange DateRange::thisWeek ( DateRangeFlags  flags = NoDateRangeFlags)
static

Takes KLocale::weekStartDay() into account.

See also
DateRangeFlag
static DateRange DateRange::thisYear ( DateRangeFlags  flags = NoDateRangeFlags)
static
Returns
A DateRange which includes all days of the current year.
See also
DateRangeFlag
static DateRange DateRange::today ( )
static
Returns
a DateRange with both start and end dates set to QDate::currentDate()
static DateRange DateRange::weekOf ( const QDate &  date,
DateRangeFlags  flags = NoDateRangeFlags 
)
static

Takes KLocale::weekStartDay() into account.

Parameters
flagsExcludeFutureDays does only makes sense for a date in the current week. For future weeks it is ignored.
See also
DateRangeFlag
static DateRange DateRange::yearOf ( const QDate &  date,
DateRangeFlags  flags = NoDateRangeFlags 
)
static
Parameters
flagsExcludeFutureDays 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

bool operator!= ( const DateRange &  r1,
const DateRange &  r2 
)
related

Comparison operator.

QDebug operator<< ( QDebug  dbg,
const DateRange &  range 
)
related

Debug streaming operator.

bool operator== ( const DateRange &  r1,
const DateRange &  r2 
)
related

Comparison operator.

uint qHash ( const DateRange &  range)
related

Allows using DateRange in hashed structures such as QHash or QMap.


The documentation for this class was generated from the following file:
  • daterange.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk

Skip menu "Nepomuk"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal