KOpeningHours
15 bool openEndTime =
false;
24 : d(new IntervalPrivate)
28 Interval::Interval(
const Interval&) =
default;
29 Interval::Interval(
Interval&&) =
default;
30 Interval::~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;
70 void Interval::setBegin(
const QDateTime &begin)
76 bool Interval::hasOpenBegin()
const
78 return !d->begin.isValid();
86 void Interval::setEnd(
const QDateTime &end)
92 bool Interval::hasOpenEnd()
const
94 return !d->end.isValid();
97 bool Interval::hasOpenEndTime()
const
99 return d->openEndTime;
102 void 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);
127 QString Interval::comment()
const
132 void Interval::setComment(
const QString &comment)
135 d->comment = comment;
140 if (d->openEndTime && d->estimatedEnd.isValid()) {
141 return d->estimatedEnd;
146 void Interval::setEstimatedEnd(
const QDateTime& estimatedEnd)
149 d->estimatedEnd = estimatedEnd;
155 debug.
nospace().
noquote() <<
'[' << interval.begin().
toString(QStringLiteral(
"yyyy-MM-ddThh:mm")) <<
" - " << interval.end().
toString(QStringLiteral(
"yyyy-MM-ddThh:mm")) <<
' ' << interval.state() <<
" (\"" << interval.comment() <<
"\")]";
State
Opening state during a time interval.
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
const QList< QKeySequence > & begin()
bool contains(const QDateTime &dt) const
Check if this interval contains dt.
bool operator<(const Interval &other) const
Check whether this interval starts before other.
bool isValid() const
Default constructed empty/invalid interval.
QString toString(Qt::DateFormat format) const const
OSM opening hours parsing and evaluation.
const QList< QKeySequence > & end()
bool intersects(const Interval &other) const
Checks whether this interval overlaps with other.
A time interval for which an opening hours expression has been evaluated.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 04:07:20 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.