BinaryNinja::TypePrinter Class Referenceabstract

Public Member Functions

virtual std::vector< InstructionTextTokenGetTypeTokens (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. More...
 
virtual std::vector< InstructionTextTokenGetTypeTokensBeforeName (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. More...
 
virtual std::vector< InstructionTextTokenGetTypeTokensAfterName (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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual std::vector< TypeDefinitionLineGetTypeLines (Ref< Type > type, Ref< BinaryView > data, const QualifiedName &name, int lineWidth=80, bool collapsed=false, BNTokenEscapingType escaping=NoTokenEscapingType)=0
 Generate a multi-line representation of a type. More...
 
- Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypePrinter >
 StaticCoreRefCountObject ()
 
virtual ~StaticCoreRefCountObject ()
 
BNTypePrinter * GetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 

Static Public Member Functions

static void Register (TypePrinter *printer)
 
static std::vector< Ref< TypePrinter > > GetList ()
 
static Ref< TypePrinterGetByName (const std::string &name)
 
static Ref< TypePrinterGetDefault ()
 
- Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypePrinter >
static BNTypePrinter * GetObject (StaticCoreRefCountObject *obj)
 

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, BNBinaryView *data, BNQualifiedName *name, int lineWidth, bool collapsed, BNTokenEscapingType escaping, BNTypeDefinitionLine **result, size_t *resultCount)
 
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)
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTypePrinter >
std::atomic< int > m_refs
 
BNTypePrinter * m_object
 

Constructor & Destructor Documentation

◆ TypePrinter() [1/2]

TypePrinter::TypePrinter ( const std::string &  name)
explicitprotected

◆ TypePrinter() [2/2]

TypePrinter::TypePrinter ( BNTypePrinter *  printer)
protected

Member Function Documentation

◆ FreeLinesCallback()

void TypePrinter::FreeLinesCallback ( void *  ctxt,
BNTypeDefinitionLine lines,
size_t  count 
)
staticprotected

◆ FreeStringCallback()

void TypePrinter::FreeStringCallback ( void *  ctxt,
char *  string 
)
staticprotected

◆ FreeTokensCallback()

void TypePrinter::FreeTokensCallback ( void *  ctxt,
BNInstructionTextToken tokens,
size_t  count 
)
staticprotected

◆ GetByName()

Ref< TypePrinter > TypePrinter::GetByName ( const std::string &  name)
static

◆ GetDefault()

Ref< TypePrinter > TypePrinter::GetDefault ( )
static

◆ GetList()

std::vector< Ref< TypePrinter > > TypePrinter::GetList ( )
static

◆ GetTypeLines()

virtual std::vector< TypeDefinitionLine > BinaryNinja::TypePrinter::GetTypeLines ( Ref< Type type,
Ref< BinaryView data,
const QualifiedName name,
int  lineWidth = 80,
bool  collapsed = false,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
pure virtual

Generate a multi-line representation of a type.

Parameters
typeType to print
dataBinary View in which the type is defined
nameName of the type
lineWidthMaximum width of lines, in characters
collapsedWhether to collapse structure/enum blocks
escapingStyle of escaping literals which may not be parsable
Returns
List of type definition lines

Implemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeLinesCallback()

bool TypePrinter::GetTypeLinesCallback ( void *  ctxt,
BNType *  type,
BNBinaryView *  data,
BNQualifiedName name,
int  lineWidth,
bool  collapsed,
BNTokenEscapingType  escaping,
BNTypeDefinitionLine **  result,
size_t *  resultCount 
)
staticprotected

◆ GetTypeString()

std::string TypePrinter::GetTypeString ( Ref< Type type,
Ref< Platform platform,
const QualifiedName name,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
virtual

Generate a single-line text representation of a type.

Parameters
typeType to print
platformPlatform responsible for this type
nameName of the type
escapingStyle of escaping literals which may not be parsable
Returns
String representing the type

Reimplemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeStringAfterName()

std::string TypePrinter::GetTypeStringAfterName ( Ref< Type type,
Ref< Platform platform,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
virtual

In a single-line text representation of a type, generate the string that should be printed after the type's name.

Parameters
typeType to print
platformPlatform responsible for this type
escapingStyle of escaping literals which may not be parsable
Returns
String representing the type

Reimplemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeStringAfterNameCallback()

bool TypePrinter::GetTypeStringAfterNameCallback ( void *  ctxt,
BNType *  type,
BNPlatform *  platform,
BNTokenEscapingType  escaping,
char **  result 
)
staticprotected

◆ GetTypeStringBeforeName()

std::string TypePrinter::GetTypeStringBeforeName ( Ref< Type type,
Ref< Platform platform,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
virtual

In a single-line text representation of a type, generate the string that should be printed before the type's name.

Parameters
typeType to print
platformPlatform responsible for this type
escapingStyle of escaping literals which may not be parsable
Returns
String representing the type

Reimplemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeStringBeforeNameCallback()

bool TypePrinter::GetTypeStringBeforeNameCallback ( void *  ctxt,
BNType *  type,
BNPlatform *  platform,
BNTokenEscapingType  escaping,
char **  result 
)
staticprotected

◆ GetTypeStringCallback()

bool TypePrinter::GetTypeStringCallback ( void *  ctxt,
BNType *  type,
BNPlatform *  platform,
BNQualifiedName name,
BNTokenEscapingType  escaping,
char **  result 
)
staticprotected

◆ GetTypeTokens()

std::vector< InstructionTextToken > TypePrinter::GetTypeTokens ( Ref< Type type,
Ref< Platform platform,
const QualifiedName name,
uint8_t  baseConfidence = 255,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
virtual

Generate a single-line text representation of a type.

Parameters
typeType to print
platformPlatform responsible for this type
nameName of the type
baseConfidenceConfidence to use for tokens created for this type
escapingStyle of escaping literals which may not be parsable
Returns
List of text tokens representing the type

Reimplemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeTokensAfterName()

virtual std::vector< InstructionTextToken > BinaryNinja::TypePrinter::GetTypeTokensAfterName ( Ref< Type type,
Ref< Platform platform,
uint8_t  baseConfidence = 255,
Ref< Type parentType = nullptr,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
pure virtual

In a single-line text representation of a type, generate the tokens that should be printed after the type's name.

Parameters
typeType to print
platformPlatform responsible for this type
baseConfidenceConfidence to use for tokens created for this type
parentTypeType of the parent of this type, or nullptr
escapingStyle of escaping literals which may not be parsable
Returns
List of text tokens representing the type

Implemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeTokensAfterNameCallback()

bool TypePrinter::GetTypeTokensAfterNameCallback ( void *  ctxt,
BNType *  type,
BNPlatform *  platform,
uint8_t  baseConfidence,
BNType *  parentType,
BNTokenEscapingType  escaping,
BNInstructionTextToken **  result,
size_t *  resultCount 
)
staticprotected

◆ GetTypeTokensBeforeName()

virtual std::vector< InstructionTextToken > BinaryNinja::TypePrinter::GetTypeTokensBeforeName ( Ref< Type type,
Ref< Platform platform,
uint8_t  baseConfidence = 255,
Ref< Type parentType = nullptr,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)
pure virtual

In a single-line text representation of a type, generate the tokens that should be printed before the type's name.

Parameters
typeType to print
platformPlatform responsible for this type
baseConfidenceConfidence to use for tokens created for this type
parentTypeType of the parent of this type, or nullptr
escapingStyle of escaping literals which may not be parsable
Returns
List of text tokens representing the type

Implemented in BinaryNinja::CoreTypePrinter.

◆ GetTypeTokensBeforeNameCallback()

bool TypePrinter::GetTypeTokensBeforeNameCallback ( void *  ctxt,
BNType *  type,
BNPlatform *  platform,
uint8_t  baseConfidence,
BNType *  parentType,
BNTokenEscapingType  escaping,
BNInstructionTextToken **  result,
size_t *  resultCount 
)
staticprotected

◆ GetTypeTokensCallback()

bool TypePrinter::GetTypeTokensCallback ( void *  ctxt,
BNType *  type,
BNPlatform *  platform,
BNQualifiedName name,
uint8_t  baseConfidence,
BNTokenEscapingType  escaping,
BNInstructionTextToken **  result,
size_t *  resultCount 
)
staticprotected

◆ Register()

void TypePrinter::Register ( TypePrinter printer)
static

The documentation for this class was generated from the following files: