aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/NodeTools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.cpp')
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.cpp b/src/openvic-simulation/dataloader/NodeTools.cpp
index 4612f77..957aa01 100644
--- a/src/openvic-simulation/dataloader/NodeTools.cpp
+++ b/src/openvic-simulation/dataloader/NodeTools.cpp
@@ -400,9 +400,9 @@ node_callback_t NodeTools::expect_dictionary_key_map(key_map_t key_map) {
);
}
-node_callback_t NodeTools::name_list_callback(callback_t<std::vector<std::string>&&> callback) {
+node_callback_t NodeTools::name_list_callback(callback_t<name_list_t&&> callback) {
return [callback](ast::NodeCPtr node) -> bool {
- std::vector<std::string> list;
+ name_list_t list;
bool ret = expect_list_reserve_length(
list, expect_identifier_or_string(vector_callback<std::string_view>(list))
)(node);
@@ -411,6 +411,17 @@ node_callback_t NodeTools::name_list_callback(callback_t<std::vector<std::string
};
}
+std::ostream& OpenVic::operator<<(std::ostream& stream, name_list_t const& name_list) {
+ stream << '[';
+ if (!name_list.empty()) {
+ stream << name_list.front();
+ std::for_each(name_list.begin() + 1, name_list.end(), [&stream](std::string const& name) -> void {
+ stream << ", " << name;
+ });
+ }
+ return stream << ']';
+}
+
callback_t<std::string_view> NodeTools::assign_variable_callback_string(std::string& var) {
return assign_variable_callback_cast<std::string_view>(var);
}