KOpeningHours::Interval

Search for usage in LXR

KOpeningHours::Interval Class Reference

#include <interval.h>

Public Types

enum  State { Invalid, Open, Closed, Unknown }
 

Properties

QDateTime begin
 
QString comment
 
int dstOffset
 
QDateTime end
 
QDateTime estimatedEnd
 
bool hasOpenBegin
 
bool hasOpenEnd
 
bool hasOpenEndTime
 
State state
 

Public Member Functions

 Interval (const Interval &)
 
 Interval (Interval &&)
 
QDateTime begin () const
 
QString comment () const
 
bool contains (const QDateTime &dt) const
 
int dstOffset () const
 
QDateTime end () const
 
QDateTime estimatedEnd () const
 
bool hasOpenBegin () const
 
bool hasOpenEnd () const
 
bool hasOpenEndTime () const
 
bool intersects (const Interval &other) const
 
bool isValid () const
 
bool operator< (const Interval &other) const
 
Intervaloperator= (const Interval &)
 
Intervaloperator= (Interval &&)
 
void setBegin (const QDateTime &begin)
 
void setComment (const QString &comment)
 
void setEnd (const QDateTime &end)
 
void setEstimatedEnd (const QDateTime &estimatedEnd)
 
void setOpenEndTime (bool openEndTime)
 
void setState (State state)
 
State state () const
 

Detailed Description

A time interval for which an opening hours expression has been evaluated.

Definition at line 24 of file interval.h.

Member Enumeration Documentation

◆ State

Opening state during a time interval.

Definition at line 97 of file interval.h.

Member Function Documentation

◆ begin()

QDateTime KOpeningHours::Interval::begin ( ) const

Begin of the interval.

This is the first point in time included in the interval, or invalid if this is an interval with an open begin.

◆ comment()

QString KOpeningHours::Interval::comment ( ) const

Comment.

◆ contains()

bool Interval::contains ( const QDateTime dt) const

Check if this interval contains dt.

Definition at line 108 of file interval.cpp.

◆ dstOffset()

int KOpeningHours::Interval::dstOffset ( ) const

Returns the UTC offset change between estimatedEnd() and begin().

This is 0, unless there is a DST transition happening in that interval.

Since
23.04.0

◆ end()

QDateTime KOpeningHours::Interval::end ( ) const

End of the interval.

This is the first point in time not included in the interval anymore, or invalid for open-ended intervals. That is, the end of an interval describing the year 2020 would be Jan 1st 2021 at midnight (00:00).

◆ estimatedEnd()

QDateTime KOpeningHours::Interval::estimatedEnd ( ) const

Returns an estimated end time for intervals with an open end time.

By default this is the same as end() would return, unless higher-level logic with a view on multiple intervals and/or other context actually sets this.

◆ hasOpenBegin()

bool KOpeningHours::Interval::hasOpenBegin ( ) const

Returns true if this is an interval with an open begin, ie.

starting at the beginning of time.

◆ hasOpenEnd()

bool KOpeningHours::Interval::hasOpenEnd ( ) const

Returns true if this is an interval with an open end date, ie.

continuing for all eternity.

Note
This is different from an interval with an open end time.

◆ hasOpenEndTime()

bool KOpeningHours::Interval::hasOpenEndTime ( ) const

Returns true if this is an interval with an open end time, ie.

an interval generated by a selector like "20:00+".

Note
This is different from an interval with an open end.

◆ intersects()

bool Interval::intersects ( const Interval other) const

Checks whether this interval overlaps with other.

Definition at line 49 of file interval.cpp.

◆ isValid()

bool Interval::isValid ( ) const

Default constructed empty/invalid interval.

Definition at line 60 of file interval.cpp.

◆ operator<()

bool Interval::operator< ( const Interval other) const

Check whether this interval starts before other.

Definition at line 34 of file interval.cpp.

◆ state()

State KOpeningHours::Interval::state ( ) const

The opening state for this time interval.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:54:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.