From a45917bce4f35792d9cf1943cf3316e12ea55523 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Sun, 18 Mar 2018 14:47:17 -0400 Subject: Add api for getting total string output size of QualifiedName object --- binaryninjaapi.h | 4 +++- type.cpp | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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::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; -- cgit v1.3.1