File indexing completed on 2025-01-18 10:13:56
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #ifndef Helper_h
0010 #define Helper_h
0011
0012 #include <string>
0013 #include <map>
0014
0015 #include "xercesc/util/XercesDefs.hpp"
0016 #include "xercesc/util/XMLChar.hpp"
0017 #include "xercesc/util/XMLString.hpp"
0018
0019 XERCES_CPP_NAMESPACE_BEGIN
0020 class DOMNamedNodeMap;
0021 class DOMNode;
0022 XERCES_CPP_NAMESPACE_END
0023
0024 namespace vgdml {
0025
0026 namespace Helper {
0027
0028 template <typename T = std::string>
0029 T Transcode(const XMLCh *const anXMLstring);
0030
0031 template <typename F, typename T, typename R>
0032 R TranscodeAndApply(F aFunction, T anArgument);
0033
0034 template <typename T = std::string>
0035 T GetAttribute(std::string const &attrName, XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap const *theAttributes);
0036
0037 std::map<std::string const, std::string const> GetAttributes(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0038 std::map<std::string const, std::string const> GetAttributes(
0039 XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap const *theAttributes);
0040
0041 std::string GetNodeInformation(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0042
0043 }
0044 }
0045
0046 namespace vgdml {
0047 namespace Helper {
0048
0049 template <typename F, typename R>
0050 R TranscodeAndApply(F aFunction, std::string anArgument)
0051 {
0052 auto anXMLargument = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(anArgument.c_str());
0053 auto result = aFunction(anXMLargument);
0054 XERCES_CPP_NAMESPACE_QUALIFIER XMLString::release(&anXMLargument);
0055 return std::forward<R>(result);
0056 }
0057
0058 bool IsWhitespace(std::string const &aString);
0059
0060 }
0061 }
0062
0063 #endif