summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2018-03-18 14:47:17 -0400
committerPeter LaFosse <peter@vector35.com>2018-03-23 17:10:06 -0400
commita45917bce4f35792d9cf1943cf3316e12ea55523 (patch)
tree0fa995153d544fcdfc8d9e6f39db113e332da5d1
parent5ed96234690937b8487a79d11fc30e7bb39b48ec (diff)
Add api for getting total string output size of QualifiedName object
-rw-r--r--binaryninjaapi.h4
-rw-r--r--type.cpp9
2 files changed, 12 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 2d7e2ccf..d0c19e7a 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -680,8 +680,10 @@ namespace BinaryNinja
void erase(std::vector<std::string>::iterator i);
void clear();
void push_back(const std::string& name);
+ // Returns count of names
size_t size() const;
-
+ // Returns size of output string
+ size_t StringSize() const;
std::string GetString() const;
BNQualifiedName GetAPIObject() const;
diff --git a/type.cpp b/type.cpp
index 08b64713..0a91ae92 100644
--- a/type.cpp
+++ b/type.cpp
@@ -188,6 +188,15 @@ size_t QualifiedName::size() const
}
+size_t QualifiedName::StringSize() const
+{
+ size_t size = 0;
+ for (auto& name : m_name)
+ size += name.size() + 2;
+ return size - 2;
+}
+
+
string QualifiedName::GetString() const
{
bool first = true;