X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e9ae1f101b5418c0ba2e6c9d86b23c12f0140982..719325d30f713accc04c83c6951ff2a6bfcf33e0:/include/stg/service_conf.h?ds=inline diff --git a/include/stg/service_conf.h b/include/stg/service_conf.h index 6be8e70b..d5661c09 100644 --- a/include/stg/service_conf.h +++ b/include/stg/service_conf.h @@ -20,9 +20,10 @@ #pragma once -#include "stg/optional.h" +#include "splice.h" #include +#include #include namespace STG @@ -85,26 +86,26 @@ struct ServiceConfOpt void splice(const ServiceConfOpt& rhs) { - name.splice(rhs.name); - comment.splice(rhs.comment); - cost.splice(rhs.cost); - payDay.splice(rhs.payDay); + STG::splice(name, rhs.name); + STG::splice(comment, rhs.comment); + STG::splice(cost, rhs.cost); + STG::splice(payDay, rhs.payDay); } ServiceConf get(const ServiceConf& defaultValue) const noexcept { ServiceConf res; - res.name = name.get(defaultValue.name); - res.comment = comment.get(defaultValue.comment); - res.cost = cost.get(defaultValue.cost); - res.payDay = payDay.get(defaultValue.payDay); + res.name = name.value_or(defaultValue.name); + res.comment = comment.value_or(defaultValue.comment); + res.cost = cost.value_or(defaultValue.cost); + res.payDay = payDay.value_or(defaultValue.payDay); return res; } - Optional name; - Optional comment; - Optional cost; - Optional payDay; + std::optional name; + std::optional comment; + std::optional cost; + std::optional payDay; }; }