pull/135/head
Michael Zanetti 2018-06-21 11:42:14 +02:00
parent d269b016db
commit b7262b51e4
10 changed files with 19 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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() << ")";

View File

@ -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() << ")";

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -74,7 +74,7 @@ void ParamDescriptor::setOperatorType(Types::ValueOperator operatorType)
m_operatorType = operatorType;
}
/*! Print a ParamDescriptor to QDebug. */
QDebug operator<<(QDebug dbg, const ParamDescriptor &paramDescriptor)
{
dbg.nospace() << "ParamDescriptor(ParamTypeId: " << paramDescriptor.paramTypeId().toString() << ", Name:" << paramDescriptor.paramName() << ", Value:" << paramDescriptor.value() << ")" << endl;

View File

@ -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<RuleAction> &ruleActionList)
{
dbg.nospace() << "RuleActionList (count:" << ruleActionList.count() << "):" << endl;

View File

@ -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:"