summaryrefslogtreecommitdiff
path: root/interaction.cpp
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-01-27 22:43:28 -0500
committerKyleMiles <krm504@nyu.edu>2022-01-28 00:24:06 -0500
commit6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch)
treedace4156d03148bcaf02df138ab4e0d93e61bc6f /interaction.cpp
parent519c9db22367f2659d1a54599fab47e6313be06e (diff)
Format All Files
Diffstat (limited to 'interaction.cpp')
-rw-r--r--interaction.cpp85
1 files changed, 41 insertions, 44 deletions
diff --git a/interaction.cpp b/interaction.cpp
index 2f808067..580e2a39 100644
--- a/interaction.cpp
+++ b/interaction.cpp
@@ -112,8 +112,8 @@ FormInputField FormInputField::DirectoryName(const string& prompt, const string&
}
-void InteractionHandler::ShowMarkdownReport(Ref<BinaryView> view, const string& title, const string& contents,
- const string& plainText)
+void InteractionHandler::ShowMarkdownReport(
+ Ref<BinaryView> view, const string& title, const string& contents, const string& plainText)
{
(void)contents;
if (plainText.size() != 0)
@@ -121,22 +121,18 @@ void InteractionHandler::ShowMarkdownReport(Ref<BinaryView> view, const string&
}
-void InteractionHandler::ShowHTMLReport(Ref<BinaryView> view, const string& title, const string&,
- const string& plainText)
+void InteractionHandler::ShowHTMLReport(
+ Ref<BinaryView> view, const string& title, const string&, const string& plainText)
{
if (plainText.size() != 0)
ShowPlainTextReport(view, title, plainText);
}
-void InteractionHandler::ShowGraphReport(Ref<BinaryView>, const std::string&, Ref<FlowGraph>)
-{
-}
+void InteractionHandler::ShowGraphReport(Ref<BinaryView>, const std::string&, Ref<FlowGraph>) {}
-void InteractionHandler::ShowReportCollection(const string&, Ref<ReportCollection>)
-{
-}
+void InteractionHandler::ShowReportCollection(const string&, Ref<ReportCollection>) {}
bool InteractionHandler::GetIntegerInput(int64_t& result, const string& prompt, const string& title)
@@ -164,8 +160,8 @@ bool InteractionHandler::GetIntegerInput(int64_t& result, const string& prompt,
}
-bool InteractionHandler::GetAddressInput(uint64_t& result, const string& prompt, const string& title,
- Ref<BinaryView>, uint64_t)
+bool InteractionHandler::GetAddressInput(
+ uint64_t& result, const string& prompt, const string& title, Ref<BinaryView>, uint64_t)
{
int64_t value;
if (!GetIntegerInput(value, prompt, title))
@@ -200,16 +196,16 @@ static void ShowPlainTextReportCallback(void* ctxt, BNBinaryView* view, const ch
}
-static void ShowMarkdownReportCallback(void* ctxt, BNBinaryView* view, const char* title, const char* contents,
- const char* plaintext)
+static void ShowMarkdownReportCallback(
+ void* ctxt, BNBinaryView* view, const char* title, const char* contents, const char* plaintext)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowMarkdownReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title, contents, plaintext);
}
-static void ShowHTMLReportCallback(void* ctxt, BNBinaryView* view, const char* title, const char* contents,
- const char* plaintext)
+static void ShowHTMLReportCallback(
+ void* ctxt, BNBinaryView* view, const char* title, const char* contents, const char* plaintext)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowHTMLReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title, contents, plaintext);
@@ -220,7 +216,7 @@ static void ShowGraphReportCallback(void* ctxt, BNBinaryView* view, const char*
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowGraphReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title,
- new CoreFlowGraph(BNNewFlowGraphReference(graph)));
+ new CoreFlowGraph(BNNewFlowGraphReference(graph)));
}
@@ -249,17 +245,17 @@ static bool GetIntegerInputCallback(void* ctxt, int64_t* result, const char* pro
}
-static bool GetAddressInputCallback(void* ctxt, uint64_t* result, const char* prompt, const char* title,
- BNBinaryView* view, uint64_t currentAddr)
+static bool GetAddressInputCallback(
+ void* ctxt, uint64_t* result, const char* prompt, const char* title, BNBinaryView* view, uint64_t currentAddr)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
- return handler->GetAddressInput(*result, prompt, title, view ? new BinaryView(BNNewViewReference(view)) : nullptr,
- currentAddr);
+ return handler->GetAddressInput(
+ *result, prompt, title, view ? new BinaryView(BNNewViewReference(view)) : nullptr, currentAddr);
}
-static bool GetChoiceInputCallback(void* ctxt, size_t* result, const char* prompt, const char* title,
- const char** choices, size_t count)
+static bool GetChoiceInputCallback(
+ void* ctxt, size_t* result, const char* prompt, const char* title, const char** choices, size_t count)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
vector<string> choiceStrs;
@@ -280,8 +276,8 @@ static bool GetOpenFileNameInputCallback(void* ctxt, char** result, const char*
}
-static bool GetSaveFileNameInputCallback(void* ctxt, char** result, const char* prompt, const char* ext,
- const char* defaultName)
+static bool GetSaveFileNameInputCallback(
+ void* ctxt, char** result, const char* prompt, const char* ext, const char* defaultName)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
string value;
@@ -327,8 +323,9 @@ static bool GetFormInputCallback(void* ctxt, BNFormInputField* fieldBuf, size_t
fields.push_back(FormInputField::Integer(fieldBuf[i].prompt));
break;
case AddressFormField:
- fields.push_back(FormInputField::Address(fieldBuf[i].prompt, fieldBuf[i].view ?
- new BinaryView(BNNewViewReference(fieldBuf[i].view)) : nullptr, fieldBuf[i].currentAddress));
+ fields.push_back(FormInputField::Address(fieldBuf[i].prompt,
+ fieldBuf[i].view ? new BinaryView(BNNewViewReference(fieldBuf[i].view)) : nullptr,
+ fieldBuf[i].currentAddress));
break;
case ChoiceFormField:
for (size_t j = 0; j < fieldBuf[i].count; j++)
@@ -339,7 +336,8 @@ static bool GetFormInputCallback(void* ctxt, BNFormInputField* fieldBuf, size_t
fields.push_back(FormInputField::OpenFileName(fieldBuf[i].prompt, fieldBuf[i].ext));
break;
case SaveFileNameFormField:
- fields.push_back(FormInputField::SaveFileName(fieldBuf[i].prompt, fieldBuf[i].ext, fieldBuf[i].defaultName));
+ fields.push_back(
+ FormInputField::SaveFileName(fieldBuf[i].prompt, fieldBuf[i].ext, fieldBuf[i].defaultName));
break;
case DirectoryNameFormField:
fields.push_back(FormInputField::DirectoryName(fieldBuf[i].prompt, fieldBuf[i].defaultName));
@@ -407,8 +405,8 @@ static bool GetFormInputCallback(void* ctxt, BNFormInputField* fieldBuf, size_t
}
-static BNMessageBoxButtonResult ShowMessageBoxCallback(void* ctxt, const char* title, const char* text,
- BNMessageBoxButtonSet buttons, BNMessageBoxIcon icon)
+static BNMessageBoxButtonResult ShowMessageBoxCallback(
+ void* ctxt, const char* title, const char* text, BNMessageBoxButtonSet buttons, BNMessageBoxIcon icon)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
return handler->ShowMessageBox(title, text, buttons, icon);
@@ -511,8 +509,7 @@ bool BinaryNinja::GetAddressInput(uint64_t& result, const string& prompt, const
}
-bool BinaryNinja::GetChoiceInput(size_t& idx, const string& prompt, const string& title,
- const vector<string>& choices)
+bool BinaryNinja::GetChoiceInput(size_t& idx, const string& prompt, const string& title, const vector<string>& choices)
{
const char** choiceStrs = new const char*[choices.size()];
for (size_t i = 0; i < choices.size(); i++)
@@ -534,8 +531,8 @@ bool BinaryNinja::GetOpenFileNameInput(string& result, const string& prompt, con
}
-bool BinaryNinja::GetSaveFileNameInput(string& result, const string& prompt, const string& ext,
- const string& defaultName)
+bool BinaryNinja::GetSaveFileNameInput(
+ string& result, const string& prompt, const string& ext, const string& defaultName)
{
char* value = nullptr;
if (!BNGetSaveFileNameInput(&value, prompt.c_str(), ext.c_str(), defaultName.c_str()))
@@ -661,8 +658,8 @@ bool BinaryNinja::GetFormInput(vector<FormInputField>& fields, const string& tit
}
-BNMessageBoxButtonResult BinaryNinja::ShowMessageBox(const string& title, const string& text,
- BNMessageBoxButtonSet buttons, BNMessageBoxIcon icon)
+BNMessageBoxButtonResult BinaryNinja::ShowMessageBox(
+ const string& title, const string& text, BNMessageBoxButtonSet buttons, BNMessageBoxIcon icon)
{
return BNShowMessageBox(title.c_str(), text.c_str(), buttons, icon);
}
@@ -749,19 +746,19 @@ void ReportCollection::AddPlainTextReport(Ref<BinaryView> view, const string& ti
}
-void ReportCollection::AddMarkdownReport(Ref<BinaryView> view, const string& title, const string& contents,
- const string& plainText)
+void ReportCollection::AddMarkdownReport(
+ Ref<BinaryView> view, const string& title, const string& contents, const string& plainText)
{
- BNAddMarkdownReportToCollection(m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str(),
- plainText.c_str());
+ BNAddMarkdownReportToCollection(
+ m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str(), plainText.c_str());
}
-void ReportCollection::AddHTMLReport(Ref<BinaryView> view, const string& title, const string& contents,
- const string& plainText)
+void ReportCollection::AddHTMLReport(
+ Ref<BinaryView> view, const string& title, const string& contents, const string& plainText)
{
- BNAddHTMLReportToCollection(m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str(),
- plainText.c_str());
+ BNAddHTMLReportToCollection(
+ m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str(), plainText.c_str());
}