X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8c6fa3fbaccc22127280bf77a48fab5a3ee0716e..83ce40b2a471b560ec7516efebcb5ddcf7519071:/include/stg/corp_conf.h?ds=sidebyside diff --git a/include/stg/corp_conf.h b/include/stg/corp_conf.h index 5f941b95..6b1cbb83 100644 --- a/include/stg/corp_conf.h +++ b/include/stg/corp_conf.h @@ -18,52 +18,36 @@ * Author : Maxim Mamontov */ -#ifndef CORP_CONF_H -#define CORP_CONF_H +#pragma once -#include "resetable.h" +#include "stg/optional.h" #include -struct CORP_CONF +namespace STG { -CORP_CONF() : name(), cash(0) {} -explicit CORP_CONF(const std::string & n) : name(n), cash(0) {} -CORP_CONF(const std::string & n, double c) : name(n), cash(c) {} -std::string name; -double cash; -}; - -struct CORP_CONF_RES +struct CorpConf { -CORP_CONF_RES() - : name(), cash() -{} + CorpConf() noexcept : cash(0) {} + explicit CorpConf(const std::string & n) noexcept : name(n), cash(0) {} + CorpConf(const std::string & n, double c) noexcept : name(n), cash(c) {} -CORP_CONF_RES & operator=(const CORP_CONF & conf) -{ -name = conf.name; -cash = conf.cash; -return *this; -} + CorpConf(const CorpConf&) = default; + CorpConf& operator=(const CorpConf&) = default; + CorpConf(CorpConf&&) = default; + CorpConf& operator=(CorpConf&&) = default; -CORP_CONF GetData() const -{ -CORP_CONF cc; -cc.name = name.data(); -cc.cash = cash.data(); -return cc; -} + bool operator==(const CorpConf& rhs) const noexcept { return name == rhs.name; } -RESETABLE name; -RESETABLE cash; + std::string name; + double cash; }; -inline -bool operator==(const CORP_CONF & a, const CORP_CONF & b) +struct CorpConfOpt { -return a.name == b.name; -} + Optional name; + Optional cash; +}; -#endif //CORP_CONF_H +}