From e873288774fed79a563f890fd7beb9baf116aca5 Mon Sep 17 00:00:00 2001 From: rlm Date: Thu, 17 Sep 2020 17:34:26 +0200 Subject: :Jira: ADSVHTNG-1251 - introduced id attribute for set, get and result actions Change-Id: Ib94ab2585014519bb28ce6d5484f367df8aae04f --- src/uscxml/transform/ChartToC.cpp | 21 +++++++++++++-------- src/uscxml/util/TASCXMLUtils.h | 4 +--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/uscxml/transform/ChartToC.cpp b/src/uscxml/transform/ChartToC.cpp index 036c670..69b046d 100755 --- a/src/uscxml/transform/ChartToC.cpp +++ b/src/uscxml/transform/ChartToC.cpp @@ -904,11 +904,12 @@ void ChartToC::writeTypes(std::ostream& stream) { stream << " * All information pertaining to a element" << std::endl; stream << " */" << std::endl; stream << "struct uscxml_elem_taresult {" << std::endl; + stream << " const char* id;" << std::endl; stream << " const char* resultid;" << std::endl; stream << " const char* verdict;" << std::endl; stream << " const char* timestamp;" << std::endl; - stream << " const char* teststep;" << std::endl; stream << " const char* description;" << std::endl; + stream << " const char* teststep;" << std::endl; stream << " const char* currentvalue;" << std::endl; stream << " const char* valuemapping;" << std::endl; stream << " const char* condition;" << std::endl; @@ -920,9 +921,9 @@ void ChartToC::writeTypes(std::ostream& stream) { stream << " * All information pertaining to a element" << std::endl; stream << " */" << std::endl; stream << "struct uscxml_elem_taset {" << std::endl; + stream << " const char* id;" << std::endl; stream << " const char* dataid;" << std::endl; stream << " const char* value;" << std::endl; - stream << " const char* valueexpr;" << std::endl; stream << "};" << std::endl; stream << std::endl; @@ -930,6 +931,7 @@ void ChartToC::writeTypes(std::ostream& stream) { stream << " * All information pertaining to a element" << std::endl; stream << " */" << std::endl; stream << "struct uscxml_elem_taget {" << std::endl; + stream << " const char* id;" << std::endl; stream << " const char* dataid;" << std::endl; stream << "};" << std::endl; stream << std::endl; @@ -1899,16 +1901,18 @@ void ChartToC::writeElementInfo(std::ostream& stream) { for (auto iter = taresults.begin(); iter != taresults.end(); iter++, i++) { DOMElement* taresult = *iter; stream << " { "; + stream << std::endl << " /* id */ "; + stream << (HAS_ATTR(taresult, tascxml::kXMLCharId) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharId)) + "\"" : "NULL") << ", "; stream << std::endl << " /* resultid */ "; stream << (HAS_ATTR(taresult, tascxml::kXMLCharResultId) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharResultId)) + "\"" : "NULL") << ", "; stream << std::endl << " /* verdict */ "; stream << (HAS_ATTR(taresult, tascxml::kXMLCharVerdict) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharVerdict)) + "\"" : "NULL") << ", "; stream << std::endl << " /* timestamp */ "; stream << (HAS_ATTR(taresult, tascxml::kXMLCharTimestamp) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharTimestamp)) + "\"" : "NULL") << ", "; - stream << std::endl << " /* teststep */ "; - stream << (HAS_ATTR(taresult, tascxml::kXMLCharTestStep) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharTestStep)) + "\"" : "NULL") << ", "; stream << std::endl << " /* description */ "; stream << (HAS_ATTR(taresult, tascxml::kXMLCharDescription) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharDescription)) + "\"" : "NULL") << ", "; + stream << std::endl << " /* teststep */ "; + stream << (HAS_ATTR(taresult, tascxml::kXMLCharTestStep) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharTestStep)) + "\"" : "NULL") << ", "; stream << std::endl << " /* currentvalue */ "; stream << (HAS_ATTR(taresult, tascxml::kXMLCharCurrentVaue) ? "\"" + escape(ATTR(taresult, tascxml::kXMLCharCurrentVaue)) + "\"" : "NULL") << ", "; stream << std::endl << " /* valuemapping */ "; @@ -1928,14 +1932,14 @@ void ChartToC::writeElementInfo(std::ostream& stream) { if (tasets.size() > 0) { _hasElement.insert("set"); stream << "static const uscxml_elem_taset " << _prefix << "_elem_tasets[" << tasets.size() << "] = {" << std::endl; - stream << " /* dataid, value, valueexpr */" << std::endl; + stream << " /* id, dataid, value */" << std::endl; size_t i = 0; for (auto iter = tasets.begin(); iter != tasets.end(); iter++, i++) { DOMElement* taset = *iter; stream << " { "; + stream << (HAS_ATTR(taset, tascxml::kXMLCharId) ? "\"" + escape(ATTR(taset, tascxml::kXMLCharId)) + "\"" : "NULL") << ", "; stream << (HAS_ATTR(taset, tascxml::kXMLCharDataId) ? "\"" + escape(ATTR(taset, tascxml::kXMLCharDataId)) + "\"" : "NULL") << ", "; - stream << (HAS_ATTR(taset, tascxml::kXMLCharValue) ? "\"" + escape(ATTR(taset, tascxml::kXMLCharValue)) + "\"" : "NULL") << ", "; - stream << (HAS_ATTR(taset, tascxml::kXMLCharValueExpr) ? "\"" + escape(ATTR(taset, tascxml::kXMLCharValueExpr)) + "\"" : "NULL"); + stream << (HAS_ATTR(taset, tascxml::kXMLCharValue) ? "\"" + escape(ATTR(taset, tascxml::kXMLCharValue)) + "\"" : "NULL"); stream << " }" << (i + 1 < tasets.size() ? "," : "") << std::endl; taset->setAttribute(X("documentOrder"), X(toStr(i))); } @@ -1947,11 +1951,12 @@ void ChartToC::writeElementInfo(std::ostream& stream) { if (tagets.size() > 0) { _hasElement.insert("get"); stream << "static const uscxml_elem_taget " << _prefix << "_elem_tagets[" << tagets.size() << "] = {" << std::endl; - stream << " /* dataid */" << std::endl; + stream << " /* id, dataid */" << std::endl; size_t i = 0; for (auto iter = tagets.begin(); iter != tagets.end(); iter++, i++) { DOMElement* taget = *iter; stream << " { "; + stream << (HAS_ATTR(taget, tascxml::kXMLCharId) ? "\"" + escape(ATTR(taget, tascxml::kXMLCharId)) + "\"" : "NULL") << ", "; stream << (HAS_ATTR(taget, tascxml::kXMLCharDataId) ? "\"" + escape(ATTR(taget, tascxml::kXMLCharDataId)) + "\"" : "NULL"); stream << " }" << (i + 1 < tagets.size() ? "," : "") << std::endl; taget->setAttribute(X("documentOrder"), X(toStr(i))); diff --git a/src/uscxml/util/TASCXMLUtils.h b/src/uscxml/util/TASCXMLUtils.h index 2c70fab..31068db 100644 --- a/src/uscxml/util/TASCXMLUtils.h +++ b/src/uscxml/util/TASCXMLUtils.h @@ -8,6 +8,7 @@ namespace tascxml { static const uscxml::X NS_PREFIX = uscxml::X("tascxml:"); + static const uscxml::X kXMLCharId = uscxml::X("id"); static const uscxml::X kXMLCharResultId = uscxml::X("resultid"); static const uscxml::X kXMLCharVerdict = uscxml::X("verdict"); @@ -19,11 +20,8 @@ namespace tascxml { static const uscxml::X kXMLCharCondition = uscxml::X("condition"); static const uscxml::X kXMLChaRequirementId = uscxml::X("requirementid"); - static const uscxml::X kXMLCharId = uscxml::X("id"); static const uscxml::X kXMLCharDataId = uscxml::X("dataid"); - static const uscxml::X kXMLCharValue = uscxml::X("value"); - static const uscxml::X kXMLCharValueExpr = uscxml::X("valueexpr"); static const uscxml::X kXMLCharSlope = uscxml::X("slope"); static const uscxml::X kXMLCharStartExpr = uscxml::X("startexpr"); -- cgit v0.12