summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2015-04-28 02:31:19 -0400
committerRusty Wagner <rusty@vector35.com>2015-04-28 02:31:19 -0400
commit4baa6fc4add2b1d9ff32d8eba67621dfdb1cbfd4 (patch)
tree716b9ddf505558b779c26d3ed35bacacc63d1f0c
parent26093c952f60de3c0510e76f28ccfc0290824eec (diff)
Implement renaming of functions with persistence and undo
-rw-r--r--binaryninjaapi.h5
-rw-r--r--binaryview.cpp12
-rw-r--r--databuffer.cpp14
3 files changed, 31 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index ecacba34..ce5e95ae 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -155,6 +155,9 @@ namespace BinaryNinja
bool LogToFile(BNLogLevel minimumLevel, const std::string& path, bool append = false);
void CloseLogs();
+ std::string EscapeString(const std::string& s);
+ std::string UnescapeString(const std::string& s);
+
class DataBuffer
{
BNDataBuffer* m_buffer;
@@ -397,6 +400,8 @@ namespace BinaryNinja
std::string GetFullName() const;
std::string GetRawName() const;
uint64_t GetAddress() const;
+ bool IsAutoDefined() const;
+ void SetAutoDefined(bool val);
};
struct ReferenceSource
diff --git a/binaryview.cpp b/binaryview.cpp
index d5776bc7..173e3e06 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -130,6 +130,18 @@ uint64_t Symbol::GetAddress() const
}
+bool Symbol::IsAutoDefined() const
+{
+ return BNIsSymbolAutoDefined(m_sym);
+}
+
+
+void Symbol::SetAutoDefined(bool val)
+{
+ BNSetSymbolAutoDefined(m_sym, val);
+}
+
+
BinaryView::BinaryView(const std::string& typeName, FileMetadata* file)
{
BNCustomBinaryView view;
diff --git a/databuffer.cpp b/databuffer.cpp
index 4bcd930b..6a0748b4 100644
--- a/databuffer.cpp
+++ b/databuffer.cpp
@@ -134,3 +134,17 @@ DataBuffer DataBuffer::FromEscapedString(const string& src)
{
return DataBuffer(BNDecodeEscapedString(src.c_str()));
}
+
+
+string BinaryNinja::EscapeString(const string& s)
+{
+ DataBuffer buffer(s.c_str(), s.size());
+ return buffer.ToEscapedString();
+}
+
+
+string BinaryNinja::UnescapeString(const string& s)
+{
+ DataBuffer buffer = DataBuffer::FromEscapedString(s);
+ return string((const char*)buffer.GetData(), buffer.GetLength());
+}