23 static const std::map<std::string, char> escapes{{
"<",
'<'}, {
">",
'>'}, {
"&",
'&'}, {
""",
'"'}, {
"'",
'\''}};
27 auto position = xml.
find(
kv.first);
28 if (position != std::string::npos) {
29 xml.
replace(position,
kv.first.length(), 1,
kv.second);
54 unsigned int index = 0;
93 if (message.find(
"Namespace") != std::string::npos) {
134 PRECICE_ERROR(
"An unexpected exception occurred during configuration: {}.",
e.what());
178 content.c_str(), content.size(),
nullptr);
192 bool operator<(
const Distance &other)
const
199 bool validPrefix =
std::any_of(DefTags.begin(), DefTags.end(), [
prefix](
const auto &tag) { return tag->getNamespace() == prefix; });
202 for (
const auto &tag : DefTags) {
203 if (!validPrefix || (tag->getNamespace() ==
prefix)) {
204 entries.
insert(tag->getFullName());
221 return pTag->_fullName == expectedName;
244 "Tag <{}> is not allowed to occur multiple times.",
pDefSubTag->_fullName);
265 auto pTag = std::make_shared<CTag>();
#define PRECICE_ERROR(...)
#define PRECICE_WARN(...)
#define PRECICE_INFO(...)
#define PRECICE_CHECK(check,...)
T back_inserter(T... args)
This class provides a lightweight logger.
void OnTextSection(const std::string &ch)
Callback for text sections in xml file.
ConfigParser(const std::string &filePath, const ConfigurationContext &context, std::shared_ptr< XMLTag > pXmlTag)
Parser ctor for Callback init.
void OnEndElement()
Callback for End-Tag.
std::shared_ptr< precice::xml::XMLTag > m_pXmlTag
void OnStartElement(std::string localname, std::string prefix, CTag::AttributePair attributes)
Callback for Start-Tag.
void connectTags(const ConfigurationContext &context, std::vector< std::shared_ptr< precice::xml::XMLTag > > &DefTags, CTagPtrVec &SubTags)
Connects the actual tags of an xml layer with the predefined tags.
int readXmlFile(std::string const &filePath)
Reads the xml file.
static precice::logging::Logger _log
static void MessageProxy(int level, const std::string &mess)
Proxy for error and warning messages from libxml2.
std::vector< StringMatch > computeMatches(std::string_view given, const Container &expected)
contains the XML configuration parser.
void OnEndElementNs(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
void OnFatalErrorFunc(void *userData, const char *error,...)
void OnStartElementNs(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
std::string decodeXML(std::string xml)
Decodes escape sequences of a given xml.
void OnStructuredErrorFunc(void *userData, const xmlError *error)
void OnCharacters(void *ctx, const xmlChar *ch, int len)
void OnErrorFunc(void *userData, const char *error,...)
Tightly coupled to the parameters of Participant()