62 std::istringstream stream (input);
66 return static_cast<bool> (stream);
74 : m_delimiter (delimiter),
76 m_fileStream (filepath),
77 m_stream (&m_fileStream)
83 : m_delimiter (delimiter),
174 typedef signed char byte_type;
178 std::istringstream tempStream (input);
180 std::int16_t tempOutput = 0;
181 tempStream >> tempOutput;
186 value =
static_cast<byte_type
> (tempOutput);
189 bool success =
static_cast<bool> (tempStream);
192 <<
"', output=" << tempOutput
193 <<
", result=" << success);
245 typedef unsigned char byte_type;
249 std::istringstream tempStream (input);
251 std::uint16_t tempOutput = 0;
252 tempStream >> tempOutput;
257 value =
static_cast<byte_type
> (tempOutput);
260 bool success =
static_cast<bool> (tempStream);
263 <<
"', output=" << tempOutput
264 <<
", result=" << success);
317 auto start_col = line.begin ();
318 auto end_col = line.end ();
320 while ( start_col != line.end () )
322 std::tie (value, end_col) =
ParseColumn (start_col, line.end ());
328 if ( end_col != line.end () )
339 std::tuple<std::string, std::string::const_iterator>
354 State state = State::BEGIN;
362 NS_LOG_DEBUG (
"Found end iterator, switching to END state");
373 if (state != State::QUOTED_STRING)
377 NS_LOG_DEBUG (
"Found field delimiter, switching to END state");
379 if ( state == State::UNQUOTED_STRING )
381 NS_LOG_DEBUG (
"Removing trailing whitespace from unquoted field: '" << buffer <<
"'");
382 auto len = buffer.size ();
385 while ( !buffer.empty ()
386 && std::isspace (
static_cast<unsigned char> (buffer.back ())) )
391 auto finalLen = buffer.size ();
393 NS_LOG_DEBUG (
"Removed " << (len - finalLen) <<
" trailing whitespace characters");
402 NS_LOG_DEBUG (
"Found start of comment, switching to END state");
419 NS_LOG_DEBUG (
"Switching state: BEGIN -> QUOTED_STRING");
421 state = State::QUOTED_STRING;
423 else if (!std::isspace (c))
425 NS_LOG_DEBUG (
"Switching state: BEGIN -> UNQUOTED_STRING");
427 state = State::UNQUOTED_STRING;
428 buffer.push_back (c);
432 case State::QUOTED_STRING:
436 NS_LOG_DEBUG (
"Switching state: QUOTED_STRING -> END_QUOTE");
437 state = State::END_QUOTE;
441 buffer.push_back (c);
445 case State::END_QUOTE:
449 NS_LOG_DEBUG (
"Switching state: END_QUOTE -> QUOTED_STRING" );
452 state = State::QUOTED_STRING;
453 buffer.push_back (c);
457 NS_LOG_DEBUG (
"Switching state: END_QUOTE -> FIND_DELIMITER" );
458 state = State::FIND_DELIMITER;
462 case State::UNQUOTED_STRING:
464 buffer.push_back (c);
466 case State::FIND_DELIMITER:
477 return std::make_tuple (buffer, iter);