43 #ifndef GUM_CSV_PARSER_H 44 #define GUM_CSV_PARSER_H 77 template <
template<
typename>
class ALLOC = std::allocator>
100 const std::string& delimiter =
",",
101 const char commentmarker =
'#',
102 const char quoteMarker =
'"',
124 const std::vector<std::string,ALLOC<std::string>>&
current()
const;
127 const std::size_t
nbLine()
const;
131 const std::string& delimiter =
",",
132 const char commentmarker =
'#',
133 const char quoteMarker =
'"' );
138 #ifndef DOXYGEN_SHOULD_SKIP_THIS 141 void __getNextTriplet(
const std::string& str,
142 std::size_t& first_letter_token,
143 std::size_t& next_token,
144 std::size_t& last_letter_token,
145 std::size_t from )
const;
147 void __tokenize(
const std::string& str );
149 std::size_t __correspondingQuoteMarker(
const std::string& str,
150 std::size_t pos )
const;
154 std::string __delimiter;
155 std::string __spaces;
156 std::string __delimiterPlusSpaces;
157 std::size_t __nbLine;
158 char __commentMarker;
162 std::istream* __instream;
163 std::vector<std::string,ALLOC<std::string>> __data;
175 #endif // GUM_CSV_PARSER_H Class for fast parsing of CSV file (never more than one line in application memory) ...
Class for fast parsing of CSV file (never more than one line in application memory) ...
void useNewStream(std::istream &in, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"' )
reopens a new input stream to parse
const std::size_t nbLine() const
returns the current line number within the stream
ALLOC< std::string > allocator_type
type for the allocators passed in arguments of methods
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
CSVParser(std::istream &in, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"', const allocator_type& alloc = allocator_type () )
default constructor
bool next()
gets the next line of the csv stream and parses it
virtual ~CSVParser()
destructor
const std::vector< std::string, ALLOC< std::string > > & current() const
returns the current parsed line