MCPcopy Create free account
hub / github.com/apache/arrow / ConsumeWholeObject

Function ConsumeWholeObject

cpp/src/arrow/json/chunker_test.cc:69–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static std::size_t ConsumeWholeObject(std::shared_ptr<Buffer>* buf) {
70 auto str = string_view(**buf);
71 auto fail = [buf] {
72 *buf = nullptr;
73 return string_view::npos;
74 };
75 if (WhitespaceOnly(str)) return fail();
76 auto open_brace = str.find_first_not_of(" \t\r\n");
77 if (str.at(open_brace) != '{') return fail();
78 auto close_brace = str.find_first_of("}");
79 if (close_brace == string_view::npos) return fail();
80 auto length = close_brace + 1;
81 *buf = SliceBuffer(*buf, length);
82 return length;
83}
84
85void AssertOnlyWholeObjects(Chunker& chunker, std::shared_ptr<Buffer> whole, int* count) {
86 *count = 0;

Callers 3

AssertOnlyWholeObjectsFunction · 0.70
AssertChunkingFunction · 0.70
AssertStraddledChunkingFunction · 0.70

Calls 2

WhitespaceOnlyFunction · 0.85
SliceBufferFunction · 0.85

Tested by

no test coverage detected