TypeBrowserModel Class Reference

Public Slots

void markDirty ()
 
void notifyRefresh ()
 

Signals

void updatesAboutToHappen ()
 
void updateComplete (bool didAnyHappen)
 

Public Member Functions

 TypeBrowserModel (BinaryViewRef data, QObject *parent)
 
virtual ~TypeBrowserModel ()
 
BinaryViewRef getData ()
 
std::shared_ptr< TypeBrowserTreeNodegetRootNode ()
 
std::vector< std::string > containerIds () const
 
std::vector< std::shared_ptr< TypeContainerTreeNode > > containerNodes () const
 
std::string nameForContainerId (const std::string &id) const
 
std::optional< std::reference_wrapper< BinaryNinja::TypeContainer > > containerForContainerId (const std::string &id)
 
std::optional< std::reference_wrapper< const BinaryNinja::TypeContainer > > containerForContainerId (const std::string &id) const
 
std::optional< BinaryViewRefviewForContainerId (const std::string &id) const
 
std::optional< TypeArchiveRefarchiveForContainerId (const std::string &id) const
 
std::optional< std::string > archiveIdForContainerId (const std::string &id) const
 
std::optional< TypeLibraryReflibraryForContainerId (const std::string &id) const
 
std::optional< DebugInfoRefdebugInfoForContainerId (const std::string &id) const
 
std::optional< PlatformRefplatformForContainerId (const std::string &id) const
 
void updateFonts ()
 
void runAfterUpdate (std::function< void()> callback)
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
std::shared_ptr< TypeBrowserTreeNodenodeForIndex (const QModelIndex &index) const
 
QModelIndex indexForNode (std::shared_ptr< TypeBrowserTreeNode > node, int column=0) const
 
bool filter (const QModelIndex &index, const std::string &filter, TypeBrowserFilterMode mode) const
 
bool lessThan (const QModelIndex &left, const QModelIndex &right) const
 
void OnTypeDefined (BinaryNinja::BinaryView *data, const BinaryNinja::QualifiedName &name, BinaryNinja::Type *type) override
 
void OnTypeUndefined (BinaryNinja::BinaryView *data, const BinaryNinja::QualifiedName &name, BinaryNinja::Type *type) override
 
void OnTypeReferenceChanged (BinaryNinja::BinaryView *data, const BinaryNinja::QualifiedName &name, BinaryNinja::Type *type) override
 
void OnTypeFieldReferenceChanged (BinaryNinja::BinaryView *data, const BinaryNinja::QualifiedName &name, uint64_t offset) override
 
void OnTypeAdded (TypeArchiveRef archive, const std::string &id, TypeRef definition) override
 
void OnTypeUpdated (TypeArchiveRef archive, const std::string &id, TypeRef oldDefinition, TypeRef newDefinition) override
 
void OnTypeRenamed (TypeArchiveRef archive, const std::string &id, const BinaryNinja::QualifiedName &oldName, const BinaryNinja::QualifiedName &newName) override
 
void OnTypeDeleted (TypeArchiveRef archive, const std::string &id, TypeRef definition) override
 
void OnTypeArchiveAttached (BinaryNinja::BinaryView *data, const std::string &id, const std::string &path) override
 This notification is posted whenever a Type Archive is attached to a Binary View. More...
 
void OnTypeArchiveDetached (BinaryNinja::BinaryView *data, const std::string &id, const std::string &path) override
 This notification is posted whenever a Type Archive is detached to a Binary View. More...
 
void OnTypeArchiveConnected (BinaryNinja::BinaryView *data, BinaryNinja::TypeArchive *archive) override
 This notification is posted whenever a previously disconnected Type Archive attached to the Binary View is connected. More...
 
void OnTypeArchiveDisconnected (BinaryNinja::BinaryView *data, BinaryNinja::TypeArchive *archive) override
 This notification is posted whenever a previously connected Type Archive attached to the Binary View is disconnected. More...
 
