SqpRange.h
43 lines
| 1.0 KiB
| text/x-c
|
CLexer
r511 | #ifndef SCIQLOP_SQPRANGE_H | |||
#define SCIQLOP_SQPRANGE_H | ||||
r191 | ||||
r234 | #include <QObject> | |||
r296 | ||||
#include <QDebug> | ||||
Alexandre Leroux
|
r488 | #include <Common/DateUtils.h> | ||
Alexandre Leroux
|
r308 | #include <Common/MetaTypes.h> | ||
r191 | /** | |||
r511 | * @brief The SqpRange struct holds the information of time parameters | |||
r191 | */ | |||
r511 | struct SqpRange { | |||
Alexandre Leroux
|
r491 | /// Start time (UTC) | ||
r191 | double m_TStart; | |||
Alexandre Leroux
|
r491 | /// End time (UTC) | ||
r191 | double m_TEnd; | |||
r228 | ||||
r511 | bool contains(const SqpRange &dateTime) const noexcept | |||
r228 | { | |||
return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); | ||||
} | ||||
r258 | ||||
r511 | bool intersect(const SqpRange &dateTime) const noexcept | |||
r258 | { | |||
return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); | ||||
} | ||||
r191 | }; | |||
r511 | inline QDebug operator<<(QDebug d, SqpRange obj) | |||
r296 | { | |||
Alexandre Leroux
|
r488 | auto tendDateTimeStart = DateUtils::dateTime(obj.m_TStart); | ||
auto tendDateTimeEnd = DateUtils::dateTime(obj.m_TEnd); | ||||
r296 | ||||
d << "ts: " << tendDateTimeStart << " te: " << tendDateTimeEnd; | ||||
return d; | ||||
} | ||||
r234 | // Required for using shared_ptr in signals/slots | |||
r511 | SCIQLOP_REGISTER_META_TYPE(SQPRANGE_REGISTRY, SqpRange) | |||
r234 | ||||
r511 | #endif // SCIQLOP_SQPRANGE_H | |||