43 #ifndef GUM_CSV_PARSER_H 44 #define GUM_CSV_PARSER_H 50 #include <agrum/agrum.h> 77 template <
template<
typename>
class ALLOC = std::allocator>
82 using allocator_type = ALLOC<std::string>;
99 CSVParser( std::istream& in,
100 const std::string& delimiter =
",",
101 const char commentmarker =
'#',
102 const char quoteMarker =
'"',
103 const allocator_type& alloc = allocator_type () );
106 virtual ~CSVParser();
124 const std::vector<std::string,ALLOC<std::string>>& current()
const;
127 const std::size_t nbLine()
const;
130 void useNewStream ( std::istream& in,
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_;
173 #include <agrum/tools/database/CSVParser_tpl.h>