Public Member Functions

BinNavi.API.disassembly.View Class Reference

Represents a single view. More...

Inherits BinNavi::APIHelpers::ApiObject< INaviView >.

List of all members.

Public Member Functions

void addListener (final IViewListener listener)
 Adds a view listener.
void addTag (final Tag tag) throws CouldntSaveDataException
 Tags the view.
boolean close ()
 Closes the view.
CodeNode createCodeNode (final Function function, final List< Instruction > instructions)
 Creates a new code node.
ViewEdge createEdge (final ViewNode source, final ViewNode target, final EdgeType edgeType)
 Creates a new edge.
FunctionNode createFunctionNode (final Function function)
 Creates a new function node.
GroupNode createGroupNode (final String text, final List< ViewNode > elements)
 Creates a new group node.
ViewNode createNode (final ViewNode node)
 Clones an existing node.
TextNode createTextNode (final String text)
 Creates a new text node.
void deleteEdge (final ViewEdge edge)
 Deletes an edge.
void deleteNode (final ViewNode node)
 Deletes a node.
ViewContainer getContainer ()
 Returns the container of the view.
String getDescription ()
 Description of the view.
int getEdgeCount ()
 Number of edges.
ViewGraph getGraph ()
 Graph of the view.
GraphType getGraphType ()
 Graph type of the view.
String getName ()
 Name of the view.
int getNodeCount ()
 Number of nodes.
ReilFunction getReilCode () throws InternalTranslationException
 REIL code of the view.
List< TaggetTags ()
 Returns the tags of the view.
ViewType getType ()
 Type of the view.
boolean isLoaded ()
 Load state of the view.
void load () throws CouldntLoadDataException, PartialLoadException
 Loads the view.
void removeListener (final IViewListener listener)
 Removes a view listener.
void removeTag (final Tag tag) throws CouldntSaveDataException
 Untags the view.
void save () throws CouldntSaveDataException
 Saves the view.
void setDescription (final String description) throws CouldntSaveDataException
 Changes the view description.
void setName (final String name) throws CouldntSaveDataException
 Changes the view name.
String toString ()
 String representation of the view.

Detailed Description

Views are arbitrary graphs that can be displayed. In most cases views are either flowgraphs and callgraphs that can be shown in BinNavi. The nodes of a view are not limited to one kind though. A view can have different kinds of nodes and if you work on the nodes of a view you have to be aware of this.

Common node types are CodeNode objects which are the view equivalent of basic blocks and FunctionNode which are the equivalent of callgraph nodes.


Member Function Documentation

void BinNavi.API.disassembly.View.addListener ( final IViewListener  listener  ) 

Adds an object that is notified about changes in the view.

Parameters:
listener The listener object that is notified about changes in the view.
Exceptions:
IllegalArgumentException Thrown if the listener argument is null.
IllegalStateException Thrown if the listener object is already listening on the view.
void BinNavi.API.disassembly.View.addTag ( final Tag  tag  )  throws CouldntSaveDataException

Tags the view with a tag.

Parameters:
tag The tag used to tag the view.
Exceptions:
CouldntSaveDataException Thrown if the tag could not be stored in the database.
boolean BinNavi.API.disassembly.View.close (  ) 

Closed the view. This operation can be vetoed by other plugins or parts of BinNavi.

Returns:
True, if the view was closed. False, if the close operation was vetoed.
CodeNode BinNavi.API.disassembly.View.createCodeNode ( final Function  function,
final List< Instruction instructions 
)

Creates a code node in the view.

Parameters:
function The parent function of the code node. This argument is optional can can be null.
instructions The instructions that should be displayed in the code node.
Returns:
The created code node.
ViewEdge BinNavi.API.disassembly.View.createEdge ( final ViewNode  source,
final ViewNode  target,
final EdgeType  edgeType 
)

Creates an edge in the view.

Parameters:
source The source node of the edge.
target The target node of the edge.
edgeType The edge type of the edge.
Returns:
The created edge.
FunctionNode BinNavi.API.disassembly.View.createFunctionNode ( final Function  function  ) 

Creates a function node in the view.

Parameters:
function The function the function node represents.
Returns:
The created function node.
GroupNode BinNavi.API.disassembly.View.createGroupNode ( final String  text,
final List< ViewNode elements 
)

Creates a new group node in the view.

Parameters:
text Text that is shown when the group node is collapsed.
elements Nodes that belong to the group node.
Returns:
The created group node.
ViewNode BinNavi.API.disassembly.View.createNode ( final ViewNode  node  ) 

Creates a new view node by cloning an existing view node.

Parameters:
node The node to clone.
Returns:
The cloned node.
TextNode BinNavi.API.disassembly.View.createTextNode ( final String  text  ) 

