add more documentation

This commit is contained in:
Simon Stürz 2016-03-30 21:46:55 +02:00 committed by Michael Zanetti
parent 5f32c11810
commit d1244a9abc
6 changed files with 55 additions and 2 deletions

View File

@ -917,6 +917,7 @@ DeviceManager::DeviceError DeviceManager::executeAction(const Action &action)
return DeviceErrorDeviceNotFound;
}
/*! Centralized time tick for the GuhTimer resource. Ticks every second.*/
void DeviceManager::timeTick()
{

View File

@ -356,6 +356,7 @@ RuleEngine *GuhCore::ruleEngine() const
return m_ruleEngine;
}
/*! Returns a pointer to the \l{TimeManager} instance owned by GuhCore.*/
TimeManager *GuhCore::timeManager() const
{
return m_timeManager;

View File

@ -843,6 +843,7 @@ QVariantMap JsonTypes::packCalendarItem(const CalendarItem &calendarItem)
return calendarItemVariant;
}
/*! Returns a variant map of the given \a timeEventItem. */
QVariantMap JsonTypes::packTimeEventItem(const TimeEventItem &timeEventItem)
{
QVariantMap timeEventItemVariant;
@ -1226,6 +1227,7 @@ CalendarItem JsonTypes::unpackCalendarItem(const QVariantMap &calendarItemMap)
return calendarItem;
}
/*! Returns a \l{TimeEventItem} created from the given \a timeEventItemMap. */
TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap)
{
TimeEventItem timeEventItem;
@ -1242,6 +1244,7 @@ TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap
return timeEventItem;
}
/*! Returns a \l{TimeDescriptor} created from the given \a timeDescriptorMap. */
TimeDescriptor JsonTypes::unpackTimeDescriptor(const QVariantMap &timeDescriptorMap)
{
TimeDescriptor timeDescriptor;

View File

@ -18,7 +18,6 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::TimeDescriptor
\brief Describes the time elements of a time based \l{guhserver::Rule}{Rule}.

View File

@ -18,50 +18,72 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::TimeEventItem
\brief Describes a time event of a time based \l{guhserver::Rule}{Rule}.
\ingroup rules
\inmodule core
\sa Rule, TimeDescriptor, CalendarItem
*/
#include "timeeventitem.h"
namespace guhserver {
/*! Constructs an invalid \l{TimeEventItem}. */
TimeEventItem::TimeEventItem()
{
}
/*! Returns the dateTime of this \l{TimeEventItem}. */
QDateTime TimeEventItem::dateTime() const
{
return m_dateTimer;
}
/*! Sets the dateTime of this \l{TimeEventItem} to the given \a timeStamp. */
void TimeEventItem::setDateTime(const int &timeStamp)
{
m_dateTimer = QDateTime::fromTime_t(timeStamp);
}
/*! Returns the time of this \l{TimeEventItem}. */
QTime TimeEventItem::time() const
{
return m_time;
}
/*! Sets the \a time of this \l{TimeEventItem}. */
void TimeEventItem::setTime(const QTime &time)
{
m_time = time;
}
/*! Returns the \l{RepeatingOption} of this \l{TimeEventItem}. */
RepeatingOption TimeEventItem::repatingOption() const
{
return m_repeatingOption;
}
/*! Sets the \a repeatingOption of this \l{TimeEventItem}. */
void TimeEventItem::setRepeatingOption(const RepeatingOption &repeatingOption)
{
m_repeatingOption = repeatingOption;
}
/*! Returns true if this \l{TimeEventItem} is valid. A \l{TimeEventItem} is valid
if either the \l{time()} or the \l{dateTime()} is set.
*/
bool TimeEventItem::isValid() const
{
return !m_dateTimer.isNull() || !m_time.isNull();
return (!m_dateTimer.isNull() != !m_time.isNull());
}
/*! Returns true, if the given \a dateTime matches this \l{TimeEventItem}. */
bool TimeEventItem::evaluate(const QDateTime &dateTime) const
{
Q_UNUSED(dateTime)

View File

@ -18,11 +18,33 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
\class guhserver::TimeManager
\brief Describes the centralized time manager of guh.
\ingroup rules
\inmodule core
*/
/*! \fn void guhserver::TimeManager::tick()
Represents the central time tick. Will be emitted every second.
*/
/*! \fn void guhserver::TimeManager::dateChanged(const QDate &currentDate);
Will be emitted when the \a currentDate has changed.
*/
/*! \fn void guhserver::TimeManager::timeChanged(const QTime &currentTime);
Will be emitted when the \a currentTime has changed.
*/
#include "timemanager.h"
#include "loggingcategories.h"
namespace guhserver {
/*! Constructs a new \l{TimeManager} with the given \a timeZone and \a parent. */
TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) :
QObject(parent)
{
@ -42,11 +64,13 @@ TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) :
m_guhTimer->start();
}
/*! Returns the time zone of this \l{TimeManager}. */
QByteArray TimeManager::timeZone() const
{
return m_timeZone.id();
}
/*! Sets the \a timeZone of this \l{TimeManager}. */
void TimeManager::setTimeZone(const QByteArray &timeZone)
{
if (!QTimeZone(timeZone).isValid()) {
@ -59,16 +83,19 @@ void TimeManager::setTimeZone(const QByteArray &timeZone)
}
}
/*! Returns the current dateTime of this \l{TimeManager}. */
QDateTime TimeManager::currentDateTime() const
{
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone);
}
/*! Returns the current time of this \l{TimeManager}. */
QTime TimeManager::currentTime() const
{
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).time();
}
/*! Returns the current date of this \l{TimeManager}. */
QDate TimeManager::currentDate() const
{
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).date();