+struct ServiceConfOpt
+{
+ ServiceConfOpt() = default;
+
+ explicit ServiceConfOpt(const ServiceConf& rhs)
+ : name(rhs.name), comment(rhs.comment),
+ cost(rhs.cost), payDay(rhs.payDay)
+ {}
+
+ ServiceConfOpt(const ServiceConfOpt&) = default;
+ ServiceConfOpt& operator=(const ServiceConfOpt&) = default;
+ ServiceConfOpt(ServiceConfOpt&&) = default;
+ ServiceConfOpt& operator=(ServiceConfOpt&&) = default;
+
+ ServiceConfOpt& operator=(const ServiceConf& conf)
+ {
+ name = conf.name;
+ comment = conf.comment;
+ cost = conf.cost;
+ payDay = conf.payDay;
+ return *this;
+ }
+
+ void splice(const ServiceConfOpt& rhs)
+ {
+ 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.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;
+ }
+
+ std::optional<std::string> name;
+ std::optional<std::string> comment;
+ std::optional<double> cost;
+ std::optional<uint8_t> payDay;
+};