summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-11-15 16:23:50 -0500
committerGlenn Smith <glenn@vector35.com>2022-11-16 13:57:49 -0500
commitacc1d309d20ac4414db230f52cd75d877084b969 (patch)
tree1eb9fc7d5fa2ed700c09f4500092b5240896a8be /binaryninjaapi.h
parent1e67c64787bf84c3fbb264ade6bff128ddcc548d (diff)
Add TypePrinter::PrintAllTypes to export C headers
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 8cb0a7b2..c59b554a 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -11766,6 +11766,8 @@ namespace BinaryNinja {
static bool GetTypeLinesCallback(void* ctxt, BNType* type, BNBinaryView* data,
BNQualifiedName* name, int lineWidth, bool collapsed,
BNTokenEscapingType escaping, BNTypeDefinitionLine** result, size_t* resultCount);
+ static bool PrintAllTypesCallback(void* ctxt, BNQualifiedName* names, BNType** types, size_t typeCount,
+ BNBinaryView* data, int lineWidth, 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);
@@ -11890,6 +11892,37 @@ namespace BinaryNinja {
bool collapsed = false,
BNTokenEscapingType escaping = NoTokenEscapingType
) = 0;
+
+ /*!
+ Print all types to a single big string, including headers, sections, etc
+ \param types All types to print
+ \param data Binary View in which all the types are defined
+ \param lineWidth Maximum width of lines, in characters
+ \param escaping Style of escaping literals which may not be parsable
+ \return All the types in a string
+ */
+ virtual std::string PrintAllTypes(
+ const std::vector<std::pair<QualifiedName, Ref<Type>>>& types,
+ Ref<BinaryView> data,
+ int lineWidth = 80,
+ BNTokenEscapingType escaping = NoTokenEscapingType
+ );
+
+ /*!
+ Default implementation of PrintAllTypes
+ Print all types to a single big string, including headers, sections, etc
+ \param types All types to print
+ \param data Binary View in which all the types are defined
+ \param lineWidth Maximum width of lines, in characters
+ \param escaping Style of escaping literals which may not be parsable
+ \return All the types in a string
+ */
+ std::string DefaultPrintAllTypes(
+ const std::vector<std::pair<QualifiedName, Ref<Type>>>& types,
+ Ref<BinaryView> data,
+ int lineWidth = 80,
+ BNTokenEscapingType escaping = NoTokenEscapingType
+ );
};
/*!
@@ -11919,6 +11952,8 @@ namespace BinaryNinja {
virtual std::vector<TypeDefinitionLine> GetTypeLines(Ref<Type> type,
Ref<BinaryView> data, const QualifiedName& name, int lineWidth,
bool collapsed, BNTokenEscapingType escaping) override;
+ virtual std::string PrintAllTypes(const std::vector<std::pair<QualifiedName, Ref<Type>>>& types,
+ Ref<BinaryView> data, int lineWidth, BNTokenEscapingType escaping) override;
};
// DownloadProvider