diff options
Diffstat (limited to 'src/openvic-simulation/types')
-rw-r--r-- | src/openvic-simulation/types/Date.cpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/types/Date.hpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/types/IdentifierRegistry.cpp | 4 | ||||
-rw-r--r-- | src/openvic-simulation/types/IdentifierRegistry.hpp | 14 | ||||
-rw-r--r-- | src/openvic-simulation/types/fixed_point/FixedPoint.hpp | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/openvic-simulation/types/Date.cpp b/src/openvic-simulation/types/Date.cpp index 203d647..27d554c 100644 --- a/src/openvic-simulation/types/Date.cpp +++ b/src/openvic-simulation/types/Date.cpp @@ -257,6 +257,6 @@ Date Date::from_string(char const* str, size_t length, bool* successful) { return from_string(str, str + length, successful); } -Date Date::from_string(const std::string_view str, bool* successful) { +Date Date::from_string(std::string_view str, bool* successful) { return from_string(str.data(), str.length(), successful); } diff --git a/src/openvic-simulation/types/Date.hpp b/src/openvic-simulation/types/Date.hpp index 601f9dc..b2df666 100644 --- a/src/openvic-simulation/types/Date.hpp +++ b/src/openvic-simulation/types/Date.hpp @@ -90,7 +90,7 @@ namespace OpenVic { // Parsed from string of the form YYYY.MM.DD static Date from_string(char const* str, char const* end, bool* successful = nullptr); static Date from_string(char const* str, size_t length, bool* successful = nullptr); - static Date from_string(const std::string_view str, bool* successful = nullptr); + static Date from_string(std::string_view str, bool* successful = nullptr); }; std::ostream& operator<<(std::ostream& out, Date const& date); } diff --git a/src/openvic-simulation/types/IdentifierRegistry.cpp b/src/openvic-simulation/types/IdentifierRegistry.cpp index f284164..d6afd3a 100644 --- a/src/openvic-simulation/types/IdentifierRegistry.cpp +++ b/src/openvic-simulation/types/IdentifierRegistry.cpp @@ -4,7 +4,7 @@ using namespace OpenVic; -HasIdentifier::HasIdentifier(const std::string_view new_identifier) +HasIdentifier::HasIdentifier(std::string_view new_identifier) : identifier { new_identifier } { assert(!identifier.empty()); } @@ -31,7 +31,7 @@ std::string HasColour::colour_to_hex_string() const { return OpenVic::colour_to_hex_string(colour); } -HasIdentifierAndColour::HasIdentifierAndColour(const std::string_view new_identifier, +HasIdentifierAndColour::HasIdentifierAndColour(std::string_view new_identifier, const colour_t new_colour, bool can_be_null, bool can_have_alpha) : HasIdentifier { new_identifier }, HasColour { new_colour, can_be_null, can_have_alpha } {} diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp index 41e4c6b..482e917 100644 --- a/src/openvic-simulation/types/IdentifierRegistry.hpp +++ b/src/openvic-simulation/types/IdentifierRegistry.hpp @@ -16,7 +16,7 @@ namespace OpenVic { const std::string identifier; protected: - HasIdentifier(const std::string_view new_identifier); + HasIdentifier(std::string_view new_identifier); public: HasIdentifier(HasIdentifier const&) = delete; @@ -55,7 +55,7 @@ namespace OpenVic { */ class HasIdentifierAndColour : public HasIdentifier, public HasColour { protected: - HasIdentifierAndColour(const std::string_view new_identifier, const colour_t new_colour, bool can_be_null, bool can_have_alpha); + HasIdentifierAndColour(std::string_view new_identifier, const colour_t new_colour, bool can_be_null, bool can_have_alpha); public: HasIdentifierAndColour(HasIdentifierAndColour const&) = delete; @@ -86,7 +86,7 @@ namespace OpenVic { identifier_index_map_t identifier_index_map; public: - IdentifierRegistry(const std::string_view new_name, bool new_log_lock = true) + IdentifierRegistry(std::string_view new_name, bool new_log_lock = true) : name { new_name }, log_lock { new_log_lock } {} std::string const& get_name() const { @@ -143,13 +143,13 @@ namespace OpenVic { } } - T* get_item_by_identifier(const std::string_view identifier) { + T* get_item_by_identifier(std::string_view identifier) { const identifier_index_map_t::const_iterator it = identifier_index_map.find(identifier); if (it != identifier_index_map.end()) return &items[it->second]; return nullptr; } - T const* get_item_by_identifier(const std::string_view identifier) const { + T const* get_item_by_identifier(std::string_view identifier) const { const identifier_index_map_t::const_iterator it = identifier_index_map.find(identifier); if (it != identifier_index_map.end()) return &items[it->second]; return nullptr; @@ -242,7 +242,7 @@ namespace OpenVic { #define IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(type, singular, plural) \ void lock_##plural() { plural.lock(); } \ bool plural##_are_locked() const { return plural.is_locked(); } \ - type const* get_##singular##_by_identifier(const std::string_view identifier) const { \ + type const* get_##singular##_by_identifier(std::string_view identifier) const { \ return plural.get_item_by_identifier(identifier); } \ size_t get_##singular##_count() const { \ return plural.size(); } \ @@ -258,7 +258,7 @@ namespace OpenVic { return plural.expect_item_decimal_map(callback); } #define IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS_CUSTOM_PLURAL(type, singular, plural) \ - type* get_##singular##_by_identifier(const std::string_view identifier) { \ + type* get_##singular##_by_identifier(std::string_view identifier) { \ return plural.get_item_by_identifier(identifier); } \ NodeTools::node_callback_t expect_##singular##_identifier(NodeTools::callback_t<type&> callback) { \ return plural.expect_item_identifier(callback); } \ diff --git a/src/openvic-simulation/types/fixed_point/FixedPoint.hpp b/src/openvic-simulation/types/fixed_point/FixedPoint.hpp index 22fdeca..459d9c4 100644 --- a/src/openvic-simulation/types/fixed_point/FixedPoint.hpp +++ b/src/openvic-simulation/types/fixed_point/FixedPoint.hpp @@ -329,7 +329,7 @@ namespace OpenVic { return parse(str, str + length, successful); } - static fixed_point_t parse(const std::string_view str, bool* successful = nullptr) { + static fixed_point_t parse(std::string_view str, bool* successful = nullptr) { return parse(str.data(), str.length(), successful); } |