MCPcopy Create free account
hub / github.com/boostorg/json / write_some

Method write_some

include/boost/json/basic_parser_impl.hpp:2807–2889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2805
2806template<class Handler>
2807std::size_t
2808basic_parser<Handler>::
2809write_some(
2810 bool more,
2811 char const* data,
2812 std::size_t size,
2813 system::error_code& ec)
2814{
2815 // see if we exited via exception
2816 // on the last call to write_some
2817 if(! clean_)
2818 {
2819 // prevent UB
2820 if(! ec_)
2821 {
2822 BOOST_JSON_FAIL(ec_, error::exception);
2823 }
2824 }
2825 if(ec_)
2826 {
2827 // error is sticky
2828 ec = ec_;
2829 return 0;
2830 }
2831 clean_ = false;
2832 more_ = more;
2833 end_ = data + size;
2834 const char* p;
2835 if(BOOST_JSON_LIKELY(st_.empty()))
2836 {
2837 // first time
2838 depth_ = opt_.max_depth;
2839 if(BOOST_JSON_UNLIKELY(
2840 ! h_.on_document_begin(ec_)))
2841 {
2842 ec = ec_;
2843 return 0;
2844 }
2845 p = parse_document(data, std::true_type());
2846 }
2847 else
2848 {
2849 p = parse_document(data, std::false_type());
2850 }
2851
2852 if(BOOST_JSON_LIKELY(p != sentinel()))
2853 {
2854 BOOST_ASSERT(! ec_);
2855 if(! done_)
2856 {
2857 done_ = true;
2858 h_.on_document_end(ec_);
2859 }
2860 }
2861 else
2862 {
2863 if(! ec_)
2864 {

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
on_document_beginMethod · 0.45
on_document_endMethod · 0.45

Tested by

no test coverage detected