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

Method format

binaryninjaapi.cpp:561–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559
560
561fmt::format_context::iterator fmt::formatter<BinaryNinja::Metadata>::format(const BinaryNinja::Metadata& obj, format_context& ctx) const
562{
563 switch (obj.GetType())
564 {
565 default:
566 case InvalidDataType:
567 return fmt::format_to(ctx.out(), "(invalid)");
568 case BooleanDataType:
569 return fmt::format_to(ctx.out(), "{}", obj.GetBoolean());
570 case StringDataType:
571 return fmt::format_to(ctx.out(), "{}", obj.GetString());
572 case UnsignedIntegerDataType:
573 return fmt::format_to(ctx.out(), "{}", obj.GetUnsignedInteger());
574 case SignedIntegerDataType:
575 return fmt::format_to(ctx.out(), "{}", obj.GetSignedInteger());
576 case DoubleDataType:
577 return fmt::format_to(ctx.out(), "{}", obj.GetDouble());
578 case RawDataType:
579 return fmtByteString(obj.GetRaw(), ctx);
580 case KeyValueDataType:
581 {
582 *ctx.out()++ = '{';
583 bool first = true;
584 for (auto& [name, value]: obj.GetKeyValueStore())
585 {
586 if (!first)
587 {
588 *ctx.out()++ = ',';
589 *ctx.out()++ = ' ';
590 }
591 first = false;
592
593 fmtQuotedString(name, ctx);
594 *ctx.out()++ = ':';
595 *ctx.out()++ = ' ';
596 fmt::format_to(ctx.out(), "{}", value);
597 }
598 *ctx.out()++ = '}';
599 return ctx.out();
600 }
601 case ArrayDataType:
602 *ctx.out()++ = '[';
603 bool first = true;
604 for (auto& value: obj.GetArray())
605 {
606 if (!first)
607 {
608 *ctx.out()++ = ',';
609 *ctx.out()++ = ' ';
610 }
611 first = false;
612 fmt::format_to(ctx.out(), "{}", value);
613 }
614 *ctx.out()++ = ']';
615 return ctx.out();
616 }
617}
618

Callers 14

get_string_atMethod · 0.45
__str__Method · 0.45
__int__Method · 0.45
__str__Method · 0.45
_function_wrapperFunction · 0.45
__repr__Method · 0.45
__setitem__Method · 0.45
get_bininfoFunction · 0.45
print_syscallsFunction · 0.45
print_syscalls.pyFile · 0.45
iterateFunction · 0.45

Calls 11

fmtByteStringFunction · 0.85
fmtQuotedStringFunction · 0.85
GetBooleanMethod · 0.80
GetUnsignedIntegerMethod · 0.80
GetSignedIntegerMethod · 0.80
GetDoubleMethod · 0.80
GetKeyValueStoreMethod · 0.80
GetArrayMethod · 0.80
GetTypeMethod · 0.45
GetStringMethod · 0.45
GetRawMethod · 0.45

Tested by

no test coverage detected