- Public Member Functions inherited from BinaryNinja::BinaryDataNotification
 BinaryDataNotification ()
 
 BinaryDataNotification (NotificationTypes notifications)
 
virtual ~BinaryDataNotification ()
 
BNBinaryDataNotificationGetCallbacks ()
 
virtual uint64_t OnNotificationBarrier (BinaryView *view)
 
virtual void OnBinaryDataWritten (BinaryView *view, uint64_t offset, size_t len)
 
virtual void OnBinaryDataInserted (BinaryView *view, uint64_t offset, size_t len)
 
virtual void OnBinaryDataRemoved (BinaryView *view, uint64_t offset, uint64_t len)
 
virtual void OnAnalysisFunctionAdded (BinaryView *view, Function *func)
 
virtual void OnAnalysisFunctionRemoved (BinaryView *view, Function *func)
 
virtual void OnAnalysisFunctionUpdated (BinaryView *view, Function *func)
 
virtual void OnAnalysisFunctionUpdateRequested (BinaryView *view, Function *func)
 
virtual void OnDataVariableAdded (BinaryView *view, const DataVariable &var)
 
virtual void OnDataVariableRemoved (BinaryView *view, const DataVariable &var)
 
virtual void OnDataVariableUpdated (BinaryView *view, const DataVariable &var)
 
virtual void OnDataMetadataUpdated (BinaryView *view, uint64_t offset)
 
virtual void OnTagTypeUpdated (BinaryView *view, Ref< TagType > tagTypeRef)
 
virtual void OnTagAdded (BinaryView *view, const TagReference &tagRef)
 
virtual void OnTagRemoved (BinaryView *view, const TagReference &tagRef)
 
virtual void OnTagUpdated (BinaryView *view, const TagReference &tagRef)
 
virtual void OnSymbolAdded (BinaryView *view, Symbol *sym)
 
virtual void OnSymbolRemoved (BinaryView *view, Symbol *sym)
 
virtual void OnSymbolUpdated (BinaryView *view, Symbol *sym)
 
virtual void OnStringFound (BinaryView *data, BNStringType type, uint64_t offset, size_t len)
 
virtual void OnStringRemoved (BinaryView *data, BNStringType type, uint64_t offset, size_t len)
 
virtual void OnTypeDefined (BinaryView *data, const QualifiedName &name, Type *type)
 
virtual void OnTypeUndefined (BinaryView *data, const QualifiedName &name, Type *type)
 
virtual void OnTypeReferenceChanged (BinaryView *data, const QualifiedName &name, Type *type)
 
virtual void OnTypeFieldReferenceChanged (BinaryView *data, const QualifiedName &name, uint64_t offset)
 
virtual void OnSegmentAdded (BinaryView *data, Segment *segment)
 
virtual void OnSegmentRemoved (BinaryView *data, Segment *segment)
 
virtual void OnSegmentUpdated (BinaryView *data, Segment *segment)
 
virtual void OnSectionAdded (BinaryView *data, Section *section)
 
virtual void OnSectionRemoved (BinaryView *data, Section *section)
 
virtual void OnSectionUpdated (BinaryView *data, Section *section)
 
virtual void OnComponentNameUpdated (BinaryView *data, std::string &previousName, Component *component)
 This notification is posted after the display name for a component is updated. More...
 
virtual void OnComponentAdded (BinaryView *data, Component *component)
 This notification is posted after a Component is added to the tree. More...
 
virtual void OnComponentRemoved (BinaryView *data, Component *formerParent, Component *component)
 This notification is posted after a Component is removed from the tree. More...
 
virtual void OnComponentMoved (BinaryView *data, Component *formerParent, Component *newParent, Component *component)
 This notification is posted whenever a component is moved from one component to another. More...
 
virtual void OnComponentFunctionAdded (BinaryView *data, Component *component, Function *function)
 This notification is posted whenever a Function is added to a Component. More...
 
