48 if (
this == &other)
return *
this;
50 count_ = other.count_;
51 literal_ = std::move(other.literal_);
52 valid_ = other.valid_;
55 other.literal_.clear();
59 bool valid() const noexcept {
return valid_ && count_ >= 1 && unit_ok(unit_); }
61 int count() const noexcept {
return count_; }
62 const std::string&
literal() const noexcept {
return literal_; }
91 return a.valid() == b.valid() && a.unit_ == b.unit_ && a.count_ == b.count_
92 && a.literal_ == b.literal_;
175 std::string_view timezone);
234 if (start_minutes_ < 0 || start_minutes_ >= 1440)
return false;
235 if (end_minutes_ < 0 || end_minutes_ > 1440)
return false;
236 const bool expect_full = (end_minutes_ != 1440 && start_minutes_ == end_minutes_);
237 const bool expect_wrap = (!expect_full && end_minutes_ < start_minutes_);
238 return full_day_ == expect_full && wraps_ == expect_wrap;
242 bool wraps() const noexcept {
return wraps_; }
243 bool full_day() const noexcept {
return full_day_; }
246 friend std::optional<SessionCalendar>
parse_session(std::string_view, std::string_view);
248 : start_minutes_(start), end_minutes_(end), wraps_(
wraps), full_day_(
full_day) {}
249 int start_minutes_ = 0;
250 int end_minutes_ = 0;
252 bool full_day_ =
false;
266 if (
this == &other)
return *
this;
267 timezone_ = std::move(other.timezone_);
268 literal_ = std::move(other.literal_);
269 windows_ = std::move(other.windows_);
270 day_mask_ = other.day_mask_;
271 origin_minutes_ = other.origin_minutes_;
272 all_day_ = other.all_day_;
273 valid_ = other.valid_;
274 other.valid_ =
false;
276 other.origin_minutes_ = 0;
277 other.all_day_ =
false;
278 other.timezone_.clear();
279 other.literal_.clear();
280 other.windows_.clear();
285 const
std::
string&
timezone() const noexcept {
return timezone_; }
286 const std::string&
literal() const noexcept {
return literal_; }
287 const std::vector<SessionWindow>&
windows() const noexcept {
return windows_; }
288 std::uint8_t
day_mask() const noexcept {
return day_mask_; }
290 bool all_day() const noexcept {
return all_day_; }
293 friend std::optional<SessionCalendar>
parse_session(std::string_view, std::string_view);
296 std::vector<SessionWindow>
windows,
307 std::string timezone_;
308 std::string literal_;
309 std::vector<SessionWindow> windows_;
310 std::uint8_t day_mask_ = 0;
311 int origin_minutes_ = 0;
312 bool all_day_ =
false;
316std::optional<SessionCalendar>
parse_session(std::string_view session,
317 std::string_view timezone);
SessionCalendar & operator=(const SessionCalendar &)=default
SessionCalendar()=default
SessionCalendar(const SessionCalendar &)=default
SessionCalendar & operator=(SessionCalendar &&other) noexcept
const std::string & timezone() const noexcept
friend std::optional< SessionCalendar > parse_session(std::string_view, std::string_view)
const std::string & literal() const noexcept
SessionCalendar(SessionCalendar &&other) noexcept
int origin_minutes() const noexcept
bool all_day() const noexcept
std::uint8_t day_mask() const noexcept
const std::vector< SessionWindow > & windows() const noexcept
bool valid() const noexcept
bool valid() const noexcept
int end_minutes() const noexcept
friend std::optional< SessionCalendar > parse_session(std::string_view, std::string_view)
int start_minutes() const noexcept
bool wraps() const noexcept
bool full_day() const noexcept
TimeframeUnit unit() const noexcept
bool is_fixed() const noexcept
Timeframe & operator=(const Timeframe &)=default
friend bool operator==(const Timeframe &, const Timeframe &) noexcept
friend std::optional< Timeframe > parse_timeframe(std::string_view)
Timeframe(const Timeframe &)=default
bool is_calendar() const noexcept
Timeframe(Timeframe &&other) noexcept
int count() const noexcept
Timeframe & operator=(Timeframe &&other) noexcept
bool valid() const noexcept
const std::string & literal() const noexcept
bool operator==(const Timeframe &a, const Timeframe &b) noexcept
std::optional< TimezoneIdentityDescriptor > timezone_identity_descriptor(std::string_view timezone)
std::optional< Timeframe > parse_timeframe(std::string_view text)
@ StreamMonthlyInputRefused
std::optional< int64_t > session_week_ordinal(const SessionCalendar &calendar, int64_t ms)
std::optional< CivilResolution > resolve_civil(std::string_view timezone, int year, int month, int day, int hour, int minute, int second=0)
bool in_session(const SessionCalendar &calendar, int64_t ms)
std::optional< int64_t > session_day_ordinal(const SessionCalendar &calendar, int64_t ms)
bool timezone_accepted(std::string_view timezone)
std::optional< int64_t > session_month_ordinal(const SessionCalendar &calendar, int64_t ms)
TimeframeCompatibility stream_compatibility(const Timeframe &input, const Timeframe &script)
std::optional< int64_t > period_key(const SessionCalendar &calendar, const Timeframe &tf, int64_t ms)
std::optional< NativeInterval > interval_containing(const SessionCalendar &calendar, const Timeframe &tf, int64_t ms)
std::optional< SessionCalendar > parse_session(std::string_view session, std::string_view timezone)
TimeframeCompatibility compatibility(const Timeframe &input, const Timeframe &script)
int64_t next_period_open_ms
int64_t next_input_open_ms
int64_t last_traded_close_ms
std::string effective_definition
std::uint32_t semantics_version
static constexpr std::uint32_t kSemanticsVersion
std::vector< std::string > resource_paths
std::string zoneinfo_root
bool valid() const noexcept