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

Method Schema

rapidjson/schema.h:350–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348 friend class GenericSchemaDocument<ValueType, AllocatorType>;
349
350 Schema(SchemaDocumentType* schemaDocument, const PointerType& p, const ValueType& value, const ValueType& document, AllocatorType* allocator) :
351 allocator_(allocator),
352 enum_(),
353 enumCount_(),
354 not_(),
355 type_((1 << kTotalSchemaType) - 1), // typeless
356 validatorCount_(),
357 properties_(),
358 additionalPropertiesSchema_(),
359 patternProperties_(),
360 patternPropertyCount_(),
361 propertyCount_(),
362 minProperties_(),
363 maxProperties_(SizeType(~0)),
364 additionalProperties_(true),
365 hasDependencies_(),
366 hasRequired_(),
367 hasSchemaDependencies_(),
368 additionalItemsSchema_(),
369 itemsList_(),
370 itemsTuple_(),
371 itemsTupleCount_(),
372 minItems_(),
373 maxItems_(SizeType(~0)),
374 additionalItems_(true),
375 uniqueItems_(false),
376 pattern_(),
377 minLength_(0),
378 maxLength_(~SizeType(0)),
379 exclusiveMinimum_(false),
380 exclusiveMaximum_(false)
381 {
382 typedef typename SchemaDocumentType::ValueType ValueType;
383 typedef typename ValueType::ConstValueIterator ConstValueIterator;
384 typedef typename ValueType::ConstMemberIterator ConstMemberIterator;
385
386 if (!value.IsObject())
387 return;
388
389 if (const ValueType* v = GetMember(value, GetTypeString())) {
390 type_ = 0;
391 if (v->IsString())
392 AddType(*v);
393 else if (v->IsArray())
394 for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr)
395 AddType(*itr);
396 }
397
398 if (const ValueType* v = GetMember(value, GetEnumString()))
399 if (v->IsArray() && v->Size() > 0) {
400 enum_ = static_cast<uint64_t*>(allocator_->Malloc(sizeof(uint64_t) * v->Size()));
401 for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr) {
402 typedef Hasher<EncodingType, MemoryPoolAllocator<> > EnumHasherType;
403 char buffer[256 + 24];
404 MemoryPoolAllocator<> hasherAllocator(buffer, sizeof(buffer));
405 EnumHasherType h(&hasherAllocator, 256);
406 itr->Accept(h);
407 enum_[enumCount_++] = h.GetHashCode();

Callers

nothing calls this directly

Calls 14

IsStringMethod · 0.80
BeginMethod · 0.80
CreateSchemaMethod · 0.80
MemberBeginMethod · 0.80
MemberEndMethod · 0.80
MemberCountMethod · 0.80
GetDoubleMethod · 0.80
IsArrayMethod · 0.45
EndMethod · 0.45
SizeMethod · 0.45
MallocMethod · 0.45
GetHashCodeMethod · 0.45

Tested by

no test coverage detected