virtual void OnComponentFunctionRemoved (BinaryView *data, Component *component, Function *function)
 This notification is posted whenever a Function is removed from a Component. More...
 
virtual void OnComponentDataVariableAdded (BinaryView *data, Component *component, const DataVariable &var)
 This notification is posted whenever a DataVariable is added to a Component. More...
 
virtual void OnComponentDataVariableRemoved (BinaryView *data, Component *component, const DataVariable &var)
 This notification is posted whenever a DataVariable is removed from a Component. More...
 
virtual void OnExternalLibraryAdded (BinaryView *data, ExternalLibrary *library)
 
virtual void OnExternalLibraryRemoved (BinaryView *data, ExternalLibrary *library)
 
virtual void OnExternalLibraryUpdated (BinaryView *data, ExternalLibrary *library)
 
virtual void OnExternalLocationAdded (BinaryView *data, ExternalLocation *location)
 
virtual void OnExternalLocationRemoved (BinaryView *data, ExternalLocation *location)
 
virtual void OnExternalLocationUpdated (BinaryView *data, ExternalLocation *location)
 
virtual void OnTypeArchiveAttached (BinaryView *data, const std::string &id, const std::string &path)
 This notification is posted whenever a Type Archive is attached to a Binary View. More...
 
virtual void OnTypeArchiveDetached (BinaryView *data, const std::string &id, const std::string &path)
 This notification is posted whenever a Type Archive is detached to a Binary View. More...
 
virtual void OnTypeArchiveConnected (BinaryView *data, TypeArchive *archive)
 This notification is posted whenever a previously disconnected Type Archive attached to the Binary View is connected. More...
 
virtual void OnTypeArchiveDisconnected (BinaryView *data, TypeArchive *archive)
 This notification is posted whenever a previously connected Type Archive attached to the Binary View is disconnected. More...
 
virtual void OnUndoEntryAdded (BinaryView *data, UndoEntry *entry)
 This notification is posted whenever an entry is added to undo history. More...
 
virtual void OnUndoEntryTaken (BinaryView *data, UndoEntry *entry)
 This notification is posted whenever an action is undone. More...
 
virtual void OnRedoEntryTaken (BinaryView *data, UndoEntry *entry)
 This notification is posted whenever an action is redone. More...
 
virtual void OnRebased (BinaryView *oldView, BinaryView *newView)
 This notification is posted whenever a binary view is rebased. More...
 
- Public Member Functions inherited from BinaryNinja::TypeArchiveNotification
 TypeArchiveNotification ()
 
virtual ~TypeArchiveNotification ()=default
 
BNTypeArchiveNotificationGetCallbacks ()
 
virtual void OnTypeAdded (Ref< TypeArchive > archive, const std::string &id, Ref< Type > definition)
 Called when a type is added to the archive. More...
 
virtual void OnTypeUpdated (Ref< TypeArchive > archive, const std::string &id, Ref< Type > oldDefinition, Ref< Type > newDefinition)
 Called when a type in the archive is updated to a new definition. More...
 
virtual void OnTypeRenamed (Ref< TypeArchive > archive, const std::string &id, const QualifiedName &oldName, const QualifiedName &newName)
 Called when a type in the archive is renamed. More...
 
virtual void OnTypeDeleted (Ref< TypeArchive > archive, const std::string &id, Ref< Type > definition)
 Called when a type in the archive is deleted from the archive. More...
 

Additional Inherited Members

