Classes | |
| struct | TokenActivationAction |
| The result of resolving a token into the behavior that activating it should perform. More... | |
| class | TokenNavigationHandler |
| Shared implementation of "activate the selected token", used by every view that renders tokens so that double-clicking a token and pressing the "Activate Selection" key behave identically everywhere. More... | |
Enumerations | |
| enum | TokenActivationType { NoTokenActivation , NavigateToAddressActivation , NavigateToTypeActivation , NavigateToGotoLabelActivation , NavigateToMatchingBraceActivation , DefineNameActivation , EditCommentActivation } |
| The kind of behavior that activating a token (by double-clicking it, or by pressing the "Activate Selection" key) should perform. More... | |
Functions | |
| std::optional< BinaryNinja::DerivedString > | getDerivedStringForToken (FunctionRef func, const BinaryNinja::InstructionTextToken &token) |
| Look up the derived string that a token refers to, if any. | |
| uint64_t | getAddressForStringToken (FunctionRef func, const BinaryNinja::InstructionTextToken &token) |
| Get the address that a string token refers to. | |
| bool | navigateToExternalLinkForAddress (BinaryViewRef data, uint64_t linkSourceAddr) |
| If the given address is an external symbol that is backed by another file in the project, open that file at the corresponding location. | |
| std::optional< uint64_t > | getNavigationTargetForLineTokens (const std::vector< BinaryNinja::InstructionTextToken > &tokens) |
| Find the single token on a line that can be navigated to, for use when no individual token is selected. | |
| struct TokenActivationAction |
The result of resolving a token into the behavior that activating it should perform.
Public Member Functions | |
| bool | isValid () const |
| bool | isNavigation () const |
| True for the actions that move the view somewhere, as opposed to those that edit the database. | |
| bool | isNavigationToAddress () const |
| True for actions that navigate to an address. | |
Public Attributes | |
| TokenActivationType | type = NoTokenActivation |
| uint64_t | address = 0 |
| Target address for NavigateToAddressActivation, or the label identifier for NavigateToGotoLabelActivation. | |
| std::string | typeName |
| Name of the type to show for NavigateToTypeActivation. | |
| uint64_t | typeOffset = 0 |
| Offset of the member to show for NavigateToTypeActivation. | |
|
inline |
| bool TokenActivationAction::isNavigation | ( | ) | const |
True for the actions that move the view somewhere, as opposed to those that edit the database.
Used to decide whether an entry point that only navigates should act.
| bool TokenActivationAction::isNavigationToAddress | ( | ) | const |
True for actions that navigate to an address.
| TokenActivationType TokenActivationAction::type = NoTokenActivation |
| uint64_t TokenActivationAction::address = 0 |
Target address for NavigateToAddressActivation, or the label identifier for NavigateToGotoLabelActivation.
| std::string TokenActivationAction::typeName |
Name of the type to show for NavigateToTypeActivation.
| uint64_t TokenActivationAction::typeOffset = 0 |
Offset of the member to show for NavigateToTypeActivation.
| class TokenNavigationHandler |
Shared implementation of "activate the selected token", used by every view that renders tokens so that double-clicking a token and pressing the "Activate Selection" key behave identically everywhere.
Views inherit from this alongside their widget and View base classes, provide the context that token resolution needs, and implement the handful of operations that are view specific.
Public Member Functions | |
| virtual | ~TokenNavigationHandler ()=default |
| TokenActivationAction | getActionForToken (const HighlightTokenState &highlight) |
| Resolve a token into the action that activating it should perform. | |
| TokenActivationAction | getActionForSelection (const HighlightTokenState &highlight) |
| Resolve the current selection into an action, falling back to the contents of the current line when no single token is selected. | |
| bool | activateSelectedToken (const HighlightTokenState &highlight, bool navigationOnly=false) |
| Perform the action for the current selection. | |
| bool | canActivateSelectedToken (const HighlightTokenState &highlight, bool navigationOnly=false) |
| Determine whether activateSelectedToken would do anything, for use as the validity check of an action. | |
| std::optional< uint64_t > | getNavigationAddressForSelectedToken (const HighlightTokenState &highlight) |
| Get the target address for the current selection if it is an action that navigates to an address. | |
| bool | canNavigateToAddressForSelectedToken (const HighlightTokenState &highlight) |
| Determine whether getNavigationAddressForSelectedToken would return an address to navigate to, for use as the validity check of an action. | |
Protected Member Functions | |
| virtual BinaryViewRef | getBinaryViewForTokenActivation ()=0 |
| The binary view that the tokens were rendered from. | |
| virtual QWidget * | getWidgetForTokenActivation ()=0 |
| The widget for this view. | |
| virtual View * | getViewForTokenActivation ()=0 |
| The view to navigate. | |
| virtual UIContext * | getUIContextForTokenActivation () |
| The context that owns the view. | |
| virtual ViewFrame * | getViewFrameForTokenActivation () |
| The view frame that owns the view. | |
| virtual FunctionRef | getFunctionForTokenActivation () |
| The function that the tokens were rendered from, if any. | |
| virtual std::optional< std::vector< BinaryNinja::InstructionTextToken > > | getTokensForLineWithSelection () |
| The tokens of the line containing the selection, used when no single token is selected. | |
| virtual TokenActivationAction | getActionForLineWithSelection () |
| An action to fall back on when neither the selected token nor the tokens on the line resolve to anything, such as navigating to the function that a header line describes. | |
| virtual void | navigateToTokenTarget (uint64_t addr)=0 |
| Navigate to an address within this view, or to wherever the user's preferences say that the address should be shown. | |
| virtual bool | navigateToTokenGotoLabel (uint64_t label) |
| Navigate to the line defining a goto label. | |
| virtual bool | navigateToTokenMatchingBrace () |
| Navigate to the brace matching the selected one. | |
| virtual void | defineNameForSelectedToken () |
| Rename the selected variable. | |
| virtual void | editCommentForSelectedToken () |
| Edit the selected comment. | |
|
virtualdefault |
| TokenActivationAction TokenNavigationHandler::getActionForToken | ( | const HighlightTokenState & | highlight | ) |
Resolve a token into the action that activating it should perform.
Returns an invalid action if the token is not one that can be activated.
| TokenActivationAction TokenNavigationHandler::getActionForSelection | ( | const HighlightTokenState & | highlight | ) |
Resolve the current selection into an action, falling back to the contents of the current line when no single token is selected.
| bool TokenNavigationHandler::activateSelectedToken | ( | const HighlightTokenState & | highlight, |
| bool | navigationOnly = false ) |
Perform the action for the current selection.
If navigationOnly is set, actions that edit the database (renaming a variable, editing a comment) are not performed. Returns true if an action was performed.
| bool TokenNavigationHandler::canActivateSelectedToken | ( | const HighlightTokenState & | highlight, |
| bool | navigationOnly = false ) |
Determine whether activateSelectedToken would do anything, for use as the validity check of an action.
| std::optional< uint64_t > TokenNavigationHandler::getNavigationAddressForSelectedToken | ( | const HighlightTokenState & | highlight | ) |
Get the target address for the current selection if it is an action that navigates to an address.
| bool TokenNavigationHandler::canNavigateToAddressForSelectedToken | ( | const HighlightTokenState & | highlight | ) |
Determine whether getNavigationAddressForSelectedToken would return an address to navigate to, for use as the validity check of an action.
|
protectedpure virtual |
The binary view that the tokens were rendered from.
Implemented in FlowGraphWidget.
|
protectedpure virtual |
The widget for this view.
Implemented in FlowGraphWidget.
|
protectedpure virtual |
The view to navigate.
Implemented in FlowGraphWidget.
|
protectedvirtual |
The context that owns the view.
|
protectedvirtual |
The view frame that owns the view.
|
inlineprotectedvirtual |
The function that the tokens were rendered from, if any.
Required to resolve tokens that refer to an IL expression, such as derived strings.
Reimplemented in FlowGraphWidget.
|
inlineprotectedvirtual |
The tokens of the line containing the selection, used when no single token is selected.
Reimplemented in FlowGraphWidget.
|
inlineprotectedvirtual |
An action to fall back on when neither the selected token nor the tokens on the line resolve to anything, such as navigating to the function that a header line describes.
|
protectedpure virtual |
Navigate to an address within this view, or to wherever the user's preferences say that the address should be shown.
Implemented in FlowGraphWidget.
|
inlineprotectedvirtual |
Navigate to the line defining a goto label.
Views without goto labels need not implement this.
Reimplemented in FlowGraphWidget.
|
inlineprotectedvirtual |
Navigate to the brace matching the selected one.
Views without braces need not implement this.
|
inlineprotectedvirtual |
Rename the selected variable.
Reimplemented in FlowGraphWidget.
|
inlineprotectedvirtual |
Edit the selected comment.
Reimplemented in FlowGraphWidget.
| enum TokenActivationType |
The kind of behavior that activating a token (by double-clicking it, or by pressing the "Activate Selection" key) should perform.
| std::optional< BinaryNinja::DerivedString > getDerivedStringForToken | ( | FunctionRef | func, |
| const BinaryNinja::InstructionTextToken & | token ) |
Look up the derived string that a token refers to, if any.
Only tokens rendered with DerivedStringReferenceTokenContext refer to a derived string.
| uint64_t getAddressForStringToken | ( | FunctionRef | func, |
| const BinaryNinja::InstructionTextToken & | token ) |
Get the address that a string token refers to.
For a derived string with a known location, this is the location backing the string (which is not where the token itself is rendered).
| bool navigateToExternalLinkForAddress | ( | BinaryViewRef | data, |
| uint64_t | linkSourceAddr ) |
If the given address is an external symbol that is backed by another file in the project, open that file at the corresponding location.
| std::optional< uint64_t > getNavigationTargetForLineTokens | ( | const std::vector< BinaryNinja::InstructionTextToken > & | tokens | ) |
Find the single token on a line that can be navigated to, for use when no individual token is selected.
Tokens are searched for in order of preference, and a category containing more than one candidate is treated as ambiguous rather than picking one arbitrarily.