git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stargazer (#6)
[stg.git]
/
include
/
stg
/
corp_conf.h
diff --git
a/include/stg/corp_conf.h
b/include/stg/corp_conf.h
index 9bbc03d326941e2edce782663cbec4e3cbd15163..8ff4094f6a40aaabd3089295164c86b40d66df2d 100644
(file)
--- a/
include/stg/corp_conf.h
+++ b/
include/stg/corp_conf.h
@@
-18,52
+18,35
@@
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-#ifndef CORP_CONF_H
-#define CORP_CONF_H
-
-#include "resetable.h"
+#pragma once
#include <string>
#include <string>
+#include <optional>
-struct CORP_CONF
+namespace STG
{
{
-CORP_CONF() : name(), cash(0) {}
-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 C
ORP_CONF_RES
+struct C
orpConf
{
{
-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<std::string>
name;
-
RESETABLE<double>
cash;
+
std::string
name;
+
double
cash;
};
};
-inline
-bool operator==(const CORP_CONF & a, const CORP_CONF & b)
+struct CorpConfOpt
{
{
-return a.name == b.name;
-}
+ std::optional<std::string> name;
+ std::optional<double> cash;
+};
-#endif //CORP_CONF_H
+}