MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / encodeCsvLine

Method encodeCsvLine

src/csvtable.cpp:600–616  ·  view source on GitHub ↗

* eine Zeile als CSV-String setzen: nötig für Copy */

Source from the content-addressed store, hash-verified

598 * eine Zeile als CSV-String setzen: nötig für Copy
599 */
600std::string CsvTable::encodeCsvLine(std::vector< std::string > *vec, CsvDefinition definition) {
601 std::ostringstream line;
602
603 for( std::vector<std::string>::size_type i = 0; i != vec->size(); ++i ) {
604 if( toBeQuoted( vec->at(i), definition ) ) {
605 quoteString(vec->at(i), line, definition);
606 } else {
607 line << vec->at(i);
608 }
609 if( i < vec->size()-1 ) {
610 line << definition.delimiter;
611 }
612 }
613 line << "\r\n"; // According to the CSV RFC 4180
614
615 return line.str();
616}
617
618
619

Callers 1

copySelectionMethod · 0.80

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected