summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2020-06-06 15:47:23 -0400
committerBrian Potchik <brian@vector35.com>2020-06-06 15:47:23 -0400
commitf5a88c57718d069f94e83941b315745b1e85ba0f (patch)
tree39e6176d2310b03eb45a6bf7cdcbbe10e8e3c56b /python
parente8b37b23c67fc05e3bf91f85c8dab16828fe95cc (diff)
Add BinaryView.init documentation to mappedview.py example.
Diffstat (limited to 'python')
-rw-r--r--python/examples/mappedview.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/examples/mappedview.py b/python/examples/mappedview.py
index f14ebb80..ff76374b 100644
--- a/python/examples/mappedview.py
+++ b/python/examples/mappedview.py
@@ -91,6 +91,15 @@ class MappedView(BinaryView):
return load_settings
def init(self):
+ # The BinaryView init method is invoked as part of the BinaryView creation process. This method is called under several different conditions:
+ # 1) When opening a file/bndb and no load options are provided.
+ # 2) When opening a file/bndb and load options are provided. e.g. 'Open with Options' in the UI, or get_view_of_file_with_options
+ # 3) When parsing a file to create an ephemeral BinaryView (self.parse_only == True) for the purpose of extracting header information.
+ # Note: The get_load_settings_for_data classmethod is optional. If provided, it's used to generate load options for the BinaryViewType.
+ # If not provided, then the default load options are automatically generated by the core, extracting information automatically from a parsed BinaryView.
+ # Notice the call to get_default_load_settings_for_data above in get_load_settings_for_data. This will force parsing a file to create an ephemeral BinaryView.
+ # It is also used as a convenience method to pre-populate a Settings object with relevant, generic loader settings that are tagged as 'readOnly'. It is the responsibility,
+ # of the BinaryViewType to communicate and enforce which settings are mutable.
if self.parse_only is True:
# Perform light-weight parsing to extract required information for load settings generation.
# A light-weight parsed view does not get finalized.