WSF
UtCsv Namespace Reference

Classes

class  Parser
 Tokenizes a .csv text stream. More...

Typedefs

typedef std::vector< std::string > StringList

Enumerations

enum  ParseResult { cCSV_FIELD , cCSV_NEW_ROW , cCSV_EOF , cCSV_ERROR }

Functions

WSF_UT_EXPORT void Escape (std::string &aText)
WSF_UT_EXPORT std::vector< StringListToStrings (std::istream &aCsvStream)
 Parse a CSV text stream into an array of array of strings representing the rows of cells.
WSF_UT_EXPORT std::string FromStrings (const std::vector< StringList > &aRows)
 Create CSV text given an array of array of strings.
WSF_UT_EXPORT std::string RowFromStrings (const StringList &aRows)

Typedef Documentation

◆ StringList

typedef std::vector<std::string> UtCsv::StringList

Enumeration Type Documentation

◆ ParseResult

Enumerator
cCSV_FIELD 
cCSV_NEW_ROW 
cCSV_EOF 
cCSV_ERROR 

Function Documentation

◆ Escape()

void UtCsv::Escape ( std::string & aText)

Escape some text so that it can be written to a CSV field If the text contains a comma, quote, or newline, the string is quoted.

Referenced by FromStrings(), and RowFromStrings().

◆ FromStrings()

std::string UtCsv::FromStrings ( const std::vector< StringList > & aRows)

Create CSV text given an array of array of strings.

References Escape().

◆ RowFromStrings()

std::string UtCsv::RowFromStrings ( const StringList & strings)

Given a list of strings a row's field values, return a single string with conformant .csv row text Note: the field values should not be escaped yet, or they could receive additional quotes

References Escape().

◆ ToStrings()

std::vector< UtCsv::StringList > UtCsv::ToStrings ( std::istream & aCsvStream)

Parse a CSV text stream into an array of array of strings representing the rows of cells.

References cCSV_EOF, cCSV_ERROR, cCSV_FIELD, cCSV_NEW_ROW, and UtCsv::Parser::ReadToken().

Copyrights Multiple, All Rights Reserved