summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-07-22 03:00:52 -0400
committerRusty Wagner <rusty@vector35.com>2016-07-22 03:00:52 -0400
commit13491e5eb8d50c242cf6858b111e404ea9f79239 (patch)
tree653ea1b2267ef67c1f8442516a0d9286e8fdf1ad /binaryview.cpp
parent5e15a16c95dd3e0b48ea0b319a813720f14fec5a (diff)
Add API to set type of function
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp
index ab519297..ee5bda8e 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -1338,6 +1338,26 @@ vector<LinearDisassemblyLine> BinaryView::GetNextLinearDisassemblyLines(LinearDi
}
+bool BinaryView::ParseTypeString(const string& text, NameAndType& result, string& errors)
+{
+ BNNameAndType nt;
+ char* errorStr;
+
+ if (!BNParseTypeString(m_object, text.c_str(), &nt, &errorStr))
+ {
+ errors = errorStr;
+ BNFreeString(errorStr);
+ return false;
+ }
+
+ result.name = nt.name;
+ result.type = new Type(nt.type);
+ errors = "";
+ BNFreeString(nt.name);
+ return true;
+}
+
+
BinaryData::BinaryData(FileMetadata* file): BinaryView(BNCreateBinaryDataView(file->GetObject()))
{
}