From f725e2c532b33170f0b91b990fbf3d68fbfa86d2 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 10 Oct 2018 16:09:34 -0500 Subject: [PATCH] Adding a C++ version of node_word_count --- include/openmc/xml_interface.h | 6 ++++-- src/xml_interface.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/openmc/xml_interface.h b/include/openmc/xml_interface.h index 8bf0f2174..e8248ca86 100644 --- a/include/openmc/xml_interface.h +++ b/include/openmc/xml_interface.h @@ -9,7 +9,7 @@ #include "pugixml.hpp" #include "xtensor/xarray.hpp" #include "xtensor/xadapt.hpp" - +#include "openmc/string_functions.h" namespace openmc { @@ -56,6 +56,8 @@ xt::xarray get_node_xarray(pugi::xml_node node, const char* name, std::vector get_child_nodes(pugi::xml_node node, const char* name); - + +int node_word_count(pugi::xml_node node, const char* name); + } // namespace openmc #endif // OPENMC_XML_INTERFACE_H diff --git a/src/xml_interface.cpp b/src/xml_interface.cpp index c9b7bbcab..82c59a27b 100644 --- a/src/xml_interface.cpp +++ b/src/xml_interface.cpp @@ -71,5 +71,10 @@ get_child_nodes(pugi::xml_node node, const char* name) return node_list; } - +int node_word_count(pugi::xml_node node, const char* name) +{ + std::string s = get_node_value(node, name); + return word_count(s); +} + } // namespace openmc