Binary Ninja API C++: TypePrinter
◆ BinaryNinja::TypePrinter
class BinaryNinja::TypePrinter
Public Member Functions | |
| virtual std::vector< InstructionTextToken > | GetTypeTokens (Ref< Type > type, Ref< Platform > platform, const QualifiedName &name, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) |
| Generate a single-line text representation of a type. | |
| virtual std::vector< InstructionTextToken > | GetTypeTokensBeforeName (Ref< Type > type, Ref< Platform > platform, uint8_t baseConfidence=255, Ref< Type > parentType=nullptr, BNTokenEscapingType escaping=NoTokenEscapingType)=0 |
| In a single-line text representation of a type, generate the tokens that should be printed before the type's name. | |
| virtual std::vector< InstructionTextToken > | GetTypeTokensAfterName (Ref< Type > type, Ref< Platform > platform, uint8_t baseConfidence=255, Ref< Type > parentType=nullptr, BNTokenEscapingType escaping=NoTokenEscapingType)=0 |
| In a single-line text representation of a type, generate the tokens that should be printed after the type's name. | |
| virtual std::string | GetTypeString (Ref< Type > type, Ref< Platform > platform, const QualifiedName &name, BNTokenEscapingType escaping=NoTokenEscapingType) |
| Generate a single-line text representation of a type. | |
| virtual std::string | GetTypeStringBeforeName (Ref< Type > type, Ref< Platform > platform, BNTokenEscapingType escaping=NoTokenEscapingType) |
| In a single-line text representation of a type, generate the string that should be printed before the type's name. | |
| virtual std::string | GetTypeStringAfterName (Ref< Type > type, Ref< Platform > platform, BNTokenEscapingType escaping=NoTokenEscapingType) |
| In a single-line text representation of a type, generate the string that should be printed after the type's name. | |
| virtual std::vector< TypeDefinitionLine > | GetTypeLines (Ref< Type > type, const TypeContainer &types, const QualifiedName &name, int paddingCols=64, bool collapsed=false, BNTokenEscapingType escaping=NoTokenEscapingType)=0 |
| Generate a multi-line representation of a type. | |
| virtual std::string | PrintAllTypes (const std::vector< std::pair< QualifiedName, Ref< Type > > > &types, Ref< BinaryView > data, int paddingCols=64, BNTokenEscapingType escaping=NoTokenEscapingType) |
| Print all types to a single big string, including headers, sections, etc. | |
| std::string | DefaultPrintAllTypes (const std::vector< std::pair< QualifiedName, Ref< Type > > > &types, Ref< BinaryView > data, int paddingCols=64, BNTokenEscapingType escaping=NoTokenEscapingType) |
| Default implementation of PrintAllTypes Print all types to a single big string, including headers, sections, etc. | |
| Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypePrinter > | |
| StaticCoreRefCountObject () | |
| virtual | ~StaticCoreRefCountObject () |
| BNTypePrinter * | GetObject () const |
| void | AddRef () |
| void | Release () |
| void | AddRefForRegistration () |
| void | AddRefForCallback () |
| void | ReleaseForCallback () |
Static Public Member Functions | |
| static void | Register (TypePrinter *printer) |
| static std::vector< Ref< TypePrinter > > | GetList () |
| static Ref< TypePrinter > | GetByName (const std::string &name) |
| static Ref< TypePrinter > | GetDefault () |
Protected Member Functions | |
| TypePrinter (const std::string &name) | |
| TypePrinter (BNTypePrinter *printer) | |
Static Protected Member Functions | |
| static bool | GetTypeTokensCallback (void *ctxt, BNType *type, BNPlatform *platform, BNQualifiedName *name, uint8_t baseConfidence, BNTokenEscapingType escaping, BNInstructionTextToken **result, size_t *resultCount) |
| static bool | GetTypeTokensBeforeNameCallback (void *ctxt, BNType *type, BNPlatform *platform, uint8_t baseConfidence, BNType *parentType, BNTokenEscapingType escaping, BNInstructionTextToken **result, size_t *resultCount) |
| static bool | GetTypeTokensAfterNameCallback (void *ctxt, BNType *type, BNPlatform *platform, uint8_t baseConfidence, BNType *parentType, BNTokenEscapingType escaping, BNInstructionTextToken **result, size_t *resultCount) |
| static bool | GetTypeStringCallback (void *ctxt, BNType *type, BNPlatform *platform, BNQualifiedName *name, BNTokenEscapingType escaping, char **result) |
| static bool | GetTypeStringBeforeNameCallback (void *ctxt, BNType *type, BNPlatform *platform, BNTokenEscapingType escaping, char **result) |
| static bool | GetTypeStringAfterNameCallback (void *ctxt, BNType *type, BNPlatform *platform, BNTokenEscapingType escaping, char **result) |
| static bool | GetTypeLinesCallback (void *ctxt, BNType *type, BNTypeContainer *types, BNQualifiedName *name, int paddingCols, bool collapsed, BNTokenEscapingType escaping, BNTypeDefinitionLine **result, size_t *resultCount) |
| static bool | PrintAllTypesCallback (void *ctxt, BNQualifiedName *names, BNType **types, size_t typeCount, BNBinaryView *data, int paddingCols, BNTokenEscapingType escaping, char **result) |
| static void | FreeTokensCallback (void *ctxt, BNInstructionTextToken *tokens, size_t count) |
| static void | FreeStringCallback (void *ctxt, char *string) |
| static void | FreeLinesCallback (void *ctxt, BNTypeDefinitionLine *lines, size_t count) |
|
explicitprotected |
◆ TypePrinter() [2/2]
◆ GetTypeTokensCallback()
◆ GetTypeTokensBeforeNameCallback()
◆ GetTypeTokensAfterNameCallback()
◆ GetTypeStringCallback()
◆ GetTypeStringBeforeNameCallback()
◆ GetTypeStringAfterNameCallback()
◆ GetTypeLinesCallback()
◆ PrintAllTypesCallback()
◆ FreeTokensCallback()
|
staticprotected |
◆ FreeStringCallback()
|
staticprotected |
◆ FreeLinesCallback()
|
staticprotected |
◆ Register()
|
static |
◆ GetList()
|
static |
◆ GetByName()
|
static |
◆ GetDefault()
|
static |
◆ GetTypeTokens()
Generate a single-line text representation of a type.
- Parameters
-
type Type to print platform Platform responsible for this type name Name of the type baseConfidence Confidence to use for tokens created for this type escaping Style of escaping literals which may not be parsable
- Returns
- List of text tokens representing the type
Reimplemented in BinaryNinja::CoreTypePrinter.
◆ GetTypeTokensBeforeName()
In a single-line text representation of a type, generate the tokens that should be printed before the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type baseConfidence Confidence to use for tokens created for this type parentType Type of the parent of this type, or nullptr escaping Style of escaping literals which may not be parsable
- Returns
- List of text tokens representing the type
Implemented in BinaryNinja::CoreTypePrinter.
◆ GetTypeTokensAfterName()
In a single-line text representation of a type, generate the tokens that should be printed after the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type baseConfidence Confidence to use for tokens created for this type parentType Type of the parent of this type, or nullptr escaping Style of escaping literals which may not be parsable
- Returns
- List of text tokens representing the type
Implemented in BinaryNinja::CoreTypePrinter.
◆ GetTypeString()
Generate a single-line text representation of a type.
- Parameters
-
type Type to print platform Platform responsible for this type name Name of the type escaping Style of escaping literals which may not be parsable
- Returns
- String representing the type
Reimplemented in BinaryNinja::CoreTypePrinter.
◆ GetTypeStringBeforeName()
In a single-line text representation of a type, generate the string that should be printed before the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type escaping Style of escaping literals which may not be parsable
- Returns
- String representing the type
Reimplemented in BinaryNinja::CoreTypePrinter.
◆ GetTypeStringAfterName()
In a single-line text representation of a type, generate the string that should be printed after the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type escaping Style of escaping literals which may not be parsable
- Returns
- String representing the type
Reimplemented in BinaryNinja::CoreTypePrinter.
◆ GetTypeLines()
Generate a multi-line representation of a type.
- Parameters
-
type Type to print types Type Container in which the type is defined name Name of the type paddingCols Maximum number of bytes represented by each padding line collapsed Whether to collapse structure/enum blocks escaping Style of escaping literals which may not be parsable
- Returns
- List of type definition lines
Implemented in BinaryNinja::CoreTypePrinter.
◆ PrintAllTypes()
Print all types to a single big string, including headers, sections, etc.
- Parameters
-
types All types to print data Binary View in which all the types are defined paddingCols Maximum number of bytes represented by each padding line escaping Style of escaping literals which may not be parsable
- Returns
- All the types in a string
Reimplemented in BinaryNinja::CoreTypePrinter.
◆ DefaultPrintAllTypes()
Default implementation of PrintAllTypes Print all types to a single big string, including headers, sections, etc.
- Parameters
-
types All types to print data Binary View in which all the types are defined paddingCols Maximum number of bytes represented by each padding line escaping Style of escaping literals which may not be parsable
- Returns
- All the types in a string
◆ BinaryNinja::CoreTypePrinter
class BinaryNinja::CoreTypePrinter
Public Member Functions | |
| CoreTypePrinter (BNTypePrinter *printer) | |
| virtual | ~CoreTypePrinter () |
| virtual std::vector< InstructionTextToken > | GetTypeTokens (Ref< Type > type, Ref< Platform > platform, const QualifiedName &name, uint8_t baseConfidence, BNTokenEscapingType escaping) override |
| Generate a single-line text representation of a type. | |
| virtual std::vector< InstructionTextToken > | GetTypeTokensBeforeName (Ref< Type > type, Ref< Platform > platform, uint8_t baseConfidence, Ref< Type > parentType, BNTokenEscapingType escaping) override |
| In a single-line text representation of a type, generate the tokens that should be printed before the type's name. | |
| virtual std::vector< InstructionTextToken > | GetTypeTokensAfterName (Ref< Type > type, Ref< Platform > platform, uint8_t baseConfidence, Ref< Type > parentType, BNTokenEscapingType escaping) override |
| In a single-line text representation of a type, generate the tokens that should be printed after the type's name. | |
| virtual std::string | GetTypeString (Ref< Type > type, Ref< Platform > platform, const QualifiedName &name, BNTokenEscapingType escaping) override |
| Generate a single-line text representation of a type. | |
| virtual std::string | GetTypeStringBeforeName (Ref< Type > type, Ref< Platform > platform, BNTokenEscapingType escaping) override |
| In a single-line text representation of a type, generate the string that should be printed before the type's name. | |
| virtual std::string | GetTypeStringAfterName (Ref< Type > type, Ref< Platform > platform, BNTokenEscapingType escaping) override |
| In a single-line text representation of a type, generate the string that should be printed after the type's name. | |
| virtual std::vector< TypeDefinitionLine > | GetTypeLines (Ref< Type > type, const TypeContainer &types, const QualifiedName &name, int paddingCols, bool collapsed, BNTokenEscapingType escaping) override |
| Generate a multi-line representation of a type. | |
| virtual std::string | PrintAllTypes (const std::vector< std::pair< QualifiedName, Ref< Type > > > &types, Ref< BinaryView > data, int paddingCols, BNTokenEscapingType escaping) override |
| Print all types to a single big string, including headers, sections, etc. | |
| Public Member Functions inherited from BinaryNinja::TypePrinter | |
| std::string | DefaultPrintAllTypes (const std::vector< std::pair< QualifiedName, Ref< Type > > > &types, Ref< BinaryView > data, int paddingCols=64, BNTokenEscapingType escaping=NoTokenEscapingType) |
| Default implementation of PrintAllTypes Print all types to a single big string, including headers, sections, etc. | |
| Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypePrinter > | |
| StaticCoreRefCountObject () | |
| virtual | ~StaticCoreRefCountObject () |
| BNTypePrinter * | GetObject () const |
| void | AddRef () |
| void | Release () |
| void | AddRefForRegistration () |
| void | AddRefForCallback () |
| void | ReleaseForCallback () |
Additional Inherited Members | |
| Static Public Member Functions inherited from BinaryNinja::TypePrinter | |
| static void | Register (TypePrinter *printer) |
| static std::vector< Ref< TypePrinter > > | GetList () |
| static Ref< TypePrinter > | GetByName (const std::string &name) |
| static Ref< TypePrinter > | GetDefault () |
| Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTypePrinter > | |
| std::atomic< int > | m_refs |
| BNTypePrinter * | m_object |
| Protected Member Functions inherited from BinaryNinja::TypePrinter | |
| TypePrinter (const std::string &name) | |
| TypePrinter (BNTypePrinter *printer) | |
| Static Protected Member Functions inherited from BinaryNinja::TypePrinter | |
| static bool | GetTypeTokensCallback (void *ctxt, BNType *type, BNPlatform *platform, BNQualifiedName *name, uint8_t baseConfidence, BNTokenEscapingType escaping, BNInstructionTextToken **result, size_t *resultCount) |
| static bool | GetTypeTokensBeforeNameCallback (void *ctxt, BNType *type, BNPlatform *platform, uint8_t baseConfidence, BNType *parentType, BNTokenEscapingType escaping, BNInstructionTextToken **result, size_t *resultCount) |
| static bool | GetTypeTokensAfterNameCallback (void *ctxt, BNType *type, BNPlatform *platform, uint8_t baseConfidence, BNType *parentType, BNTokenEscapingType escaping, BNInstructionTextToken **result, size_t *resultCount) |
| static bool | GetTypeStringCallback (void *ctxt, BNType *type, BNPlatform *platform, BNQualifiedName *name, BNTokenEscapingType escaping, char **result) |
| static bool | GetTypeStringBeforeNameCallback (void *ctxt, BNType *type, BNPlatform *platform, BNTokenEscapingType escaping, char **result) |
| static bool | GetTypeStringAfterNameCallback (void *ctxt, BNType *type, BNPlatform *platform, BNTokenEscapingType escaping, char **result) |
| static bool | GetTypeLinesCallback (void *ctxt, BNType *type, BNTypeContainer *types, BNQualifiedName *name, int paddingCols, bool collapsed, BNTokenEscapingType escaping, BNTypeDefinitionLine **result, size_t *resultCount) |
| static bool | PrintAllTypesCallback (void *ctxt, BNQualifiedName *names, BNType **types, size_t typeCount, BNBinaryView *data, int paddingCols, BNTokenEscapingType escaping, char **result) |
| static void | FreeTokensCallback (void *ctxt, BNInstructionTextToken *tokens, size_t count) |
| static void | FreeStringCallback (void *ctxt, char *string) |
| static void | FreeLinesCallback (void *ctxt, BNTypeDefinitionLine *lines, size_t count) |
◆ CoreTypePrinter()
◆ ~CoreTypePrinter()
|
inlinevirtual |
◆ GetTypeTokens()
Generate a single-line text representation of a type.
- Parameters
-
type Type to print platform Platform responsible for this type name Name of the type baseConfidence Confidence to use for tokens created for this type escaping Style of escaping literals which may not be parsable
- Returns
- List of text tokens representing the type
Reimplemented from BinaryNinja::TypePrinter.
◆ GetTypeTokensBeforeName()
In a single-line text representation of a type, generate the tokens that should be printed before the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type baseConfidence Confidence to use for tokens created for this type parentType Type of the parent of this type, or nullptr escaping Style of escaping literals which may not be parsable
- Returns
- List of text tokens representing the type
Implements BinaryNinja::TypePrinter.
◆ GetTypeTokensAfterName()
In a single-line text representation of a type, generate the tokens that should be printed after the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type baseConfidence Confidence to use for tokens created for this type parentType Type of the parent of this type, or nullptr escaping Style of escaping literals which may not be parsable
- Returns
- List of text tokens representing the type
Implements BinaryNinja::TypePrinter.
◆ GetTypeString()
Generate a single-line text representation of a type.
- Parameters
-
type Type to print platform Platform responsible for this type name Name of the type escaping Style of escaping literals which may not be parsable
- Returns
- String representing the type
Reimplemented from BinaryNinja::TypePrinter.
◆ GetTypeStringBeforeName()
In a single-line text representation of a type, generate the string that should be printed before the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type escaping Style of escaping literals which may not be parsable
- Returns
- String representing the type
Reimplemented from BinaryNinja::TypePrinter.
◆ GetTypeStringAfterName()
In a single-line text representation of a type, generate the string that should be printed after the type's name.
- Parameters
-
type Type to print platform Platform responsible for this type escaping Style of escaping literals which may not be parsable
- Returns
- String representing the type
Reimplemented from BinaryNinja::TypePrinter.
◆ GetTypeLines()
Generate a multi-line representation of a type.
- Parameters
-
type Type to print types Type Container in which the type is defined name Name of the type paddingCols Maximum number of bytes represented by each padding line collapsed Whether to collapse structure/enum blocks escaping Style of escaping literals which may not be parsable
- Returns
- List of type definition lines
Implements BinaryNinja::TypePrinter.
◆ PrintAllTypes()
Print all types to a single big string, including headers, sections, etc.
- Parameters
-
types All types to print data Binary View in which all the types are defined paddingCols Maximum number of bytes represented by each padding line escaping Style of escaping literals which may not be parsable
- Returns
- All the types in a string
Reimplemented from BinaryNinja::TypePrinter.