From 1e09caaa2980fe901453b4b90985967a51157887 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 19 Apr 2021 14:00:47 -0700 Subject: Split workflow into multiple files, fix unity build --- core/src/Model/EvaluatedValue.cpp | 84 --------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 core/src/Model/EvaluatedValue.cpp (limited to 'core/src/Model/EvaluatedValue.cpp') diff --git a/core/src/Model/EvaluatedValue.cpp b/core/src/Model/EvaluatedValue.cpp deleted file mode 100644 index 685d50f..0000000 --- a/core/src/Model/EvaluatedValue.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "EvaluatedValue.hpp" - -#include - -BaseValue::BaseValue(Kind kind) - : mKind{ kind } { -} - -BaseValue::Kind BaseValue::GetKind() const { - return mKind; -} - -bool NumericValue::IsInstance(const BaseValue* value) { - return value->GetKind() == KD_Numeric; -} - -NumericValue::NumericValue() - : BaseValue(BaseValue::KD_Numeric) { -} - -std::string NumericValue::GetString() const { - char buf[64]; - auto res = std::to_chars(buf, buf + std::size(buf), mValue); - if (res.ec == std::errc()) { - return std::string(buf, res.ptr); - } else { - // TODO larger buffer - return ""; - } -} - -int64_t NumericValue::GetInt() const { - return static_cast(mValue); -} - -double NumericValue::GetValue() const { - return mValue; -} - -void NumericValue::SetValue(double value) { - mValue = value; -} - -bool TextValue::IsInstance(const BaseValue* value) { - return value->GetKind() == KD_Text; -} - -TextValue::TextValue() - : BaseValue(BaseValue::KD_Text) { -} - -const std::string& TextValue::GetValue() const { - return mValue; -} - -void TextValue::SetValue(const std::string& value) { - mValue = value; -} - -bool DateTimeValue::IsInstance(const BaseValue* value) { - return value->GetKind() == KD_DateTime; -} - -DateTimeValue::DateTimeValue() - : BaseValue(BaseValue::KD_DateTime) { -} - -std::string DateTimeValue::GetString() const { - namespace chrono = std::chrono; - auto t = chrono::system_clock::to_time_t(mValue); - - char data[32]; - std::strftime(data, sizeof(data), "%Y-%m-%d %H:%M:%S", std::localtime(&t)); - - return std::string(data); -} - -const std::chrono::time_point& DateTimeValue::GetValue() const { - return mValue; -} - -void DateTimeValue::SetValue(const std::chrono::time_point& value) { - mValue = value; -} -- cgit v1.2.3-70-g09d2