diff options
author | Hop311 <hop3114@gmail.com> | 2023-09-28 22:03:14 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-09-28 22:03:14 +0200 |
commit | 84b5ee7a7749e2dbfeb214b4cedd16d5522f4197 (patch) | |
tree | cd810aceed54196aa62aa766f79039cd57a1e600 /src/openvic-simulation/politics | |
parent | 5764126f4a3940320990a9bc3007ba22e89a514c (diff) |
Removed unnecessary `const std::string_view`s
Diffstat (limited to 'src/openvic-simulation/politics')
-rw-r--r-- | src/openvic-simulation/politics/Ideology.cpp | 8 | ||||
-rw-r--r-- | src/openvic-simulation/politics/Ideology.hpp | 8 | ||||
-rw-r--r-- | src/openvic-simulation/politics/Issue.cpp | 28 | ||||
-rw-r--r-- | src/openvic-simulation/politics/Issue.hpp | 28 |
4 files changed, 36 insertions, 36 deletions
diff --git a/src/openvic-simulation/politics/Ideology.cpp b/src/openvic-simulation/politics/Ideology.cpp index 7c15c3c..5b2c0ef 100644 --- a/src/openvic-simulation/politics/Ideology.cpp +++ b/src/openvic-simulation/politics/Ideology.cpp @@ -3,9 +3,9 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -IdeologyGroup::IdeologyGroup(const std::string_view new_identifier) : HasIdentifier { new_identifier } {} +IdeologyGroup::IdeologyGroup(std::string_view new_identifier) : HasIdentifier { new_identifier } {} -Ideology::Ideology(const std::string_view new_identifier, colour_t new_colour, IdeologyGroup const& new_group, bool new_uncivilised, bool new_can_reduce_militancy, Date new_spawn_date) +Ideology::Ideology(std::string_view new_identifier, colour_t new_colour, IdeologyGroup const& new_group, bool new_uncivilised, bool new_can_reduce_militancy, Date new_spawn_date) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, group { new_group }, uncivilised { new_uncivilised }, can_reduce_militancy { new_can_reduce_militancy }, spawn_date { new_spawn_date } {} @@ -27,7 +27,7 @@ Date const& Ideology::get_spawn_date() const { IdeologyManager::IdeologyManager() : ideology_groups { "ideology groups" }, ideologies { "ideologies" } {} -bool IdeologyManager::add_ideology_group(const std::string_view identifier) { +bool IdeologyManager::add_ideology_group(std::string_view identifier) { if (identifier.empty()) { Logger::error("Invalid ideology group identifier - empty!"); return false; @@ -36,7 +36,7 @@ bool IdeologyManager::add_ideology_group(const std::string_view identifier) { return ideology_groups.add_item({ identifier }); } -bool IdeologyManager::add_ideology(const std::string_view identifier, colour_t colour, IdeologyGroup const* group, bool uncivilised, bool can_reduce_militancy, Date spawn_date) { +bool IdeologyManager::add_ideology(std::string_view identifier, colour_t colour, IdeologyGroup const* group, bool uncivilised, bool can_reduce_militancy, Date spawn_date) { if (identifier.empty()) { Logger::error("Invalid ideology identifier - empty!"); return false; diff --git a/src/openvic-simulation/politics/Ideology.hpp b/src/openvic-simulation/politics/Ideology.hpp index e9989c8..ab761b1 100644 --- a/src/openvic-simulation/politics/Ideology.hpp +++ b/src/openvic-simulation/politics/Ideology.hpp @@ -9,7 +9,7 @@ namespace OpenVic { friend struct IdeologyManager; private: - IdeologyGroup(const std::string_view new_identifier); + IdeologyGroup(std::string_view new_identifier); public: IdeologyGroup(IdeologyGroup&&) = default; @@ -25,7 +25,7 @@ namespace OpenVic { //TODO - willingness to repeal/pass reforms (and its modifiers) - Ideology(const std::string_view new_identifier, colour_t new_colour, IdeologyGroup const& new_group, bool new_uncivilised, bool new_can_reduce_militancy, Date new_spawn_date); + Ideology(std::string_view new_identifier, colour_t new_colour, IdeologyGroup const& new_group, bool new_uncivilised, bool new_can_reduce_militancy, Date new_spawn_date); public: Ideology(Ideology&&) = default; @@ -44,10 +44,10 @@ namespace OpenVic { public: IdeologyManager(); - bool add_ideology_group(const std::string_view identifier); + bool add_ideology_group(std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(IdeologyGroup, ideology_group) - bool add_ideology(const std::string_view identifier, colour_t colour, IdeologyGroup const* group, bool uncivilised, bool can_reduce_militancy, Date spawn_date); + bool add_ideology(std::string_view identifier, colour_t colour, IdeologyGroup const* group, bool uncivilised, bool can_reduce_militancy, Date spawn_date); IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(Ideology, ideology, ideologies) bool load_ideology_file(ast::NodeCPtr root); diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp index 67b3783..73978ee 100644 --- a/src/openvic-simulation/politics/Issue.cpp +++ b/src/openvic-simulation/politics/Issue.cpp @@ -3,19 +3,19 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -IssueGroup::IssueGroup(const std::string_view new_identifier) : HasIdentifier { new_identifier } {} +IssueGroup::IssueGroup(std::string_view new_identifier) : HasIdentifier { new_identifier } {} -Issue::Issue(const std::string_view identifier, IssueGroup const& group) +Issue::Issue(std::string_view identifier, IssueGroup const& group) : HasIdentifier { identifier }, group { group } {} IssueGroup const& Issue::get_group() const { return group; } -ReformType::ReformType(const std::string_view new_identifier, bool uncivilised) +ReformType::ReformType(std::string_view new_identifier, bool uncivilised) : HasIdentifier { new_identifier }, uncivilised { uncivilised } {} -ReformGroup::ReformGroup(const std::string_view identifier, ReformType const& type, bool ordered, bool administrative) +ReformGroup::ReformGroup(std::string_view identifier, ReformType const& type, bool ordered, bool administrative) : IssueGroup { identifier }, type { type }, ordered { ordered }, administrative { administrative } {} ReformType const& ReformGroup::get_type() const { @@ -30,7 +30,7 @@ bool ReformGroup::is_administrative() const { return administrative; } -Reform::Reform(const std::string_view identifier, ReformGroup const& group, size_t ordinal) +Reform::Reform(std::string_view identifier, ReformGroup const& group, size_t ordinal) : Issue { identifier, group }, ordinal { ordinal }, reform_group { group } {} ReformGroup const& Reform::get_reform_group() const { @@ -48,7 +48,7 @@ size_t Reform::get_ordinal() const { IssueManager::IssueManager() : issue_groups { "issue groups" }, issues { "issues" }, reform_types { "reform types" }, reform_groups { "reform groups" }, reforms { "reforms" } {} -bool IssueManager::add_issue_group(const std::string_view identifier) { +bool IssueManager::add_issue_group(std::string_view identifier) { if (identifier.empty()) { Logger::error("Invalid issue group identifier - empty!"); return false; @@ -57,7 +57,7 @@ bool IssueManager::add_issue_group(const std::string_view identifier) { return issue_groups.add_item({ identifier }); } -bool IssueManager::add_issue(const std::string_view identifier, IssueGroup const* group) { +bool IssueManager::add_issue(std::string_view identifier, IssueGroup const* group) { if (identifier.empty()) { Logger::error("Invalid issue identifier - empty!"); return false; @@ -71,7 +71,7 @@ bool IssueManager::add_issue(const std::string_view identifier, IssueGroup const return issues.add_item({ identifier, *group }); } -bool IssueManager::add_reform_type(const std::string_view identifier, bool uncivilised) { +bool IssueManager::add_reform_type(std::string_view identifier, bool uncivilised) { if (identifier.empty()) { Logger::error("Invalid issue type identifier - empty!"); return false; @@ -80,7 +80,7 @@ bool IssueManager::add_reform_type(const std::string_view identifier, bool unciv return reform_types.add_item({ identifier, uncivilised }); } -bool IssueManager::add_reform_group(const std::string_view identifier, ReformType const* type, bool ordered, bool administrative) { +bool IssueManager::add_reform_group(std::string_view identifier, ReformType const* type, bool ordered, bool administrative) { if (identifier.empty()) { Logger::error("Invalid issue group identifier - empty!"); return false; @@ -94,7 +94,7 @@ bool IssueManager::add_reform_group(const std::string_view identifier, ReformTyp return reform_groups.add_item({ identifier, *type, ordered, administrative }); } -bool IssueManager::add_reform(const std::string_view identifier, ReformGroup const* group, size_t ordinal) { +bool IssueManager::add_reform(std::string_view identifier, ReformGroup const* group, size_t ordinal) { if (identifier.empty()) { Logger::error("Invalid issue identifier - empty!"); return false; @@ -108,19 +108,19 @@ bool IssueManager::add_reform(const std::string_view identifier, ReformGroup con return reforms.add_item({ identifier, *group, ordinal }); } -bool IssueManager::_load_issue_group(size_t& expected_issues, const std::string_view identifier, ast::NodeCPtr node) { +bool IssueManager::_load_issue_group(size_t& expected_issues, std::string_view identifier, ast::NodeCPtr node) { return expect_length([&expected_issues](size_t size) -> size_t { expected_issues += size; return size; })(node) & add_issue_group(identifier); } -bool IssueManager::_load_issue(const std::string_view identifier, IssueGroup const* group, ast::NodeCPtr node) { +bool IssueManager::_load_issue(std::string_view identifier, IssueGroup const* group, ast::NodeCPtr node) { //TODO: policy modifiers, policy rule changes return add_issue(identifier, group); } -bool IssueManager::_load_reform_group(size_t& expected_reforms, const std::string_view identifier, ReformType const* type, ast::NodeCPtr node) { +bool IssueManager::_load_reform_group(size_t& expected_reforms, std::string_view identifier, ReformType const* type, ast::NodeCPtr node) { bool ordered = false, administrative = false; bool ret = expect_dictionary_keys_and_length( [&expected_reforms](size_t size) -> size_t { @@ -134,7 +134,7 @@ bool IssueManager::_load_reform_group(size_t& expected_reforms, const std::strin return ret; } -bool IssueManager::_load_reform(size_t& ordinal, const std::string_view identifier, ReformGroup const* group, ast::NodeCPtr node) { +bool IssueManager::_load_reform(size_t& ordinal, std::string_view identifier, ReformGroup const* group, ast::NodeCPtr node) { //TODO: conditions to allow, policy modifiers, policy rule changes return add_reform(identifier, group, ordinal); } diff --git a/src/openvic-simulation/politics/Issue.hpp b/src/openvic-simulation/politics/Issue.hpp index 66e8d1a..ddd6295 100644 --- a/src/openvic-simulation/politics/Issue.hpp +++ b/src/openvic-simulation/politics/Issue.hpp @@ -14,7 +14,7 @@ namespace OpenVic { friend struct IssueManager; protected: - IssueGroup(const std::string_view identifier); + IssueGroup(std::string_view identifier); public: IssueGroup(IssueGroup&&) = default; @@ -30,7 +30,7 @@ namespace OpenVic { //TODO: policy modifiers, policy rule changes protected: - Issue(const std::string_view identifier, IssueGroup const& group); + Issue(std::string_view identifier, IssueGroup const& group); public: Issue(Issue&&) = default; @@ -45,7 +45,7 @@ namespace OpenVic { bool uncivilised; //whether this group is available to non-westernised countries //in vanilla education, military and economic reforms are hardcoded to true and the rest to false - ReformType(const std::string_view new_identifier, bool uncivilised); + ReformType(std::string_view new_identifier, bool uncivilised); public: ReformType(ReformType&&) = default; @@ -60,7 +60,7 @@ namespace OpenVic { const bool ordered; //next_step_only const bool administrative; - ReformGroup(const std::string_view identifier, ReformType const& type, bool ordered, bool administrative); + ReformGroup(std::string_view identifier, ReformType const& type, bool ordered, bool administrative); public: ReformGroup(ReformGroup&&) = default; @@ -77,7 +77,7 @@ namespace OpenVic { ReformGroup const& reform_group; //stores an already casted reference const size_t ordinal; //assigned by the parser to allow policy sorting - Reform(const std::string_view new_identifier, ReformGroup const& group, size_t ordinal); + Reform(std::string_view new_identifier, ReformGroup const& group, size_t ordinal); //TODO: conditions to allow, @@ -97,28 +97,28 @@ namespace OpenVic { IdentifierRegistry<ReformGroup> reform_groups; IdentifierRegistry<Reform> reforms; - bool _load_issue_group(size_t& expected_issues, const std::string_view identifier, ast::NodeCPtr node); - bool _load_issue(const std::string_view identifier, IssueGroup const* group, ast::NodeCPtr node); - bool _load_reform_group(size_t& expected_reforms, const std::string_view identifier, ReformType const* type, + bool _load_issue_group(size_t& expected_issues, std::string_view identifier, ast::NodeCPtr node); + bool _load_issue(std::string_view identifier, IssueGroup const* group, ast::NodeCPtr node); + bool _load_reform_group(size_t& expected_reforms, std::string_view identifier, ReformType const* type, ast::NodeCPtr node); - bool _load_reform(size_t& ordinal, const std::string_view identifier, ReformGroup const* group, ast::NodeCPtr node); + bool _load_reform(size_t& ordinal, std::string_view identifier, ReformGroup const* group, ast::NodeCPtr node); public: IssueManager(); - bool add_issue_group(const std::string_view identifier); + bool add_issue_group(std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(IssueGroup, issue_group) - bool add_issue(const std::string_view identifier, IssueGroup const* group); + bool add_issue(std::string_view identifier, IssueGroup const* group); IDENTIFIER_REGISTRY_ACCESSORS(Issue, issue) - bool add_reform_type(const std::string_view identifier, bool uncivilised); + bool add_reform_type(std::string_view identifier, bool uncivilised); IDENTIFIER_REGISTRY_ACCESSORS(ReformType, reform_type) - bool add_reform_group(const std::string_view identifier, ReformType const* type, bool ordered, bool administrative); + bool add_reform_group(std::string_view identifier, ReformType const* type, bool ordered, bool administrative); IDENTIFIER_REGISTRY_ACCESSORS(ReformGroup, reform_group) - bool add_reform(const std::string_view identifier, ReformGroup const* group, size_t ordinal); + bool add_reform(std::string_view identifier, ReformGroup const* group, size_t ordinal); IDENTIFIER_REGISTRY_ACCESSORS(Reform, reform) bool load_issues_file(ast::NodeCPtr root); |