Commit cea3f975d8b1029b12823f744a7fae6b9ca8f76a

Authored by Benjamin Renard
1 parent 36b94578

Fix TT & catalog download when historic have some 'end of lines'

src/TimeTableCatalog/AsciiWriter.cc
... ... @@ -12,6 +12,8 @@
12 12 #include <fstream>
13 13 #include "TimeTableCatalogUtil.hh"
14 14  
  15 +#include <boost/algorithm/string.hpp>
  16 +
15 17 namespace TimeTableCatalog {
16 18  
17 19 const std::string AsciiWriter::FORMAT = "ASCII";
... ... @@ -94,7 +96,9 @@ void AsciiWriter::writeMetaData(const TimeTable&amp; pTT,
94 96 pOut << "# " << AsciiData::CONTACT_KEYWORD << " " << pTT._contact << std::endl;
95 97  
96 98 // -- write historic
97   - pOut << "# " << AsciiData::HISTORIC_KEYWORD << " " << pTT._history << ";" << std::endl;
  99 + std::string history = pTT._history;
  100 + boost::replace_all(history, "\n", "\n# ");
  101 + pOut << "# " << AsciiData::HISTORIC_KEYWORD << " " << history << ";" << std::endl;
98 102  
99 103 // -- write creation date
100 104 pOut << "# " << AsciiData::CREATION_DATE_KEYWORD << " ";
... ...
src/TimeTableCatalog/SpaceWriter.cc
... ... @@ -12,6 +12,8 @@
12 12 #include <fstream>
13 13 #include "TimeTableCatalogUtil.hh"
14 14  
  15 +#include <boost/algorithm/string.hpp>
  16 +
15 17 namespace TimeTableCatalog {
16 18  
17 19 const std::string SpaceWriter::FORMAT = "SPACE";
... ... @@ -145,8 +147,11 @@ void SpaceWriter::writeMetaData(const TimeTable&amp; pTT,
145 147 for (auto line : pTT._description) {
146 148 pOut << "# " << line << std::endl;
147 149 }
148   - if(! pTT._history.empty())
149   - pOut << "# " << pTT._history << std::endl;
  150 + if(! pTT._history.empty()) {
  151 + std::string history = pTT._history;
  152 + boost::replace_all(history, "\n", "\n# ");
  153 + pOut << "# " << history << std::endl;
  154 + }
150 155  
151 156 // repeat variable names
152 157 pOut << "# " << "t_begin" <<" "<< "t_end"<<" ";
... ...