component module¶
|
Components are objects that can contain Functions and other Components. |
- class Component(handle=None)[source]¶
Bases:
object
Components are objects that can contain Functions and other Components.
They can be queried for information about the functions contained within them.
Components have a Guid, which persistent across saves and loads of the database, and should be used for retrieving components when such is required and a reference to the Component cannot be held.
- add_component(component: Component) bool [source]¶
Move component to this component. This will remove it from the old parent.
- contains_component(component: Component) bool [source]¶
Check whether this component contains a component.
- get_referenced_data_variables(recursive=False)[source]¶
Get data variables referenced by this component
- Parameters:
recursive – Optional; Get all DataVariables referenced by this component and sub-components.
- Returns:
List of DataVariables
- get_referenced_types(recursive=False)[source]¶
Get Types referenced by this component
- Parameters:
recursive – Optional; Get all Types referenced by this component and sub-components.
- Returns:
List of Types
- remove_component(component: Component) bool [source]¶
Remove a component from the current component, moving it to the root.
This function has no effect when used from the root component. Use BinaryView.remove_component to Remove a component from the tree entirely.
- property components: List[Component]¶
components
is an iterator for all Components contained within this Component- Returns:
A list of components
- Example:
>>> for subcomp in component.components: ... print(repr(component))
- property data_variable_list¶
- property data_variables¶
- property function_list: List[Function]¶
function_list
List of all Functions contained within this Component- Warning:
.functions Should be used instead of this in any performance sensitive context.
- Returns:
A list of functions
- Example:
>>> for func in component.functions: ... print(func.name)
- property functions: Iterator[Function]¶
functions
is an iterator for all Functions contained within this Component- Returns:
An iterator containing Components
- Return type:
ComponentIterator
- Example:
>>> for func in component.functions: ... print(func.name)
- property name: str¶
Original name set for this component
- Note:
The .display_name property should be used for bv.get_component_by_path() lookups.
This can differ from the .display_name property if one of its sibling components has the same .original_name; In that case, .name will be an automatically generated unique name (e.g. “MyComponentName (1)”) while .original_name will remain what was originally set (e.g. “MyComponentName”)
If this component has a duplicate name and is moved to a component where none of its siblings share its name, the .name property will return the original “MyComponentName”
- property view¶