MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / operator[]

Method operator[]

base/base/JSON.cpp:424–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422
423
424JSON JSON::operator[] (size_t n) const
425{
426 ElementType type = getType();
427
428 if (type != TYPE_ARRAY)
429 throw JSONException("JSON: not array when calling operator[](size_t) method.");
430
431 Pos pos = ptr_begin;
432 ++pos;
433 checkPos(pos);
434
435 size_t i = 0;
436 const_iterator it = begin();
437 while (i < n && it != end())
438 {
439 ++it;
440 ++i;
441 }
442
443 if (i != n)
444 throw JSONException("JSON: array index " + std::to_string(n) + " out of bounds.");
445
446 return *it;
447}
448
449
450JSON::Pos JSON::searchField(const char * data, size_t size) const

Callers

nothing calls this directly

Calls 6

getTypeFunction · 0.85
beginFunction · 0.85
to_stringFunction · 0.70
JSONClass · 0.70
endFunction · 0.50
getValueMethod · 0.45

Tested by

no test coverage detected