From 7167a1722a5465a673094872767f524dd29f572d Mon Sep 17 00:00:00 2001 From: MFraters Date: Sun, 4 Mar 2018 03:26:55 +0100 Subject: [PATCH] make mangle an internal function of ParameterHandler. --- include/deal.II/base/parameter_handler.h | 11 - source/base/parameter_handler.cc | 317 +++++++++++------------ 2 files changed, 157 insertions(+), 171 deletions(-) diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index e5bc57cb97..95668d351d 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -1478,17 +1478,6 @@ private: */ std::vector > actions; - /** - * Mangle a string so that it doesn't contain any special characters or - * spaces. - */ - static std::string mangle (const std::string &s); - - /** - * Unmangle a string into its original form. - */ - static std::string demangle (const std::string &s); - /** * Given a list of directories and subdirectories that identify * a particular place in the tree, return the string that identifies diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 506bffeae1..604e1d0f3f 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -46,181 +46,178 @@ ParameterHandler::ParameterHandler () {} - -std::string -ParameterHandler::mangle (const std::string &s) +namespace { - std::string u; - - // reserve the minimum number of characters we will need. it may - // be more but this is the least we can do - u.reserve (s.size()); + std::string + mangle (const std::string &s) + { + std::string u; - // see if the name is special and if so mangle the whole thing - const bool mangle_whole_string = (s == "value"); + // reserve the minimum number of characters we will need. it may + // be more but this is the least we can do + u.reserve (s.size()); - // for all parts of the string, see - // if it is an allowed character or - // not - for (unsigned int i=0; i(s[i])/16]); - u.push_back (hex[static_cast(s[i])%16]); - } - } - - return u; -} + // for all parts of the string, see + // if it is an allowed character or + // not + for (unsigned int i=0; i(s[i])/16]); + u.push_back (hex[static_cast(s[i])%16]); + } + } + return u; + } -std::string -ParameterHandler::demangle (const std::string &s) -{ - std::string u; - u.reserve (s.size()); - for (unsigned int i=0; i(c)); + for (unsigned int i=0; i(c)); + // skip the two characters + i += 2; + } + return u; + } -namespace -{ /** * Return whether a given node is a parameter node (as opposed * to being a subsection or alias node) -- 2.39.5