- Public Types inherited from BinaryNinja::BinaryDataNotification
enum  NotificationType : uint64_t {
  NotificationBarrier = 1ULL << 0 , DataWritten = 1ULL << 1 , DataInserted = 1ULL << 2 , DataRemoved = 1ULL << 3 ,
  FunctionAdded = 1ULL << 4 , FunctionRemoved = 1ULL << 5 , FunctionUpdated = 1ULL << 6 , FunctionUpdateRequested = 1ULL << 7 ,
  DataVariableAdded = 1ULL << 8 , DataVariableRemoved = 1ULL << 9 , DataVariableUpdated = 1ULL << 10 , DataMetadataUpdated = 1ULL << 11 ,
  TagTypeUpdated = 1ULL << 12 , TagAdded = 1ULL << 13 , TagRemoved = 1ULL << 14 , TagUpdated = 1ULL << 15 ,
  SymbolAdded = 1ULL << 16 , SymbolRemoved = 1ULL << 17 , SymbolUpdated = 1ULL << 18 , StringFound = 1ULL << 19 ,
  StringRemoved = 1ULL << 20 , TypeDefined = 1ULL << 21 , TypeUndefined = 1ULL << 22 , TypeReferenceChanged = 1ULL << 23 ,
  TypeFieldReferenceChanged = 1ULL << 24 , SegmentAdded = 1ULL << 25 , SegmentRemoved = 1ULL << 26 , SegmentUpdated = 1ULL << 27 ,
  SectionAdded = 1ULL << 28 , SectionRemoved = 1ULL << 29 , SectionUpdated = 1ULL << 30 , ComponentNameUpdated = 1ULL << 31 ,
  ComponentAdded = 1ULL << 32 , ComponentRemoved = 1ULL << 33 , ComponentMoved = 1ULL << 34 , ComponentFunctionAdded = 1ULL << 35 ,
  ComponentFunctionRemoved = 1ULL << 36 , ComponentDataVariableAdded = 1ULL << 37 , ComponentDataVariableRemoved = 1ULL << 38 , ExternalLibraryAdded = 1ULL << 39 ,
  ExternalLibraryRemoved = 1ULL << 40 , ExternalLibraryUpdated = 1ULL << 41 , ExternalLocationAdded = 1ULL << 42 , ExternalLocationRemoved = 1ULL << 43 ,
  ExternalLocationUpdated = 1ULL << 44 , TypeArchiveAttached = 1ULL << 45 , TypeArchiveDetached = 1ULL << 46 , TypeArchiveConnected = 1ULL << 47 ,
  TypeArchiveDisconnected = 1ULL << 48 , UndoEntryAdded = 1ULL << 49 , UndoEntryTaken = 1ULL << 50 , RedoEntryTaken = 1ULL << 51 ,
  Rebased = 1ULL << 52 , BinaryDataUpdates = DataWritten | DataInserted | DataRemoved , FunctionLifetime = FunctionAdded | FunctionRemoved , FunctionUpdates = FunctionLifetime | FunctionUpdated ,
  DataVariableLifetime = DataVariableAdded | DataVariableRemoved , DataVariableUpdates = DataVariableLifetime | DataVariableUpdated , TagLifetime = TagAdded | TagRemoved , TagUpdates = TagLifetime | TagUpdated ,
  SymbolLifetime = SymbolAdded | SymbolRemoved , SymbolUpdates = SymbolLifetime | SymbolUpdated , StringUpdates = StringFound | StringRemoved , TypeLifetime = TypeDefined | TypeUndefined ,
  TypeUpdates = TypeLifetime | TypeReferenceChanged | TypeFieldReferenceChanged , SegmentLifetime = SegmentAdded | SegmentRemoved , SegmentUpdates = SegmentLifetime | SegmentUpdated , SectionLifetime = SectionAdded | SectionRemoved ,
  SectionUpdates = SectionLifetime | SectionUpdated , ComponentUpdates = ComponentNameUpdated | ComponentAdded | ComponentRemoved | ComponentMoved | ComponentFunctionAdded | ComponentFunctionRemoved | ComponentDataVariableAdded | ComponentDataVariableRemoved , ExternalLibraryLifetime = ExternalLibraryAdded | ExternalLibraryRemoved , ExternalLibraryUpdates = ExternalLibraryLifetime | ExternalLibraryUpdated ,
  ExternalLocationLifetime = ExternalLocationAdded | ExternalLocationRemoved , ExternalLocationUpdates = ExternalLocationLifetime | ExternalLocationUpdated , TypeArchiveUpdates = TypeArchiveAttached | TypeArchiveDetached | TypeArchiveConnected | TypeArchiveDisconnected , UndoUpdates = UndoEntryAdded | UndoEntryTaken | RedoEntryTaken
}
 
