Skip to content

Commit ce49c7d

Browse files
committed
updated Bugfix #204 when using CDATA
1 parent 77c52c6 commit ce49c7d

File tree

1 file changed

+105
-9
lines changed

1 file changed

+105
-9
lines changed

cpp/openScenarioLib/generated/v1_3/export/xml/OpenScenarioXmlExporterV1_3.cpp

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,9 +1600,41 @@ namespace NET_ASAM_OPENSCENARIO
16001600
const auto kContent = customCommandActionWriter->GetContent();
16011601

16021602
//Modification: when parsing files with half tabs the format get mixed up
1603-
auto modifiedContent = kContent.substr(1, kContent.size());
1604-
modifiedContent = "\n\t\t" + modifiedContent;
1605-
modifiedContent.append("\t\t");
1603+
std::string modifiedContent;
1604+
1605+
int countNewline = 0;
1606+
std::string substringNewLine = "\n";
1607+
1608+
for (size_t offset = kContent.find(substringNewLine); offset != std::string::npos; offset = kContent.find(substringNewLine, offset + substringNewLine.length()))
1609+
{
1610+
++countNewline;
1611+
}
1612+
1613+
if (countNewline != 2)
1614+
{
1615+
//missing \n after CData
1616+
int countTabs = 0;
1617+
std::string substringTabs = "\t";
1618+
1619+
for (size_t offset = kContent.find(substringTabs); offset != std::string::npos; offset = kContent.find(substringTabs, offset + substringTabs.length()))
1620+
{
1621+
++countTabs;
1622+
}
1623+
1624+
modifiedContent = kContent.substr(1, kContent.size());
1625+
modifiedContent = "\n\t\t" + modifiedContent;
1626+
modifiedContent.append("\n");
1627+
for (int i = 0; i < countTabs + 1; i++)
1628+
{
1629+
modifiedContent.append("\t");
1630+
}
1631+
}
1632+
else
1633+
{
1634+
modifiedContent = kContent.substr(1, kContent.size());
1635+
modifiedContent = "\n\t\t" + modifiedContent;
1636+
modifiedContent.append("\t\t");
1637+
}
16061638

16071639
if (!kContent.empty())
16081640
{
@@ -1626,9 +1658,41 @@ namespace NET_ASAM_OPENSCENARIO
16261658
const auto kContent = customContentWriter->GetContent();
16271659

16281660
//Modification: when parsing files with half tabs the format get mixed up
1629-
auto modifiedContent = kContent.substr(1, kContent.size());
1630-
modifiedContent = "\n\t\t" + modifiedContent;
1631-
modifiedContent.append("\t\t");
1661+
std::string modifiedContent;
1662+
1663+
int countNewline = 0;
1664+
std::string substringNewLine = "\n";
1665+
1666+
for (size_t offset = kContent.find(substringNewLine); offset != std::string::npos; offset = kContent.find(substringNewLine, offset + substringNewLine.length()))
1667+
{
1668+
++countNewline;
1669+
}
1670+
1671+
if (countNewline != 2)
1672+
{
1673+
//missing \n after CData
1674+
int countTabs = 0;
1675+
std::string substringTabs = "\t";
1676+
1677+
for (size_t offset = kContent.find(substringTabs); offset != std::string::npos; offset = kContent.find(substringTabs, offset + substringTabs.length()))
1678+
{
1679+
++countTabs;
1680+
}
1681+
1682+
modifiedContent = kContent.substr(1, kContent.size());
1683+
modifiedContent = "\n\t\t" + modifiedContent;
1684+
modifiedContent.append("\n");
1685+
for (int i = 0; i < countTabs + 1; i++)
1686+
{
1687+
modifiedContent.append("\t");
1688+
}
1689+
}
1690+
else
1691+
{
1692+
modifiedContent = kContent.substr(1, kContent.size());
1693+
modifiedContent = "\n\t\t" + modifiedContent;
1694+
modifiedContent.append("\t\t");
1695+
}
16321696

16331697
if (!kContent.empty())
16341698
{
@@ -7813,9 +7877,41 @@ namespace NET_ASAM_OPENSCENARIO
78137877
const auto kContent = userDefinedDistributionWriter->GetContent();
78147878

78157879
//Modification: when parsing files with half tabs the format get mixed up
7816-
auto modifiedContent = kContent.substr(1, kContent.size());
7817-
modifiedContent = "\n\t\t" + modifiedContent;
7818-
modifiedContent.append("\t\t");
7880+
std::string modifiedContent;
7881+
7882+
int countNewline = 0;
7883+
std::string substringNewLine = "\n";
7884+
7885+
for (size_t offset = kContent.find(substringNewLine); offset != std::string::npos; offset = kContent.find(substringNewLine, offset + substringNewLine.length()))
7886+
{
7887+
++countNewline;
7888+
}
7889+
7890+
if (countNewline != 2)
7891+
{
7892+
//missing \n after CData
7893+
int countTabs = 0;
7894+
std::string substringTabs = "\t";
7895+
7896+
for (size_t offset = kContent.find(substringTabs); offset != std::string::npos; offset = kContent.find(substringTabs, offset + substringTabs.length()))
7897+
{
7898+
++countTabs;
7899+
}
7900+
7901+
modifiedContent = kContent.substr(1, kContent.size());
7902+
modifiedContent = "\n\t\t" + modifiedContent;
7903+
modifiedContent.append("\n");
7904+
for (int i = 0; i < countTabs + 1; i++)
7905+
{
7906+
modifiedContent.append("\t");
7907+
}
7908+
}
7909+
else
7910+
{
7911+
modifiedContent = kContent.substr(1, kContent.size());
7912+
modifiedContent = "\n\t\t" + modifiedContent;
7913+
modifiedContent.append("\t\t");
7914+
}
78197915

78207916
if (!kContent.empty())
78217917
{

0 commit comments

Comments
 (0)