BinaryNinja::CoreTypeParser Class Reference

Public Member Functions

 CoreTypeParser (BNTypeParser *parser)
 
virtual ~CoreTypeParser ()
 
virtual bool PreprocessSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, const std::map< QualifiedName, TypeAndId > &existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, std::string &output, std::vector< TypeParserError > &errors) override
 Preprocess a block of source, returning the source that would be parsed. More...
 
virtual bool ParseTypesFromSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, const std::map< QualifiedName, TypeAndId > &existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors) override
 Parse an entire block of source into types, variables, and functions. More...
 
virtual bool ParseTypeString (const std::string &source, Ref< Platform > platform, const std::map< QualifiedName, TypeAndId > &existingTypes, QualifiedNameAndType &result, std::vector< TypeParserError > &errors) override
 Parse a single type and name from a string containing their definition. More...
 
virtual bool PreprocessSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, const std::map< QualifiedName, TypeAndId > &existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, std::string &output, std::vector< TypeParserError > &errors)=0
 Preprocess a block of source, returning the source that would be parsed. More...
 
virtual bool ParseTypesFromSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, const std::map< QualifiedName, TypeAndId > &existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors)=0
 Parse an entire block of source into types, variables, and functions. More...
 
virtual bool ParseTypeString (const std::string &source, Ref< Platform > platform, const std::map< QualifiedName, TypeAndId > &existingTypes, QualifiedNameAndType &result, std::vector< TypeParserError > &errors)=0
 Parse a single type and name from a string containing their definition. More...
 
- Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser >
 StaticCoreRefCountObject ()
 
virtual ~StaticCoreRefCountObject ()
 
BNTypeParser * GetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::TypeParser
static void Register (TypeParser *parser)
 
static std::vector< Ref< TypeParser > > GetList ()
 
static Ref< TypeParserGetByName (const std::string &name)
 
static Ref< TypeParserGetDefault ()
 
- Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser >
static BNTypeParser * GetObject (StaticCoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser >
std::atomic< int > m_refs
 
BNTypeParser * m_object
 
- Protected Member Functions inherited from BinaryNinja::TypeParser
 TypeParser (const std::string &name)
 
 TypeParser (BNTypeParser *parser)
 
- Static Protected Member Functions inherited from BinaryNinja::TypeParser
static bool PreprocessSourceCallback (void *ctxt, const char *source, const char *fileName, BNPlatform *platform, const BNQualifiedNameTypeAndId *existingTypes, size_t existingTypeCount, const char *const *options, size_t optionCount, const char *const *includeDirs, size_t includeDirCount, char **output, BNTypeParserError **errors, size_t *errorCount)
 
static bool ParseTypesFromSourceCallback (void *ctxt, const char *source, const char *fileName, BNPlatform *platform, const BNQualifiedNameTypeAndId *existingTypes, size_t existingTypeCount, const char *const *options, size_t optionCount, const char *const *includeDirs, size_t includeDirCount, const char *autoTypeSource, BNTypeParserResult *result, BNTypeParserError **errors, size_t *errorCount)
 
static bool ParseTypeStringCallback (void *ctxt, const char *source, BNPlatform *platform, const BNQualifiedNameTypeAndId *existingTypes, size_t existingTypeCount, BNQualifiedNameAndType *result, BNTypeParserError **errors, size_t *errorCount)
 
static void FreeStringCallback (void *ctxt, char *result)
 
static void FreeResultCallback (void *ctxt, BNTypeParserResult *result)
 
static void FreeErrorListCallback (void *ctxt, BNTypeParserError *errors, size_t errorCount)
 

Constructor & Destructor Documentation

◆ CoreTypeParser()

CoreTypeParser::CoreTypeParser ( BNTypeParser *  parser)

◆ ~CoreTypeParser()

virtual BinaryNinja::CoreTypeParser::~CoreTypeParser ( )
inlinevirtual

Member Function Documentation

◆ ParseTypesFromSource()

bool CoreTypeParser::ParseTypesFromSource ( const std::string &  source,
const std::string &  fileName,
Ref< Platform platform,
const std::map< QualifiedName, TypeAndId > &  existingTypes,
const std::vector< std::string > &  options,
const std::vector< std::string > &  includeDirs,
const std::string &  autoTypeSource,
TypeParserResult result,
std::vector< TypeParserError > &  errors 
)
overridevirtual

Parse an entire block of source into types, variables, and functions.

Parameters
sourceSource code to parse
fileNameName of the file containing the source (optional: exists on disk)
platformPlatform to assume the types are relevant to
existingTypesMap of all existing types to use for parsing context
optionsString arguments to pass as options, e.g. command line arguments
includeDirsList of directories to include in the header search path
autoTypeSourceOptional source of types if used for automatically generated types
resultReference to structure into which the results will be written
errorsReference to a list into which any parse errors will be written
Returns
True if parsing was successful

Implements BinaryNinja::TypeParser.

◆ ParseTypeString()

bool CoreTypeParser::ParseTypeString ( const std::string &  source,
Ref< Platform platform,
const std::map< QualifiedName, TypeAndId > &  existingTypes,
QualifiedNameAndType result,
std::vector< TypeParserError > &  errors 
)
overridevirtual

Parse a single type and name from a string containing their definition.

Parameters
sourceSource code to parse
platformPlatform to assume the types are relevant to
existingTypesMap of all existing types to use for parsing context
resultReference into which the resulting type and name will be written
errorsReference to a list into which any parse errors will be written
Returns
True if parsing was successful

Implements BinaryNinja::TypeParser.

◆ PreprocessSource()

bool CoreTypeParser::PreprocessSource ( const std::string &  source,
const std::string &  fileName,
Ref< Platform platform,
const std::map< QualifiedName, TypeAndId > &  existingTypes,
const std::vector< std::string > &  options,
const std::vector< std::string > &  includeDirs,
std::string &  output,
std::vector< TypeParserError > &  errors 
)
overridevirtual

Preprocess a block of source, returning the source that would be parsed.

Parameters
sourceSource code to process
fileNameName of the file containing the source (does not need to exist on disk)
platformPlatform to assume the source is relevant to
existingTypesMap of all existing types to use for parsing context
optionsString arguments to pass as options, e.g. command line arguments
includeDirsList of directories to include in the header search path
outputReference to a string into which the preprocessed source will be written
errorsReference to a list into which any parse errors will be written
Returns
True if preprocessing was successful

Implements BinaryNinja::TypeParser.


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