This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-core/server/time/timedescriptor.cpp
2019-04-01 20:48:17 +02:00

77 lines
3.0 KiB
C++

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2016 Simon Stuerz <simon.stuerz@guh.guru> *
* *
* This file is part of guh. *
* *
* Guh is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 2 of the License. *
* *
* Guh is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::TimeDescriptor
\brief Describes the time elements of a time based \l{guhserver::Rule}{Rule}.
\ingroup rules
\inmodule core
A time based rule can be described with a \l{TimeDescriptor}. The \l{TimeDescriptor}
can have either a list of \l{TimeEventItem}{TimeEventItems} or a list of \l{CalendarItem}{CalendarItems},
never both.
\sa Rule, TimeEventItem, CalendarItem
*/
#include "timedescriptor.h"
namespace guhserver {
/*! Constructs an invalid \l{TimeDescriptor}.*/
TimeDescriptor::TimeDescriptor()
{
}
/*! Returns the list of \l{TimeEventItem}{TimeEventItems} of this \l{TimeDescriptor}.*/
QList<TimeEventItem> TimeDescriptor::timeEventItems() const
{
return m_timeEventItems;
}
/*! Set the list of \l{TimeEventItem}{TimeEventItems} of this \l{TimeDescriptor} to the given \a timeEventItems.*/
void TimeDescriptor::setTimeEventItems(const QList<TimeEventItem> &timeEventItems)
{
m_timeEventItems = timeEventItems;
}
/*! Returns the list of \l{CalendarItem}{CalendarItems} of this \l{TimeDescriptor}.*/
QList<CalendarItem> TimeDescriptor::calendarItems() const
{
return m_calendarItems;
}
/*! Set the list of \l{CalendarItem}{CalendarItems} of this \l{TimeDescriptor} to the given \a calendarItems.*/
void TimeDescriptor::setCalendarItems(const QList<CalendarItem> &calendarItems)
{
m_calendarItems = calendarItems;
}
/*! Returns true if either the calendarItems list is not empty or the timeEventItems list.*/
bool TimeDescriptor::isValid() const
{
return !m_timeEventItems.isEmpty() || !m_calendarItems.isEmpty();
}
}