summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh F <josh@vector35.com>2021-05-04 17:38:33 -0400
committerJosh F <josh@vector35.com>2021-05-05 22:10:42 -0400
commit6f101bc1aa5c9347d3bce928654928178d290789 (patch)
treece93dbf2437d48cbfa1f0965b36c22755d113814
parent05beb084e1973766202677bf85ee7a387bc7bc26 (diff)
Collapsible types
-rw-r--r--ui/typeview.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/typeview.h b/ui/typeview.h
index 1f8b4106..60b11703 100644
--- a/ui/typeview.h
+++ b/ui/typeview.h
@@ -11,6 +11,7 @@
#include <string>
#include <utility>
#include <vector>
+#include <unordered_set>
#include "binaryninjaapi.h"
#include "viewframe.h"
#include "render.h"
@@ -37,6 +38,7 @@ struct BINARYNINJAUIAPI TypeDefinitionLine
TypeDefinitionLineType lineType;
std::vector<BinaryNinja::InstructionTextToken> tokens;
TypeRef type, rootType;
+ std::string rootTypeName;
uint64_t offset;
size_t fieldIndex;
};
@@ -94,6 +96,7 @@ class BINARYNINJAUIAPI TypeView: public QAbstractScrollArea, public View, public
BinaryViewRef m_data;
ViewFrame* m_view;
TypesContainer* m_container;
+ std::unordered_set<std::string> m_collapsedTypes;
RenderContext m_render;
QWidget* m_lineNumberArea;
@@ -157,6 +160,8 @@ class BINARYNINJAUIAPI TypeView: public QAbstractScrollArea, public View, public
void checkForValidSelection();
+ static TypeDefinitionLine getTypeDefinitionHeaderLine(PlatformRef platform, const std::string& name, TypeRef type);
+
public:
explicit TypeView(BinaryViewRef data, ViewFrame* view, TypesContainer* container);
virtual ~TypeView();
@@ -214,9 +219,10 @@ public:
virtual ArchitectureRef getOrAskForArchitecture();
+ bool isTypeCollapsed(const std::string& name) const { return m_collapsedTypes.find(name) != m_collapsedTypes.end(); }
static std::vector<TypeDefinitionLine> getLinesForType(const std::string& name,
const std::string& varName, size_t index, TypeRef type, TypeRef parent, BinaryViewRef data,
- int paddingCols);
+ int paddingCols, bool collapsed = false);
protected:
virtual void resizeEvent(QResizeEvent* event) override;
@@ -247,6 +253,7 @@ private Q_SLOTS:
void addUserXref();
void updateLineNumberAreaWidth(size_t lineCount);
void focusFilter();
+ void toggleCollapseType();
};