]> git.stg.codes - stg.git/blobdiff - include/stg/service_conf.h
Stargazer (#6)
[stg.git] / include / stg / service_conf.h
index 6be8e70b860502253df2ad5e067cc2975d79bf92..d5661c09d7d182f230e598ecb7ba110f72f37f3a 100644 (file)
 
 #pragma once
 
-#include "stg/optional.h"
+#include "splice.h"
 
 #include <string>
+#include <optional>
 #include <cstdint>
 
 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<std::string> name;
-    Optional<std::string> comment;
-    Optional<double>      cost;
-    Optional<uint8_t>     payDay;
+    std::optional<std::string> name;
+    std::optional<std::string> comment;
+    std::optional<double>      cost;
+    std::optional<uint8_t>     payDay;
 };
 
 }