Skip to content

Commit c03957c

Browse files
committed
Fix and add code docs regarding FileMetadata view types vs view names
1 parent b9049f1 commit c03957c

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

binaryninjaapi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,14 +3176,14 @@ namespace BinaryNinja {
31763176

31773177
/*! Get the BinaryView for a specific View type
31783178

3179-
\param name View name. e.g. ``Linear:ELF``, ``Graph:PE``
3179+
\param name View type. e.g. ``ELF``, ``PE``
31803180
\return The BinaryView, if it exists
31813181
*/
31823182
BinaryNinja::Ref<BinaryNinja::BinaryView> GetViewOfType(const std::string& name);
31833183

3184-
/*! List of View names that exist within the current file
3184+
/*! List of View types that exist within the current file
31853185

3186-
\return List of View Names
3186+
\return List of View Types
31873187
*/
31883188
std::vector<std::string> GetExistingViews() const;
31893189

rust/src/file_metadata.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ impl FileMetadata {
200200
unsafe { BNGetCurrentOffset(self.handle) }
201201
}
202202

203+
/// Navigate to an offset for a specific view.
204+
///
205+
/// # Example
206+
///
207+
/// ```no_run
208+
/// use binaryninja::file_metadata::FileMetadata;
209+
/// # let file: FileMetadata = unimplemented!();
210+
/// file.navigate_to("Linear:Raw", 0x0).expect("Linear:Raw should always be present");
211+
/// ```
203212
pub fn navigate_to(&self, view: &str, offset: u64) -> Result<(), ()> {
204213
let view = view.to_cstr();
205214

@@ -212,6 +221,15 @@ impl FileMetadata {
212221
}
213222
}
214223

224+
/// Get the [`BinaryView`] for the view type.
225+
///
226+
/// # Example
227+
///
228+
/// ```no_run
229+
/// use binaryninja::file_metadata::FileMetadata;
230+
/// # let file: FileMetadata = unimplemented!();
231+
/// file.view_of_type("Raw").expect("Raw type should always be present");
232+
/// ```
215233
pub fn view_of_type(&self, view: &str) -> Option<Ref<BinaryView>> {
216234
let view = view.to_cstr();
217235

0 commit comments

Comments
 (0)