CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
Loading...
Searching...
No Matches
common.hpp File Reference
#include <algorithm>
#include <chrono>
#include <vector>
#include <ranges>
#include <cstdint>
#include <concepts>
#include <optional>
#include <functional>
#include <type_traits>
#include "ymd.hpp"

Classes

struct  calendar::lunar::common::LunarYear
 Information of the lunar year. 阴历年信息。 More...
struct  calendar::lunar::common::TraditionalMonth
 A lunar month in traditional numbering: month number (1-12) plus a leap flag. 传统编号的阴历月:月份 (1-12) 加闰月标记。 More...
struct  calendar::lunar::common::AlgoBounds
 The bounds of the algorithm. More...

Namespaces

namespace  calendar
namespace  calendar::lunar
namespace  calendar::lunar::common

Typedefs

using calendar::lunar::common::year_month_day

Enumerations

enum class  calendar::lunar::common::Algo : uint8_t { calendar::lunar::common::ALGO_1 , calendar::lunar::common::ALGO_2 , calendar::lunar::common::ALGO_3 }
 Algorithm version. More...

Functions

auto calendar::lunar::common::parse_lunar_year (int32_t year, uint32_t encoded) -> LunarYear
 Parse the encoded lunar year information for the given year. 返回给定年份的阴历年信息。
auto calendar::lunar::common::month_position (const LunarYear &info, const uint8_t month, const bool is_leap) -> std::optional< uint8_t >
 Translate a traditionally-numbered lunar month to its 1-based position in info.month_lengths. 把传统编号的阴历月翻译成 info.month_lengths 里的位置序号(从 1 起)。
auto calendar::lunar::common::month_at_position (const LunarYear &info, const uint8_t position) -> std::optional< TraditionalMonth >
 Translate a 1-based position in info.month_lengths back to traditional numbering. 把 info.month_lengths 里的位置序号(从 1 起)翻译回传统编号。
template<typename Func>
requires std::invocable<const Func&, int32_t> and std::convertible_to<std::invoke_result_t<const Func&, int32_t>, LunarYear>
auto calendar::lunar::common::calc_bounds (const int32_t start_lunar_year, const int32_t end_lunar_year, const Func &algo_f) -> AlgoBounds
 Calculate the bounds of the lunar algorithm.