KDarkLightCycle Class

The KDarkLightCycle provides information about the light-dark cycle for a single day. More...

Header: #include <KDarkLightCycle>
CMake: find_package(KNightTime REQUIRED)
target_link_libraries(mytarget PRIVATE KNightTime::KNightTime)

Public Functions

KDarkLightCycle()
KDarkLightCycle(const QDateTime &noonDateTime, const KDarkLightTransition &morning, const KDarkLightTransition &evening)
KDarkLightTransition evening() const
KDarkLightCycle extrapolated(const QDateTime &referenceDateTime) const
KDarkLightTransition morning() const
std::optional<KDarkLightTransition> nextTransition(const QDateTime &dateTime) const
QDateTime noonDateTime() const
std::optional<KDarkLightTransition> previousTransition(const QDateTime &dateTime) const

Detailed Description

Member Function Documentation

KDarkLightCycle::KDarkLightCycle()

Constructs an invalid KDarkLightCycle.

KDarkLightCycle::KDarkLightCycle(const QDateTime &noonDateTime, const KDarkLightTransition &morning, const KDarkLightTransition &evening)

Construcuts an KDarkLightCycle with specified noonDateTime, morning, and evening.

KDarkLightTransition KDarkLightCycle::evening() const

Returns the evening transition.

KDarkLightCycle KDarkLightCycle::extrapolated(const QDateTime &referenceDateTime) const

Computes a new dark-light cycle that includes the specified referenceDateTime based on the data in this cycle.

KDarkLightTransition KDarkLightCycle::morning() const

Returns the morning transition.

std::optional<KDarkLightTransition> KDarkLightCycle::nextTransition(const QDateTime &dateTime) const

Returns the next transition for the specified dateTime. If the given date and time comes after the evening, a std::nullopt value will be returned.

QDateTime KDarkLightCycle::noonDateTime() const

Returns the date and time of the noon.

std::optional<KDarkLightTransition> KDarkLightCycle::previousTransition(const QDateTime &dateTime) const

Returns the previous transition for the specified dateTime. If the given date and time comes before the morning, a std::nullopt value will be returned.