Adding a C++ version of node_word_count

This commit is contained in:
Patrick Shriwise 2018-10-10 16:09:34 -05:00
parent fea2c3cc04
commit f725e2c532
2 changed files with 10 additions and 3 deletions

View file

@ -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<T> get_node_xarray(pugi::xml_node node, const char* name,
std::vector<pugi::xml_node>
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

View file

@ -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