From 112de0ac9c7ce26bd75d06e4cd3bc91adee716e3 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sun, 23 Apr 2023 23:36:42 -0400 Subject: Support features up to clang-format 14 Add .editorconfig Update C++ files within `extension/src` to follow .clang-format --- extension/src/openvic2/Date.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'extension/src/openvic2/Date.hpp') diff --git a/extension/src/openvic2/Date.hpp b/extension/src/openvic2/Date.hpp index b19602b..b7b45a3 100644 --- a/extension/src/openvic2/Date.hpp +++ b/extension/src/openvic2/Date.hpp @@ -1,15 +1,17 @@ #pragma once #include -#include #include +#include namespace OpenVic2 { // A relative period between points in time, measured in days struct Timespan { using day_t = int64_t; + private: day_t days; + public: Timespan(day_t value = 0); @@ -33,7 +35,7 @@ namespace OpenVic2 { explicit operator double() const; explicit operator std::string() const; }; - std::ostream& operator<< (std::ostream& out, Timespan timespan); + std::ostream& operator<<(std::ostream& out, Timespan timespan); // Represents an in-game date // Note: Current implementation does not account for leap-years, or dates before Year 0 @@ -46,11 +48,13 @@ namespace OpenVic2 { static constexpr Timespan::day_t DAYS_IN_YEAR = 365; static constexpr Timespan::day_t DAYS_IN_MONTH[MONTHS_IN_YEAR] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static constexpr Timespan::day_t DAYS_UP_TO_MONTH[MONTHS_IN_YEAR] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; + private: // Number of days since Jan 1st, Year 0 Timespan timespan; static Timespan _dateToTimespan(year_t year, month_t month, day_t day); + public: // The Timespan is considered to be the number of days since Jan 1st, Year 0 Date(Timespan total_days); @@ -79,5 +83,5 @@ namespace OpenVic2 { // Parsed from string of the form YYYY.MM.DD static Date from_string(std::string const& date); }; - std::ostream& operator<< (std::ostream& out, Date date); + std::ostream& operator<<(std::ostream& out, Date date); } -- cgit v1.2.3-56-ga3b1