using NotificationTypes = uint64_t
 

Constructor & Destructor Documentation

◆ TypeBrowserModel()

TypeBrowserModel::TypeBrowserModel ( BinaryViewRef  data,
QObject *  parent 
)

◆ ~TypeBrowserModel()

virtual TypeBrowserModel::~TypeBrowserModel ( )
virtual

Member Function Documentation

◆ getData()

BinaryViewRef TypeBrowserModel::getData ( )

◆ getRootNode()

std::shared_ptr< TypeBrowserTreeNode > TypeBrowserModel::getRootNode ( )

◆ containerIds()

std::vector< std::string > TypeBrowserModel::containerIds ( ) const

◆ containerNodes()

std::vector< std::shared_ptr< TypeContainerTreeNode > > TypeBrowserModel::containerNodes ( ) const

◆ nameForContainerId()

std::string TypeBrowserModel::nameForContainerId ( const std::string &  id) const

◆ containerForContainerId() [1/2]

std::optional< std::reference_wrapper< BinaryNinja::TypeContainer > > TypeBrowserModel::containerForContainerId ( const std::string &  id)

◆ containerForContainerId() [2/2]

std::optional< std::reference_wrapper< const BinaryNinja::TypeContainer > > TypeBrowserModel::containerForContainerId ( const std::string &  id) const

◆ viewForContainerId()

std::optional< BinaryViewRef > TypeBrowserModel::viewForContainerId ( const std::string &  id) const

◆ archiveForContainerId()

std::optional< TypeArchiveRef > TypeBrowserModel::archiveForContainerId ( const std::string &  id) const

◆ archiveIdForContainerId()

std::optional< std::string > TypeBrowserModel::archiveIdForContainerId ( const std::string &  id) const

◆ libraryForContainerId()

std::optional< TypeLibraryRef > TypeBrowserModel::libraryForContainerId ( const std::string &  id) const

◆ debugInfoForContainerId()

std::optional< DebugInfoRef > TypeBrowserModel::debugInfoForContainerId ( const std::string &  id) const

◆ platformForContainerId()

std::optional< PlatformRef > TypeBrowserModel::platformForContainerId ( const std::string &  id) const

◆ updateFonts()

void TypeBrowserModel::updateFonts ( )

◆ runAfterUpdate()

void TypeBrowserModel::runAfterUpdate ( std::function< void()>  callback)

◆ columnCount()

int TypeBrowserModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ rowCount()

int TypeBrowserModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ headerData()

QVariant TypeBrowserModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

◆ parent()

QModelIndex TypeBrowserModel::parent ( const QModelIndex &  child) const
override

◆ index()

QModelIndex TypeBrowserModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

◆ data()

QVariant TypeBrowserModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

◆ nodeForIndex()

std::shared_ptr< TypeBrowserTreeNode > TypeBrowserModel::nodeForIndex ( const QModelIndex &  index) const

◆ indexForNode()

QModelIndex TypeBrowserModel::indexForNode ( std::shared_ptr< TypeBrowserTreeNode node,
int  column = 0 
) const

◆ filter()

bool TypeBrowserModel::filter ( const QModelIndex &  index,
const std::string &  filter,
TypeBrowserFilterMode  mode 
) const

◆ lessThan()

bool TypeBrowserModel::lessThan ( const QModelIndex &  left,
const QModelIndex &  right 
) const

◆ OnTypeDefined()

