From f5a88c57718d069f94e83941b315745b1e85ba0f Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sat, 6 Jun 2020 15:47:23 -0400 Subject: Add BinaryView.init documentation to mappedview.py example. --- python/examples/mappedview.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python') 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. -- cgit v1.3.1