Skip to content

Commit

Permalink
Optimize csv_encoder for streaming case
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Jan 26, 2025
1 parent b6c0920 commit f15742a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions include/jsoncons_ext/csv/csv_encoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ class basic_csv_encoder final : public basic_json_visitor<CharT>
{
}

bool is_object() const
{
return item_kind_ == stack_item_kind::object || stack_item_kind::flat_object;
}

stack_item_kind item_kind() const
{
return item_kind_;
Expand Down
4 changes: 2 additions & 2 deletions test/csv/src/encode_decode_csv_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ TEMPLATE_TEST_CASE("test_csv_encoder_reset", "",
// Missing column and array end
f.encoder.flush();

CHECK("h1,h2\n" == f.string1());
CHECK("h1,h2\n1" == f.string1()); // streaming case
f.encoder.reset();
f.encoder.begin_array();
f.encoder.begin_array();
Expand All @@ -217,7 +217,7 @@ TEMPLATE_TEST_CASE("test_csv_encoder_reset", "",
f.encoder.end_array();
f.encoder.end_array();
f.encoder.flush();
CHECK("h1,h2\nh3,h4\n3,4\n" == f.string1());
CHECK("h1,h2\n1h3,h4\n3,4\n" == f.string1()); // streaming case

// Reset and encode to different sink
f.encoder.reset(f.output2);
Expand Down

0 comments on commit f15742a

Please sign in to comment.