MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / Get

Method Get

rapidjson/pointer.h:479–507  ·  view source on GitHub ↗

Query a value in a subtree. ! \param root Root value of a DOM sub-tree to be resolved. It can be any value other than document root. \param unresolvedTokenIndex If the pointer cannot resolve a token in the pointer, this parameter can obtain the index of unresolved token. \return Pointer to the value if it can be resolved. Otherwise null. \note There are onl

Source from the content-addressed store, hash-verified

477 Use unresolvedTokenIndex to retrieve the token index.
478 */
479 ValueType* Get(ValueType& root, size_t* unresolvedTokenIndex = 0) const {
480 RAPIDJSON_ASSERT(IsValid());
481 ValueType* v = &root;
482 for (const Token *t = tokens_; t != tokens_ + tokenCount_; ++t) {
483 switch (v->GetType()) {
484 case kObjectType:
485 {
486 typename ValueType::MemberIterator m = v->FindMember(GenericStringRef<Ch>(t->name, t->length));
487 if (m == v->MemberEnd())
488 break;
489 v = &m->value;
490 }
491 continue;
492 case kArrayType:
493 if (t->index == kPointerInvalidIndex || t->index >= v->Size())
494 break;
495 v = &((*v)[t->index]);
496 continue;
497 default:
498 break;
499 }
500
501 // Error: unresolved token
502 if (unresolvedTokenIndex)
503 *unresolvedTokenIndex = static_cast<size_t>(t - tokens_);
504 return 0;
505 }
506 return v;
507 }
508
509 //! Query a const value in a const subtree.
510 /*!

Callers 2

HandleRefSchemaMethod · 0.45
GetValueByPointerFunction · 0.45

Calls 5

GetFunction · 0.85
FindMemberMethod · 0.80
MemberEndMethod · 0.80
GetTypeMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected