@@ -1600,9 +1600,41 @@ namespace NET_ASAM_OPENSCENARIO
1600
1600
const auto kContent = customCommandActionWriter->GetContent();
1601
1601
1602
1602
//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
+ }
1606
1638
1607
1639
if (!kContent.empty())
1608
1640
{
@@ -1626,9 +1658,41 @@ namespace NET_ASAM_OPENSCENARIO
1626
1658
const auto kContent = customContentWriter->GetContent();
1627
1659
1628
1660
//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
+ }
1632
1696
1633
1697
if (!kContent.empty())
1634
1698
{
@@ -7813,9 +7877,41 @@ namespace NET_ASAM_OPENSCENARIO
7813
7877
const auto kContent = userDefinedDistributionWriter->GetContent();
7814
7878
7815
7879
//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
+ }
7819
7915
7820
7916
if (!kContent.empty())
7821
7917
{
0 commit comments