X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/c02633d77cb05a5deb05440d77b12ccc5bc19b85..a91e9542b384905187890f161d4da5396996fcfd:/include/stg/service_conf.h 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; }; }