From caa2f31d536f568e485f15537db5e2f79f7616d5 Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 22 Jan 2024 19:17:38 +0000 Subject: Miscellaneous bug fixes and format cleanup --- .../types/IdentifierRegistry.hpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp') diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp index 251632b..68013d5 100644 --- a/src/openvic-simulation/types/IdentifierRegistry.hpp +++ b/src/openvic-simulation/types/IdentifierRegistry.hpp @@ -258,7 +258,7 @@ namespace OpenVic { if (item != nullptr) { \ return callback(*item); \ } \ - return NodeTools::warn_or_error(warn, "Invalid ", name, ": ", identifier); \ + return NodeTools::warn_or_error(warn, "Invalid ", name, " identifier: ", identifier); \ }; \ } \ constexpr NodeTools::NodeCallback auto expect_item_identifier( \ @@ -266,6 +266,16 @@ namespace OpenVic { ) CONST { \ return NodeTools::expect_identifier(expect_item_str(callback, warn)); \ } \ + constexpr NodeTools::NodeCallback auto expect_item_string( \ + NodeTools::Callback auto callback, bool warn \ + ) CONST { \ + return NodeTools::expect_string(expect_item_str(callback, warn)); \ + } \ + constexpr NodeTools::NodeCallback auto expect_item_identifier_or_string( \ + NodeTools::Callback auto callback, bool warn \ + ) CONST { \ + return NodeTools::expect_identifier_or_string(expect_item_str(callback, warn)); \ + } \ constexpr NodeTools::NodeCallback auto expect_item_assign_and_default( \ NodeTools::KeyValueCallback auto default_callback, \ NodeTools::Callback auto callback \ @@ -506,6 +516,16 @@ private: ) const_kw { \ return registry.expect_item_identifier(callback, warn); \ } \ + constexpr NodeTools::NodeCallback auto expect_##singular##_string( \ + NodeTools::Callback auto callback, bool warn = false \ + ) const_kw { \ + return registry.expect_item_string(callback, warn); \ + } \ + constexpr NodeTools::NodeCallback auto expect_##singular##_identifier_or_string( \ + NodeTools::Callback auto callback, bool warn = false \ + ) const_kw { \ + return registry.expect_item_identifier_or_string(callback, warn); \ + } \ constexpr NodeTools::NodeCallback auto expect_##singular##_assign_and_default( \ NodeTools::KeyValueCallback auto default_callback, \ NodeTools::Callback auto callback \ -- cgit v1.2.3-56-ga3b1