From b7262b51e486d46d871faae1d0c1566d1cfa4cf2 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Thu, 21 Jun 2018 11:42:14 +0200 Subject: [PATCH] add docs --- libnymea-core/rule.cpp | 2 ++ libnymea-core/stateevaluator.cpp | 1 + libnymea-core/time/calendaritem.cpp | 1 + libnymea-core/time/repeatingoption.cpp | 1 + libnymea-core/time/timedescriptor.cpp | 1 + libnymea-core/time/timeeventitem.cpp | 1 + libnymea/types/eventdescriptor.cpp | 2 +- libnymea/types/paramdescriptor.cpp | 2 +- libnymea/types/ruleaction.cpp | 2 ++ libnymea/types/statedescriptor.cpp | 8 ++++++++ 10 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libnymea-core/rule.cpp b/libnymea-core/rule.cpp index ab54e4a0..e4d11ddc 100644 --- a/libnymea-core/rule.cpp +++ b/libnymea-core/rule.cpp @@ -230,6 +230,8 @@ void Rule::setActive(const bool &active) m_active = active; } +/*! Print a Rule with all its contents to QDebug. Note that this might print a lot of data. + * It is useful to debug, but be cautionous with using this in production code. */ QDebug operator<<(QDebug dbg, const Rule &rule) { dbg.nospace() << endl << "=== Rule begin ===" << endl; diff --git a/libnymea-core/stateevaluator.cpp b/libnymea-core/stateevaluator.cpp index f27dd853..922259ce 100644 --- a/libnymea-core/stateevaluator.cpp +++ b/libnymea-core/stateevaluator.cpp @@ -346,6 +346,7 @@ bool StateEvaluator::isValid() const return true; } +/*! Print a StateEvaluator including childEvaluators recuresively to QDebug. */ QDebug operator<<(QDebug dbg, const StateEvaluator &stateEvaluator) { dbg.nospace() << "StateEvaluator: Operator:" << stateEvaluator.operatorType() << endl << " " << stateEvaluator.stateDescriptor() << endl; diff --git a/libnymea-core/time/calendaritem.cpp b/libnymea-core/time/calendaritem.cpp index 5ab94499..b3a07e5d 100644 --- a/libnymea-core/time/calendaritem.cpp +++ b/libnymea-core/time/calendaritem.cpp @@ -268,6 +268,7 @@ bool CalendarItem::evaluateYearly(const QDateTime &dateTime) const return false; } +/*! Print a CalendarItem to QDebug. */ QDebug operator<<(QDebug dbg, const CalendarItem &calendarItem) { dbg.nospace() << "CalendarItem (StartTime:" << calendarItem.startTime() << ", DateTime:" << calendarItem.dateTime().toString() << ", " << calendarItem.repeatingOption() << ", Duration:" << calendarItem.duration() << ")"; diff --git a/libnymea-core/time/repeatingoption.cpp b/libnymea-core/time/repeatingoption.cpp index 78e201fd..3a25fd26 100644 --- a/libnymea-core/time/repeatingoption.cpp +++ b/libnymea-core/time/repeatingoption.cpp @@ -191,6 +191,7 @@ bool RepeatingOption::evaluateMonthDay(const QDateTime &dateTime) const return false; } +/*! Print a RepeatingOption to QDebug. */ QDebug operator<<(QDebug dbg, const RepeatingOption &repeatingOption) { dbg.nospace() << "RepeatingOption(Mode:" << repeatingOption.mode() << ", Monthdays:" << repeatingOption.monthDays() << "Weekdays:" << repeatingOption.weekDays() << ")"; diff --git a/libnymea-core/time/timedescriptor.cpp b/libnymea-core/time/timedescriptor.cpp index 854b75a7..ab56c383 100644 --- a/libnymea-core/time/timedescriptor.cpp +++ b/libnymea-core/time/timedescriptor.cpp @@ -107,6 +107,7 @@ bool TimeDescriptor::evaluate(const QDateTime &lastEvaluationTime, const QDateTi return false; } +/*! Print a TimeDescriptor including the full lists of CalendarItems and TimeEventItems to QDebug. */ QDebug operator<<(QDebug dbg, const TimeDescriptor &timeDescriptor) { dbg.nospace() << "TimeDescriptor (TimeEventItems:" << timeDescriptor.timeEventItems().count() << ", CalendarItems:" << timeDescriptor.calendarItems().count() << ")" << endl; diff --git a/libnymea-core/time/timeeventitem.cpp b/libnymea-core/time/timeeventitem.cpp index d3ffe7e4..ce19c206 100644 --- a/libnymea-core/time/timeeventitem.cpp +++ b/libnymea-core/time/timeeventitem.cpp @@ -134,6 +134,7 @@ bool TimeEventItem::evaluate(const QDateTime &lastEvaluationTime, const QDateTim return lastEvaluationTime < m_dateTime && m_dateTime <= dateTime; } +/*! Print a TimeEvent to QDebug. */ QDebug operator<<(QDebug dbg, const TimeEventItem &timeEventItem) { dbg.nospace() << "TimeEventItem (Time:" << timeEventItem.time() << ", DateTime:" << timeEventItem.dateTime().toString() << ", " << timeEventItem.repeatingOption() << ")" << endl; diff --git a/libnymea/types/eventdescriptor.cpp b/libnymea/types/eventdescriptor.cpp index 31fa4347..690f69b1 100644 --- a/libnymea/types/eventdescriptor.cpp +++ b/libnymea/types/eventdescriptor.cpp @@ -143,7 +143,7 @@ bool EventDescriptor::operator ==(const EventDescriptor &other) const && paramsMatch; } -/*! Writes the eventTypeId and the deviceId of the given \a eventDescriptor to \a dbg. */ +/*! Print an EventDescriptor including ParamDescriptors to QDebug. */ QDebug operator<<(QDebug dbg, const EventDescriptor &eventDescriptor) { dbg.nospace() << "EventDescriptor(EventTypeId: " << eventDescriptor.eventTypeId().toString() << ", DeviceId:" << eventDescriptor.deviceId().toString() << ", Interface:" << eventDescriptor.interface() << ", InterfaceEvent:" << eventDescriptor.interfaceEvent() << ")" << endl; diff --git a/libnymea/types/paramdescriptor.cpp b/libnymea/types/paramdescriptor.cpp index 0855cc40..c394b101 100644 --- a/libnymea/types/paramdescriptor.cpp +++ b/libnymea/types/paramdescriptor.cpp @@ -74,7 +74,7 @@ void ParamDescriptor::setOperatorType(Types::ValueOperator operatorType) m_operatorType = operatorType; } - +/*! Print a ParamDescriptor to QDebug. */ QDebug operator<<(QDebug dbg, const ParamDescriptor ¶mDescriptor) { dbg.nospace() << "ParamDescriptor(ParamTypeId: " << paramDescriptor.paramTypeId().toString() << ", Name:" << paramDescriptor.paramName() << ", Value:" << paramDescriptor.value() << ")" << endl; diff --git a/libnymea/types/ruleaction.cpp b/libnymea/types/ruleaction.cpp index d5aba1a8..17feaffd 100644 --- a/libnymea/types/ruleaction.cpp +++ b/libnymea/types/ruleaction.cpp @@ -191,6 +191,7 @@ void RuleAction::operator=(const RuleAction &other) m_ruleActionParams = other.ruleActionParams(); } +/*! Print a RuleAction including RuleActionParams to QDebug. */ QDebug operator<<(QDebug dbg, const RuleAction &ruleAction) { dbg.nospace() << "RuleAction(ActionTypeId:" << ruleAction.actionTypeId().toString() << ", DeviceId:" << ruleAction.deviceId().toString() << ", Interface:" << ruleAction.interface() << ", InterfaceAction:" << ruleAction.interfaceAction() << ")" << endl; @@ -200,6 +201,7 @@ QDebug operator<<(QDebug dbg, const RuleAction &ruleAction) return dbg; } +/*! Print a List of RuleActions with all their contents to QDebug. */ QDebug operator<<(QDebug dbg, const QList &ruleActionList) { dbg.nospace() << "RuleActionList (count:" << ruleActionList.count() << "):" << endl; diff --git a/libnymea/types/statedescriptor.cpp b/libnymea/types/statedescriptor.cpp index 563a4329..2c7cdb30 100644 --- a/libnymea/types/statedescriptor.cpp +++ b/libnymea/types/statedescriptor.cpp @@ -34,8 +34,15 @@ a pair of strings describing the interface and interface action for a \l{State}. \sa State, nymeaserver::Rule + */ +/*! \enum StateDescriptor::Type + \value TypeDevice + Describes a state by deviceId and stateTypeId + \value TypeInterface + Describes a state by interface name and interfaceState name +*/ #include "statedescriptor.h" @@ -162,6 +169,7 @@ bool StateDescriptor::isValid() const return ((!m_deviceId.isNull() && !m_stateTypeId.isNull()) || (!m_interface.isNull() && !m_interfaceState.isNull())) && m_stateValue.isValid(); } +/*! Print a StateDescriptor with all its contents to QDebug. */ QDebug operator<<(QDebug dbg, const StateDescriptor &stateDescriptor) { dbg.nospace() << "StateDescriptor(DeviceId:" << stateDescriptor.deviceId().toString() << ", StateTypeId:"