void TypeBrowserModel::OnTypeDefined ( BinaryNinja::BinaryView data,
const BinaryNinja::QualifiedName name,
BinaryNinja::Type type 
)
overridevirtual

◆ OnTypeUndefined()

void TypeBrowserModel::OnTypeUndefined ( BinaryNinja::BinaryView data,
const BinaryNinja::QualifiedName name,
BinaryNinja::Type type 
)
overridevirtual

◆ OnTypeReferenceChanged()

void TypeBrowserModel::OnTypeReferenceChanged ( BinaryNinja::BinaryView data,
const BinaryNinja::QualifiedName name,
BinaryNinja::Type type 
)
overridevirtual

◆ OnTypeFieldReferenceChanged()

void TypeBrowserModel::OnTypeFieldReferenceChanged ( BinaryNinja::BinaryView data,
const BinaryNinja::QualifiedName name,
uint64_t  offset 
)
overridevirtual

◆ OnTypeAdded()

void TypeBrowserModel::OnTypeAdded ( TypeArchiveRef  archive,
const std::string &  id,
TypeRef  definition 
)
override

◆ OnTypeUpdated()

void TypeBrowserModel::OnTypeUpdated ( TypeArchiveRef  archive,
const std::string &  id,
TypeRef  oldDefinition,
TypeRef  newDefinition 
)
override

◆ OnTypeRenamed()

void TypeBrowserModel::OnTypeRenamed ( TypeArchiveRef  archive,
const std::string &  id,
const BinaryNinja::QualifiedName oldName,
const BinaryNinja::QualifiedName newName 
)
override

◆ OnTypeDeleted()

void TypeBrowserModel::OnTypeDeleted ( TypeArchiveRef  archive,
const std::string &  id,
TypeRef  definition 
)
override

◆ OnTypeArchiveAttached()

void TypeBrowserModel::OnTypeArchiveAttached ( BinaryNinja::BinaryView data,
const std::string &  id,
const std::string &  path 
)
overridevirtual

This notification is posted whenever a Type Archive is attached to a Binary View.

Parameters
dataBinaryView target
idId of the attached archive
pathPath on disk of the attached archive

Reimplemented from BinaryNinja::BinaryDataNotification.

◆ OnTypeArchiveDetached()

void TypeBrowserModel::OnTypeArchiveDetached ( BinaryNinja::BinaryView data,
const std::string &  id,
const std::string &  path 
)
overridevirtual

This notification is posted whenever a Type Archive is detached to a Binary View.

Parameters
dataBinaryView target
idId of the attached archive
pathPath on disk of the attached archive

Reimplemented from BinaryNinja::BinaryDataNotification.

◆ OnTypeArchiveConnected()

void TypeBrowserModel::OnTypeArchiveConnected ( BinaryNinja::BinaryView data,
BinaryNinja::TypeArchive archive 
)
overridevirtual

This notification is posted whenever a previously disconnected Type Archive attached to the Binary View is connected.

Parameters
dataBinaryView the archive is attached to
archiveAttached archive

Reimplemented from BinaryNinja::BinaryDataNotification.

◆ OnTypeArchiveDisconnected()

void TypeBrowserModel::OnTypeArchiveDisconnected ( BinaryNinja::BinaryView data,
BinaryNinja::TypeArchive archive 
)
overridevirtual

This notification is posted whenever a previously connected Type Archive attached to the Binary View is disconnected.

Parameters
dataBinaryView the archive is attached to
archivePreviously attached archive

Reimplemented from BinaryNinja::BinaryDataNotification.

◆ updatesAboutToHappen

void TypeBrowserModel::updatesAboutToHappen ( )
signal

◆ updateComplete

void TypeBrowserModel::updateComplete ( bool  didAnyHappen)
signal

◆ markDirty

void TypeBrowserModel::markDirty ( )
slot

◆ notifyRefresh

void TypeBrowserModel::notifyRefresh ( )
slot