|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
67 auto& it = input_stream;
74 if( line.size() > 0 ) {
75 result.push_back( line );
90 auto& it = input_stream;
96 return trim_chars_.find( c ) != std::string::npos;
103 if( use_escapes_ && *it ==
'\\' ) {
110 throw std::runtime_error(
111 "Unexpected end of string at " + it.at() +
". Expecting escape sequence."
124 if( *it ==
'\n' || separator_chars_.find( *it ) != std::string::npos ) {
130 if( quotation_chars_.find( *it ) != std::string::npos ) {
139 if( qs ==
"" && use_twin_quotes_ ) {
163 auto& it = input_stream;
164 std::vector<std::string> result;
165 size_t field_count = 0;
173 while( comment_chars_.find( *it ) != std::string::npos ) {
175 assert( *it ==
'\n' );
184 if( field.size() > 0 || ! merge_separators_ ) {
185 result.push_back( field );
189 if( ! it || *it ==
'\n' ) {
197 if( skip_empty_lines_
199 && std::all_of( field.begin(), field.end(), isblank )
206 return std::vector<std::string>();
222 assert( separator_chars_.find( *it ) != std::string::npos );
228 if( result.size() == 0 ) {
229 assert( merge_separators_ ==
true );
230 result.push_back(
"" );
std::string deescape(std::string const &text)
Return a string where backslash-escaped characters are transformed into their respective string form.
std::vector< std::string > parse_line(utils::InputStream &input_stream) const
Parse one line of the CSV data and return it.
std::string trim_right(std::string const &s, std::string const &delimiters)
Return a copy of the input string, with left trimmed white spaces (or any other delimiters).
Provides functions for accessing the file system.
Provides some valuable additions to STD.
Table parse_document(utils::InputStream &input_stream) const
Parse a whole CSV document and return its contents.
Provides some commonly used string utility functions.
Table read(std::shared_ptr< BaseInputSource > source) const
Read CSV data from a source and return it as a table, using a vector per line, containing a vector of...
void skip_while(InputStream &source, char criterion)
Lexing function that advances the stream while its current char equals the provided one.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::string parse_field(utils::InputStream &input_stream) const
Parse one field (i.e., one cell) of the CSV data and return it.
void skip_until(InputStream &source, char criterion)
Lexing function that advances the stream until its current char equals the provided one.
std::string parse_quoted_string(utils::InputStream &source, bool use_escapes, bool use_twin_quotes, bool include_qmarks)
Read a string in quotation marks from a stream and return it.
std::vector< Line > Table