From aaff09b1bb94f5353337e0aa9ce8cbd50afb0aec Mon Sep 17 00:00:00 2001 From: rlm Date: Mon, 14 Oct 2019 18:06:00 +0200 Subject: :Jira: ADSVHTNG-1055 - separate header file in util/ defining tascxml constants Change-Id: Id754a7faf2a548c8e10e45853c202cdad59ef1e7 --- src/uscxml/transform/ChartToC.cpp | 29 +++++++++++------------------ src/uscxml/util/TASCXMLUtils.h | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 src/uscxml/util/TASCXMLUtils.h diff --git a/src/uscxml/transform/ChartToC.cpp b/src/uscxml/transform/ChartToC.cpp index 475e423..979103a 100755 --- a/src/uscxml/transform/ChartToC.cpp +++ b/src/uscxml/transform/ChartToC.cpp @@ -27,6 +27,8 @@ #include #include "uscxml/interpreter/Logging.h" +#include "uscxml/util/TASCXMLUtils.h" + #include #include @@ -1818,13 +1820,6 @@ void ChartToC::writeElementInfo(std::ostream& stream) { stream << std::endl; } - static const X kXMLCharVerdict = X("verdict"); - static const X kXMLCharTimestamp = X("timestamp"); - static const X kXMLCharTestStep = X("teststep"); - static const X kXMLCharDescription = X("description"); - static const X kXMLCharResultId = X("resultid"); - static const X kXMLChaRequirementId = X("requirementid"); - static const X kXMLCharCurrentVaue = X("currentvalue"); std::list tascxmlresults = DOMUtils::inDocumentOrder({ "tascxml:result" }, _scxml); if (tascxmlresults.size() > 0) { _hasElement.insert("result"); @@ -1834,19 +1829,19 @@ void ChartToC::writeElementInfo(std::ostream& stream) { DOMElement* tascxmlresult = *iter; stream << " { "; stream << std::endl << " /* verdict */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLCharVerdict) ? "\"" + escape(ATTR(tascxmlresult, kXMLCharVerdict)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLCharVerdict) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLCharVerdict)) + "\"" : "NULL") << ", "; stream << std::endl << " /* timestamp */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLCharTimestamp) ? "\"" + escape(ATTR(tascxmlresult, kXMLCharTimestamp)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLCharTimestamp) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLCharTimestamp)) + "\"" : "NULL") << ", "; stream << std::endl << " /* teststep */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLCharTestStep) ? "\"" + escape(ATTR(tascxmlresult, kXMLCharTestStep)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLCharTestStep) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLCharTestStep)) + "\"" : "NULL") << ", "; stream << std::endl << " /* description */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLCharDescription) ? "\"" + escape(ATTR(tascxmlresult, kXMLCharDescription)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLCharDescription) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLCharDescription)) + "\"" : "NULL") << ", "; stream << std::endl << " /* resultid */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLCharResultId) ? "\"" + escape(ATTR(tascxmlresult, kXMLCharResultId)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLCharResultId) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLCharResultId)) + "\"" : "NULL") << ", "; stream << std::endl << " /* requirementid */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLChaRequirementId) ? "\"" + escape(ATTR(tascxmlresult, kXMLChaRequirementId)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLChaRequirementId) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLChaRequirementId)) + "\"" : "NULL") << ", "; stream << std::endl << " /* currentvalue */ "; - stream << (HAS_ATTR(tascxmlresult, kXMLCharCurrentVaue) ? "\"" + escape(ATTR(tascxmlresult, kXMLCharCurrentVaue)) + "\"" : "NULL"); + stream << (HAS_ATTR(tascxmlresult, tascxml::kXMLCharCurrentVaue) ? "\"" + escape(ATTR(tascxmlresult, tascxml::kXMLCharCurrentVaue)) + "\"" : "NULL"); stream << std::endl << " }" << (i + 1 < tascxmlresults.size() ? ",": "") << std::endl; tascxmlresult->setAttribute(X("documentOrder"), X(toStr(i))); @@ -1855,8 +1850,6 @@ void ChartToC::writeElementInfo(std::ostream& stream) { stream << std::endl; } - static const X kXMLCharDataId = X("dataid"); - static const X kXMLCharValue = X("value"); std::list tascxmlsets = DOMUtils::inDocumentOrder({ "tascxml:set" }, _scxml); if (tascxmlsets.size() > 0) { _hasElement.insert("set"); @@ -1866,9 +1859,9 @@ void ChartToC::writeElementInfo(std::ostream& stream) { DOMElement* tascxmlset = *iter; stream << " { "; stream << std::endl << " /* dataid */ "; - stream << (HAS_ATTR(tascxmlset, kXMLCharDataId) ? "\"" + escape(ATTR(tascxmlset, kXMLCharDataId)) + "\"" : "NULL") << ", "; + stream << (HAS_ATTR(tascxmlset, tascxml::kXMLCharDataId) ? "\"" + escape(ATTR(tascxmlset, tascxml::kXMLCharDataId)) + "\"" : "NULL") << ", "; stream << std::endl << " /* value */ "; - stream << (HAS_ATTR(tascxmlset, kXMLCharValue) ? "\"" + escape(ATTR(tascxmlset, kXMLCharValue)) + "\"" : "NULL"); + stream << (HAS_ATTR(tascxmlset, tascxml::kXMLCharValue) ? "\"" + escape(ATTR(tascxmlset, tascxml::kXMLCharValue)) + "\"" : "NULL"); stream << std::endl << " }" << (i + 1 < tascxmlsets.size() ? ",": "") << std::endl; tascxmlset->setAttribute(X("documentOrder"), X(toStr(i))); diff --git a/src/uscxml/util/TASCXMLUtils.h b/src/uscxml/util/TASCXMLUtils.h new file mode 100644 index 0000000..66c4073 --- /dev/null +++ b/src/uscxml/util/TASCXMLUtils.h @@ -0,0 +1,23 @@ + +#ifndef TASCXMLUTILS_H +#define TASCXMLUTILS_H + +#include "uscxml/util/DOM.h" + + +namespace tascxml { + + static const uscxml::X kXMLCharVerdict = uscxml::X("verdict"); + static const uscxml::X kXMLCharTimestamp = uscxml::X("timestamp"); + static const uscxml::X kXMLCharTestStep = uscxml::X("teststep"); + static const uscxml::X kXMLCharDescription = uscxml::X("description"); + static const uscxml::X kXMLCharResultId = uscxml::X("resultid"); + static const uscxml::X kXMLChaRequirementId = uscxml::X("requirementid"); + static const uscxml::X kXMLCharCurrentVaue = uscxml::X("currentvalue"); + + static const uscxml::X kXMLCharDataId = uscxml::X("dataid"); + static const uscxml::X kXMLCharValue = uscxml::X("value"); + +} + +#endif \ No newline at end of file -- cgit v0.12