Creates a new text node in the view.

Parameters:
text The text shown in the node.
Returns:
The created text node.
void BinNavi.API.disassembly.View.deleteEdge ( final ViewEdge  edge  ) 

Deletes an edge from the view.

Parameters:
edge The edge to delete.
void BinNavi.API.disassembly.View.deleteNode ( final ViewNode  node  ) 

Deletes a node from the view.

Parameters:
node The node to delete.
ViewContainer BinNavi.API.disassembly.View.getContainer (  ) 

Returns the container of the view. This can be either a project or a module.

Returns:
The container of the view.
String BinNavi.API.disassembly.View.getDescription (  ) 

Returns the description of the view.

Returns:
The description of the view.
int BinNavi.API.disassembly.View.getEdgeCount (  ) 

Returns the number of edges in the view. This function can be called if the view has not yet been loaded.

Returns:
The number of edges in the view.
ViewGraph BinNavi.API.disassembly.View.getGraph (  ) 

Returns the graph of the view. This is the visible part of the view that is displayed in the graph windows of BinNavi.

Returns:
The graph of the view.
Exceptions:
IllegalStateException Thrown if the view is not loaded.
GraphType BinNavi.API.disassembly.View.getGraphType (  ) 

Returns the type of the view graph. The graph of a view can either be a flowgraph (if all nodes of the graph are of type CodeNode), a callgraph (if all nodes of the graph are of type FunctionNode), or a mixed graph (if the graph contains arbitrarily mixed nodes).

Returns:
The type of the graph.
String BinNavi.API.disassembly.View.getName (  ) 

Returns the name of the view.

Returns:
The name of the view.
int BinNavi.API.disassembly.View.getNodeCount (  ) 

Returns the number of nodes in the view. This function can be called if the view has not yet been loaded.

Returns:
The number of nodes in the view.
ReilFunction BinNavi.API.disassembly.View.getReilCode (  )  throws InternalTranslationException

Converts the View to REIL code. This function can only be used if the view has already been loaded.

Using this function over manual translation via ReilTranslator has the advantage that REIL translation results are automatically cached. Subsequent uses of this function requires no additional re-translation of the view provided that nothing relevant (like added/removed code nodes) changed.

Returns:
The REIL representation of the view.
Exceptions:
InternalTranslationException Thrown if the REIL translation failed.
List<Tag> BinNavi.API.disassembly.View.getTags (  ) 

Returns all tags that are currently associated with the view.

Returns:
The tags of the view.
ViewType BinNavi.API.disassembly.View.getType (  ) 

Returns the type of the view. A view can be either native (i.e. an immutable view created by the importer) or non-native (i.e. a mutable view created by the user).

Returns:
The type of the view.
boolean BinNavi.API.disassembly.View.isLoaded (  ) 

Returns a flag that indicates whether the view data has been loaded from the database.

Returns:
True, if the view has been loaded. False, otherwise.
void BinNavi.API.disassembly.View.load (  )  throws CouldntLoadDataException, PartialLoadException

Loads the view data from the database.

Exceptions:
IllegalStateException Thrown if the view is already loaded.
CouldntLoadDataException Thrown if the data could not be loaded from the database.
PartialLoadException Thrown if the view could not be loaded because not all involved modules could be loaded.
void BinNavi.API.disassembly.View.removeListener ( final IViewListener  listener  ) 

Removes a listener object from the view.

Parameters:
listener The listener object to remove from the view.
Exceptions:
IllegalArgumentException Thrown if the listener argument is null.
IllegalStateException Thrown if the listener object was not listening on the database.
void BinNavi.API.disassembly.View.removeTag ( final Tag  tag  )  throws CouldntSaveDataException

Removes a tag from the view.

Parameters:
tag The tag to remove from the view.
Exceptions:
CouldntSaveDataException Thrown if the tag could not be removed from the view.
void BinNavi.API.disassembly.View.save (  )  throws CouldntSaveDataException

Saves the view to the database. Please note that only non-native views can be saved using this function.

Exceptions:
CouldntSaveDataException Thrown if the view could not be saved.
void BinNavi.API.disassembly.View.setDescription ( final String  description  )  throws CouldntSaveDataException

Changes the description of the view.

Parameters:
description The new description of the view.
Exceptions:
CouldntSaveDataException Thrown if the new description could not be saved to the database
void BinNavi.API.disassembly.View.setName ( final String  name  )  throws CouldntSaveDataException

Changes the name of the view.

Parameters:
name The new name of the view.
Exceptions:
CouldntSaveDataException Thrown if the new name could not be saved to the database
String BinNavi.API.disassembly.View.toString (  ) 

Returns the string representation of the view.

Returns:
The string representation of the view.