GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python API (6.0.10905)
  • C++ Documentation
  • architecture
  • basedetection
  • basicblock
  • binaryview
  • bncompleter
  • callingconvention
  • collaboration
  • commonil
  • component
  • constantrenderer
  • database
  • databuffer

This view

  • Original page
  • New address

GeezerVison is showing api.binary.ninja — typeprinter module — Binary Ninja API Documentation v6.0.10905

typeprinter module¶

Class

Description

binaryninja.typeprinter.CoreTypePrinter

Class for turning Type objects into strings and tokens.

binaryninja.typeprinter.TypePrinter

Class for turning Type objects into strings and tokens.

Function

Description

binaryninja.typeprinter.to_bytes

CoreTypePrinter¶

class CoreTypePrinter[source]¶

Bases: TypePrinter

get_type_lines(type: Type, container: TypeContainer, name: Iterable[str | bytes] | str | QualifiedName, padding_cols=64, collapsed=False, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[TypeDefinitionLine][source]¶

Generate a multi-line representation of a type

Parameters:
  • type (Type) – Type to print

  • container (TypeContainer) – Type Container containing the type and dependencies

  • name (Iterable[str | bytes] | str | QualifiedName) – Name of the type

  • padding_cols – Maximum number of bytes represented by each padding line

  • collapsed – Whether to collapse structure/enum blocks

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of type definition lines

Return type:

List[TypeDefinitionLine]

get_type_string(type: Type, platform: Platform | None = None, name: Iterable[str | bytes] | str | QualifiedName = '', escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

Generate a single-line text representation of a type

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • name (Iterable[str | bytes] | str | QualifiedName) – Name of the type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

String representing the type

Return type:

str

get_type_string_after_name(type: Type, platform: Platform | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

String representing the type

Return type:

str

get_type_string_before_name(type: Type, platform: Platform | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

String representing the type

Return type:

str

get_type_tokens(type: Type, platform: Platform | None = None, name: Iterable[str | bytes] | str | QualifiedName = '', base_confidence: int = 255, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[InstructionTextToken][source]¶

Generate a single-line text representation of a type

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • name (Iterable[str | bytes] | str | QualifiedName) – Name of the type

  • base_confidence (int) – Confidence to use for tokens created for this type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of text tokens representing the type

Return type:

List[InstructionTextToken]

get_type_tokens_after_name(type: Type, platform: Platform | None = None, base_confidence: int = 255, parent_type: Type | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[InstructionTextToken][source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • base_confidence (int) – Confidence to use for tokens created for this type

  • parent_type (Type | None) – Type of the parent of this type, or None

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of text tokens representing the type

Return type:

List[InstructionTextToken]

get_type_tokens_before_name(type: Type, platform: Platform | None = None, base_confidence: int = 255, parent_type: Type | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[InstructionTextToken][source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • base_confidence (int) – Confidence to use for tokens created for this type

  • parent_type (Type | None) – Type of the parent of this type, or None

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of text tokens representing the type

Return type:

List[InstructionTextToken]

print_all_types(types_: Sequence[Tuple[Iterable[str | bytes] | str | QualifiedName, Type]], data: BinaryView, padding_cols=64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

Print all types to a single big string, including headers, sections, etc

Parameters:
  • types – All types to print

  • data (BinaryView) – Binary View in which all the types are defined

  • padding_cols – Maximum number of bytes represented by each padding line

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

  • types_ (Sequence[Tuple[Iterable[str | bytes] | str | QualifiedName, Type]])

Returns:

All the types in a string

Return type:

str

TypePrinter¶

class TypePrinter[source]¶

Bases: object

Class for turning Type objects into strings and tokens.

__init__(handle=None)[source]¶
abstract get_type_lines(type: Type, container: TypeContainer, name: Iterable[str | bytes] | str | QualifiedName, padding_cols=64, collapsed=False, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[TypeDefinitionLine][source]¶

Generate a multi-line representation of a type

Parameters:
  • type (Type) – Type to print

  • container (TypeContainer) – Type Container containing the type and dependencies

  • name (Iterable[str | bytes] | str | QualifiedName) – Name of the type

  • padding_cols – Maximum number of bytes represented by each padding line

  • collapsed – Whether to collapse structure/enum blocks

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of type definition lines

Return type:

List[TypeDefinitionLine]

get_type_string(type: Type, platform: Platform | None = None, name: Iterable[str | bytes] | str | QualifiedName = '', escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

Generate a single-line text representation of a type

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • name (Iterable[str | bytes] | str | QualifiedName) – Name of the type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

String representing the type

Return type:

str

get_type_string_after_name(type: Type, platform: Platform | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

String representing the type

Return type:

str

get_type_string_before_name(type: Type, platform: Platform | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

String representing the type

Return type:

str

get_type_tokens(type: Type, platform: Platform | None = None, name: Iterable[str | bytes] | str | QualifiedName = '', base_confidence: int = 255, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[InstructionTextToken][source]¶

Generate a single-line text representation of a type

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • name (Iterable[str | bytes] | str | QualifiedName) – Name of the type

  • base_confidence (int) – Confidence to use for tokens created for this type

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of text tokens representing the type

Return type:

List[InstructionTextToken]

abstract get_type_tokens_after_name(type: Type, platform: Platform | None = None, base_confidence: int = 255, parent_type: Type | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[InstructionTextToken][source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • base_confidence (int) – Confidence to use for tokens created for this type

  • parent_type (Type | None) – Type of the parent of this type, or None

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of text tokens representing the type

Return type:

List[InstructionTextToken]

abstract get_type_tokens_before_name(type: Type, platform: Platform | None = None, base_confidence: int = 255, parent_type: Type | None = None, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → List[InstructionTextToken][source]¶

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

Parameters:
  • type (Type) – Type to print

  • platform (Platform | None) – Platform responsible for this type

  • base_confidence (int) – Confidence to use for tokens created for this type

  • parent_type (Type | None) – Type of the parent of this type, or None

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

List of text tokens representing the type

Return type:

List[InstructionTextToken]

print_all_types(types: Sequence[Tuple[Iterable[str | bytes] | str | QualifiedName, Type]], data: BinaryView, padding_cols=64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) → str[source]¶

Print all types to a single big string, including headers, sections, etc

Parameters:
  • types (Sequence[Tuple[Iterable[str | bytes] | str | QualifiedName, Type]]) – All types to print

  • data (BinaryView) – Binary View in which all the types are defined

  • padding_cols – Maximum number of bytes represented by each padding line

  • escaping (TokenEscapingType) – Style of escaping literals which may not be parsable

Returns:

All the types in a string

Return type:

str

register()[source]¶
name = None¶

to_bytes¶

to_bytes(field)[source]¶
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.