15 bool openEndTime =
false;
24 : d(new IntervalPrivate)
28Interval::Interval(
const Interval&) =
default;
29Interval::Interval(
Interval&&) =
default;
30Interval::~Interval() =
default;
36 if (hasOpenBegin() && !other.hasOpenBegin()) {
39 if (other.hasOpenBegin() && !hasOpenBegin()) {
43 if (d->begin == other.d->begin) {
44 return d->end < other.d->end;
46 return d->begin < other.d->begin;
51 if (d->end.isValid() && other.d->begin.isValid() && d->end <= other.d->begin) {
54 if (other.d->end.isValid() && d->begin.isValid() && other.d->end <= d->begin) {
62 return d->state != Invalid;
70void Interval::setBegin(
const QDateTime &begin)
76bool Interval::hasOpenBegin()
const
78 return !d->begin.isValid();
86void Interval::setEnd(
const QDateTime &end)
92bool Interval::hasOpenEnd()
const
94 return !d->end.isValid();
97bool Interval::hasOpenEndTime()
const
99 return d->openEndTime;
102void Interval::setOpenEndTime(
bool openEndTime)
105 d->openEndTime = openEndTime;
110 if (d->openEndTime && d->begin.isValid() && d->begin == d->end) {
111 return dt == d->begin;
113 return (d->begin.isValid() ? d->begin <= dt :
true) && (d->end.isValid() ? dt < d->end :
true);
132void Interval::setComment(
const QString &comment)
135 d->comment = comment;
140 if (d->openEndTime && d->estimatedEnd.isValid()) {
141 return d->estimatedEnd;
146void Interval::setEstimatedEnd(
const QDateTime& estimatedEnd)
149 d->estimatedEnd = estimatedEnd;
152int Interval::dstOffset()
const
154 if (d->begin.isValid() && estimatedEnd().
isValid()) {
155 return estimatedEnd().
offsetFromUtc() - d->begin.offsetFromUtc();
163 debug.
nospace().
noquote() <<
'[' << interval.begin().
toString(QStringLiteral(
"yyyy-MM-ddThh:mm")) <<
" - " << interval.end().
toString(QStringLiteral(
"yyyy-MM-ddThh:mm")) <<
' ' << interval.state() <<
" (\"" << interval.comment() <<
"\")]";
167#include "moc_interval.cpp"
A time interval for which an opening hours expression has been evaluated.
bool isValid() const
Default constructed empty/invalid interval.
bool operator<(const Interval &other) const
Check whether this interval starts before other.
State
Opening state during a time interval.
bool contains(const QDateTime &dt) const
Check if this interval contains dt.
bool intersects(const Interval &other) const
Checks whether this interval overlaps with other.
OSM opening hours parsing and evaluation.
int offsetFromUtc() const const
QString toString(QStringView format, QCalendar cal) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:05 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.