@@ -5858,11 +5858,12 @@ namespace BinaryNinja {
58585858 \param[in] text Text containing the type definition
58595859 \param[out] result Reference into which the resulting type and name will be written
58605860 \param[out] errors Reference to a list into which any parse errors will be written
5861- \param typesAllowRedefinition
5861+ \param[in] typesAllowRedefinition List of types whose names are allowed to be overwritten (legacy cruft?)
5862+ \param[in] importDependencies If Type Library / Type Archive types should be imported during parsing
58625863 \return Whether parsing was successful
58635864 */
58645865 bool ParseTypeString(const std::string& text, QualifiedNameAndType& result, std::string& errors,
5865- const std::set<QualifiedName>& typesAllowRedefinition = {});
5866+ const std::set<QualifiedName>& typesAllowRedefinition = {}, bool importDependencies = true );
58665867
58675868 /*! Parse an entire block of source into types, variables, and functions
58685869
@@ -5871,14 +5872,25 @@ namespace BinaryNinja {
58715872 \param[out] variables Reference to a list of QualifiedNames and Types the parsed variables will be writen to
58725873 \param[out] functions Reference to a list of QualifiedNames and Types the parsed functions will be writen to
58735874 \param[out] errors Reference to a list into which any parse errors will be written
5874- \param typesAllowRedefinition
5875+ \param[in] typesAllowRedefinition List of types whose names are allowed to be overwritten (legacy cruft?)
5876+ \param[in] importDependencies If Type Library / Type Archive types should be imported during parsing
58755877 \return Whether parsing was successful
58765878 */
58775879 bool ParseTypeString(const std::string& text, std::map<QualifiedName, Ref<Type>>& types,
58785880 std::map<QualifiedName, Ref<Type>>& variables, std::map<QualifiedName, Ref<Type>>& functions,
5879- std::string& errors, const std::set<QualifiedName>& typesAllowRedefinition = {});
5881+ std::string& errors, const std::set<QualifiedName>& typesAllowRedefinition = {}, bool importDependencies = true);
5882+
5883+ /*! Parse an entire block of source into a structure containing types, variables, and functions
5884+
5885+ \param[in] text Source code to parse
5886+ \param[out] result Reference to a TypeParserResult structure into which types, variables, and functions will be written
5887+ \param[out] errors Reference to a list into which any parse errors will be written
5888+ \param[in] typesAllowRedefinition List of types whose names are allowed to be overwritten (legacy cruft?)
5889+ \param[in] importDependencies If Type Library / Type Archive types should be imported during parsing
5890+ \return Whether parsing was successful
5891+ */
58805892 bool ParseTypesFromSource(const std::string& text, const std::vector<std::string>& options, const std::vector<std::string>& includeDirs, TypeParserResult& result,
5881- std::string& errors, const std::set<QualifiedName>& typesAllowRedefinition = {});
5893+ std::string& errors, const std::set<QualifiedName>& typesAllowRedefinition = {}, bool importDependencies = true );
58825894
58835895 /*! Type Container for all types (user and auto) in the BinaryView. Any auto types
58845896 modified through the Type Container will be converted into user types.
@@ -14572,22 +14584,22 @@ namespace BinaryNinja {
1457214584 static bool GetOptionTextCallback(void* ctxt, BNTypeParserOption option, const char* value, char** result);
1457314585 static bool PreprocessSourceCallback(void* ctxt,
1457414586 const char* source, const char* fileName, BNPlatform* platform,
14575- const BNQualifiedNameTypeAndId * existingTypes, size_t existingTypeCount ,
14587+ BNTypeContainer * existingTypes,
1457614588 const char* const* options, size_t optionCount,
1457714589 const char* const* includeDirs, size_t includeDirCount,
1457814590 char** output, BNTypeParserError** errors, size_t* errorCount
1457914591 );
1458014592 static bool ParseTypesFromSourceCallback(void* ctxt,
1458114593 const char* source, const char* fileName, BNPlatform* platform,
14582- const BNQualifiedNameTypeAndId * existingTypes, size_t existingTypeCount ,
14594+ BNTypeContainer * existingTypes,
1458314595 const char* const* options, size_t optionCount,
1458414596 const char* const* includeDirs, size_t includeDirCount,
1458514597 const char* autoTypeSource, BNTypeParserResult* result,
1458614598 BNTypeParserError** errors, size_t* errorCount
1458714599 );
1458814600 static bool ParseTypeStringCallback(void* ctxt,
1458914601 const char* source, BNPlatform* platform,
14590- const BNQualifiedNameTypeAndId * existingTypes, size_t existingTypeCount ,
14602+ BNTypeContainer * existingTypes,
1459114603 BNQualifiedNameAndType* result,
1459214604 BNTypeParserError** errors, size_t* errorCount
1459314605 );
@@ -14629,7 +14641,7 @@ namespace BinaryNinja {
1462914641 \param source Source code to process
1463014642 \param fileName Name of the file containing the source (does not need to exist on disk)
1463114643 \param platform Platform to assume the source is relevant to
14632- \param existingTypes Map of all existing types to use for parsing context
14644+ \param existingTypes Container of all existing types to use for parsing context
1463314645 \param options String arguments to pass as options, e.g. command line arguments
1463414646 \param includeDirs List of directories to include in the header search path
1463514647 \param output Reference to a string into which the preprocessed source will be written
@@ -14640,7 +14652,7 @@ namespace BinaryNinja {
1464014652 const std::string& source,
1464114653 const std::string& fileName,
1464214654 Ref<Platform> platform,
14643- const std::map<QualifiedName, TypeAndId>& existingTypes,
14655+ std::optional<TypeContainer> existingTypes,
1464414656 const std::vector<std::string>& options,
1464514657 const std::vector<std::string>& includeDirs,
1464614658 std::string& output,
@@ -14652,7 +14664,7 @@ namespace BinaryNinja {
1465214664 \param source Source code to parse
1465314665 \param fileName Name of the file containing the source (optional: exists on disk)
1465414666 \param platform Platform to assume the types are relevant to
14655- \param existingTypes Map of all existing types to use for parsing context
14667+ \param existingTypes Container of all existing types to use for parsing context
1465614668 \param options String arguments to pass as options, e.g. command line arguments
1465714669 \param includeDirs List of directories to include in the header search path
1465814670 \param autoTypeSource Optional source of types if used for automatically generated types
@@ -14664,7 +14676,7 @@ namespace BinaryNinja {
1466414676 const std::string& source,
1466514677 const std::string& fileName,
1466614678 Ref<Platform> platform,
14667- const std::map<QualifiedName, TypeAndId>& existingTypes,
14679+ std::optional<TypeContainer> existingTypes,
1466814680 const std::vector<std::string>& options,
1466914681 const std::vector<std::string>& includeDirs,
1467014682 const std::string& autoTypeSource,
@@ -14676,7 +14688,7 @@ namespace BinaryNinja {
1467614688 Parse an entire source file into types, variables, and functions
1467714689 \param fileName Name of the file on disk containing the source
1467814690 \param platform Platform to assume the types are relevant to
14679- \param existingTypes Map of all existing types to use for parsing context
14691+ \param existingTypes Container of all existing types to use for parsing context
1468014692 \param options String arguments to pass as options, e.g. command line arguments
1468114693 \param includeDirs List of directories to include in the header search path
1468214694 \param autoTypeSource Optional source of types if used for automatically generated types
@@ -14687,7 +14699,7 @@ namespace BinaryNinja {
1468714699 bool ParseTypesFromSourceFile(
1468814700 const std::string& fileName,
1468914701 Ref<Platform> platform,
14690- const std::map<QualifiedName, TypeAndId>& existingTypes,
14702+ std::optional<TypeContainer> existingTypes,
1469114703 const std::vector<std::string>& options,
1469214704 const std::vector<std::string>& includeDirs,
1469314705 const std::string& autoTypeSource,
@@ -14699,15 +14711,15 @@ namespace BinaryNinja {
1469914711 Parse a single type and name from a string containing their definition.
1470014712 \param source Source code to parse
1470114713 \param platform Platform to assume the types are relevant to
14702- \param existingTypes Map of all existing types to use for parsing context
14714+ \param existingTypes Container of all existing types to use for parsing context
1470314715 \param result Reference into which the resulting type and name will be written
1470414716 \param errors Reference to a list into which any parse errors will be written
1470514717 \return True if parsing was successful
1470614718 */
1470714719 virtual bool ParseTypeString(
1470814720 const std::string& source,
1470914721 Ref<Platform> platform,
14710- const std::map<QualifiedName, TypeAndId>& existingTypes,
14722+ std::optional<TypeContainer> existingTypes,
1471114723 QualifiedNameAndType& result,
1471214724 std::vector<TypeParserError>& errors
1471314725 ) = 0;
@@ -14728,7 +14740,7 @@ namespace BinaryNinja {
1472814740 const std::string& source,
1472914741 const std::string& fileName,
1473014742 Ref<Platform> platform,
14731- const std::map<QualifiedName, TypeAndId>& existingTypes,
14743+ std::optional<TypeContainer> existingTypes,
1473214744 const std::vector<std::string>& options,
1473314745 const std::vector<std::string>& includeDirs,
1473414746 std::string& output,
@@ -14739,7 +14751,7 @@ namespace BinaryNinja {
1473914751 const std::string& source,
1474014752 const std::string& fileName,
1474114753 Ref<Platform> platform,
14742- const std::map<QualifiedName, TypeAndId>& existingTypes,
14754+ std::optional<TypeContainer> existingTypes,
1474314755 const std::vector<std::string>& options,
1474414756 const std::vector<std::string>& includeDirs,
1474514757 const std::string& autoTypeSource,
@@ -14750,7 +14762,7 @@ namespace BinaryNinja {
1475014762 virtual bool ParseTypeString(
1475114763 const std::string& source,
1475214764 Ref<Platform> platform,
14753- const std::map<QualifiedName, TypeAndId>& existingTypes,
14765+ std::optional<TypeContainer> existingTypes,
1475414766 QualifiedNameAndType& result,
1475514767 std::vector<TypeParserError>& errors
1475614768 ) override;
@@ -17287,10 +17299,21 @@ namespace BinaryNinja {
1728717299 with knowledge of the types in the Type Container.
1728817300
1728917301 \param source Source code to parse
17302+ \param importDependencies If Type Library / Type Archive types should be imported during parsing
1729017303 \param result Reference into which the resulting type and name will be written
1729117304 \param errors Reference to a list into which any parse errors will be written
1729217305 \return True if parsing was successful
1729317306 */
17307+ bool ParseTypeString(
17308+ const std::string& source,
17309+ bool importDependencies,
17310+ QualifiedNameAndType& result,
17311+ std::vector<TypeParserError>& errors
17312+ );
17313+
17314+ /*!
17315+ \deprecated Use `ParseTypeString` with the extra `importDependencies` param
17316+ */
1729417317 bool ParseTypeString(
1729517318 const std::string& source,
1729617319 QualifiedNameAndType& result,
@@ -17305,10 +17328,25 @@ namespace BinaryNinja {
1730517328 \param options Optional string arguments to pass as options, e.g. command line arguments
1730617329 \param includeDirs Optional list of directories to include in the header search path
1730717330 \param autoTypeSource Optional source of types if used for automatically generated types
17331+ \param importDependencies If Type Library / Type Archive types should be imported during parsing
1730817332 \param result Reference to structure into which the results will be written
1730917333 \param errors Reference to a list into which any parse errors will be written
1731017334 \return True if successful
1731117335 */
17336+ bool ParseTypesFromSource(
17337+ const std::string& text,
17338+ const std::string& fileName,
17339+ const std::vector<std::string>& options,
17340+ const std::vector<std::string>& includeDirs,
17341+ const std::string& autoTypeSource,
17342+ bool importDependencies,
17343+ TypeParserResult& result,
17344+ std::vector<TypeParserError>& errors
17345+ );
17346+
17347+ /*!
17348+ \deprecated Use `ParseTypesFromSource` with the extra `importDependencies` param
17349+ */
1731217350 bool ParseTypesFromSource(
1731317351 const std::string& text,
1731417352 const std::string& fileName,
0 commit comments