Skip to content

Commit

Permalink
csv cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Mar 10, 2025
1 parent 7138336 commit ced679b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions include/jsoncons/decode_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ namespace jsoncons {
{
v.push_back(decode_traits<value_type,CharT>::decode(cursor, decoder, ec));
if (ec) {return T{};}
std::cout << "read next 10\n";
//cursor.next(ec);
//std::cout << "read next 10\n";
cursor.next(ec);
}
return v;
}
Expand Down Expand Up @@ -480,7 +480,7 @@ namespace jsoncons {
{
v.insert(decode_traits<value_type,CharT>::decode(cursor, decoder, ec));
if (ec) {return T{};}
std::cout << "cursor.next 20\n";
//std::cout << "cursor.next 20\n";
cursor.next(ec);
if (ec) {return T{};}
}
Expand Down Expand Up @@ -527,7 +527,7 @@ namespace jsoncons {
{
v[i] = decode_traits<value_type,CharT>::decode(cursor, decoder, ec);
if (ec) {return v;}
std::cout << "cursor.next 100\n";
//std::cout << "cursor.next 100\n";
cursor.next(ec);
if (ec) {return v;}
}
Expand Down Expand Up @@ -574,12 +574,12 @@ namespace jsoncons {
}
auto key = cursor.current().template get<key_type>(ec);
if (ec) {return val;}
std::cout << "cursor.next 200\n";
//std::cout << "cursor.next 200\n";
cursor.next(ec);
if (ec) {return val;}
val.emplace(std::move(key),decode_traits<mapped_type,CharT>::decode(cursor, decoder, ec));
if (ec) {return val;}
std::cout << "cursor.next 300\n";
//std::cout << "cursor.next 300\n";
cursor.next(ec);
if (ec) {return val;}
}
Expand Down Expand Up @@ -640,12 +640,12 @@ namespace jsoncons {
ec = json_errc::invalid_number;
return val;
}
std::cout << "cursor.next 500\n";
//std::cout << "cursor.next 500\n";
cursor.next(ec);
if (ec) {return val;}
val.emplace(n, decode_traits<mapped_type,CharT>::decode(cursor, decoder, ec));
if (ec) {return val;}
std::cout << "cursor.next 600\n";
//std::cout << "cursor.next 600\n";
cursor.next(ec);
if (ec) {return val;}
}
Expand Down
5 changes: 3 additions & 2 deletions include/jsoncons_ext/csv/csv_cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,11 @@ class basic_csv_cursor : public basic_staj_cursor<CharT>, private virtual ser_co
void read_to(basic_json_visitor<CharT>& visitor,
std::error_code& ec) override
{
basic_json_tee<char_type> tee(cursor_visitor_, visitor);
if (cursor_visitor_.event().send_json_event(visitor, *this, ec))
{
read_next(visitor, ec);
read_next(ec);
read_next(tee, ec);
//read_next(ec);
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/csv/src/csv_cursor_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ EUR_LIBOR_06M,2015-10-27,0.0000001
REQUIRE(cursor.current().event_type() == staj_event_type::begin_object);
cursor.read_to(decoder);

//REQUIRE(cursor.current().event_type() == staj_event_type::end_object);
//cursor.next();
REQUIRE(cursor.current().event_type() == staj_event_type::end_object);
cursor.next();

REQUIRE(cursor.current().event_type() == staj_event_type::begin_object);
cursor.next();
Expand Down

0 comments on commit ced679b

Please sign in to comment.