aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/types/IdentifierRegistry.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-01-22 20:17:38 +0100
committer hop311 <hop3114@gmail.com>2024-01-22 20:25:09 +0100
commitcaa2f31d536f568e485f15537db5e2f79f7616d5 (patch)
tree7cd8a379963af18c24f8dabfe7525b39f2333e0c /src/openvic-simulation/types/IdentifierRegistry.hpp
parent8205732a1b95f018f0898a2a4bc62e22f5bee0d3 (diff)
Miscellaneous bug fixes and format cleanupmisc-changes
Diffstat (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp')
-rw-r--r--src/openvic-simulation/types/IdentifierRegistry.hpp22
1 files changed, 21 insertions, 1 deletions
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<value_type CONST&> 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<value_type CONST&> 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<value_type CONST&, ast::NodeCPtr> 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<decltype(registry)::value_type const_kw&> 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<decltype(registry)::value_type const_kw&> 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<decltype(registry)::value_type const_kw&, ast::NodeCPtr> auto callback \