IDAPython 9.0
Loading...
Searching...
No Matches
dirtree_t Class Reference
Inheritance diagram for dirtree_t:

Public Member Functions

 __init__ (self, 'dirspec_t' ds)
 
bool is_orderable (self)
 
'dterr_t' chdir (self, str path)
 
str getcwd (self)
 
str get_abspath (self, *args)
 
'direntry_tresolve_cursor (self, 'dirtree_cursor_t' cursor)
 
'direntry_tresolve_path (self, str path)
 
bool isdir (self, *args)
 
bool isfile (self, *args)
 
str get_entry_name (self, 'direntry_t' de, int name_flags=DTN_FULL_NAME)
 
bool is_dir_ordered (self, 'diridx_t' diridx)
 
bool set_natural_order (self, 'diridx_t' diridx, bool enable)
 
'ssize_t' get_dir_size (self, 'diridx_t' diridx)
 
str get_entry_attrs (self, 'direntry_t' de)
 
bool findfirst (self, 'dirtree_iterator_t' ff, str pattern)
 
bool findnext (self, 'dirtree_iterator_t' ff)
 
'dterr_t' mkdir (self, str path)
 
'dterr_t' rmdir (self, str path)
 
'dterr_t' link (self, *args)
 
'dterr_t' unlink (self, *args)
 
'dterr_t' rename (self, str _from, str to)
 
'ssize_t' get_rank (self, 'diridx_t' diridx, 'direntry_t' de)
 
'dterr_t' change_rank (self, str path, 'ssize_t' rank_delta)
 
'dirtree_cursor_tget_parent_cursor (self, 'dirtree_cursor_t' cursor)
 
bool load (self)
 
bool save (self)
 
str get_id (self)
 
None set_id (self, str nm)
 
None notify_dirtree (self, bool added, 'inode_t' inode)
 
'ssize_t' traverse (self, 'dirtree_visitor_t' v)
 
'dirtree_cursor_tfind_entry (self, 'direntry_t' de)
 

Static Public Member Functions

str errstr ('dterr_t' err)
 

Static Public Attributes

str get_nodename = get_id
 
None set_nodename = set_id
 

Properties

 thisown
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
'dirspec_t' ds )

Member Function Documentation

◆ change_rank()

'dterr_t' change_rank ( self,
str path,
'ssize_t' rank_delta )
Change ordering rank of an item. 

@param path: path to the item
@param rank_delta: the amount of the change. positive numbers mean to move down in the list; negative numbers mean to move up.
@returns dterr_t error code

◆ chdir()

'dterr_t' chdir ( self,
str path )
Change current directory 

@param path: new current directory
@returns dterr_t error code

◆ errstr()

str errstr ( 'dterr_t' err)
static
Get textual representation of the error code.

◆ find_entry()

'dirtree_cursor_t' find_entry ( self,
'direntry_t' de )
Find the cursor corresponding to an entry of a directory 

@param de: directory entry
@returns cursor corresponding to the directory entry

◆ findfirst()

bool findfirst ( self,
'dirtree_iterator_t' ff,
str pattern )
Start iterating over files in a directory 

@param ff: directory iterator. it will be initialized by the function
@param pattern: pattern to search for
@returns success

◆ findnext()

bool findnext ( self,
'dirtree_iterator_t' ff )
Continue iterating over files in a directory 

@param ff: directory iterator
@returns success

◆ get_abspath()

str get_abspath ( self,
* args )
This function has the following signatures:

0. get_abspath(cursor: const dirtree_cursor_t &, name_flags: int=DTN_FULL_NAME) -> str
1. get_abspath(relpath: str) -> str

# 0: get_abspath(cursor: const dirtree_cursor_t &, name_flags: int=DTN_FULL_NAME) -> str

Get absolute path pointed by the cursor 

@returns path; empty string if error

# 1: get_abspath(relpath: str) -> str

Construct an absolute path from the specified relative path. This function verifies the directory part of the specified path. The last component of the specified path is not verified. 

@returns path. empty path means wrong directory part of RELPATH

◆ get_dir_size()

'ssize_t' get_dir_size ( self,
'diridx_t' diridx )
Get dir size 

@param diridx: directory index
@returns number of entries under this directory; if error, return -1

◆ get_entry_attrs()

str get_entry_attrs ( self,
'direntry_t' de )
Get entry attributes 

@param de: directory entry
@returns name

◆ get_entry_name()

str get_entry_name ( self,
'direntry_t' de,
int name_flags = DTN_FULL_NAME )
Get entry name 

@param de: directory entry
@param name_flags: how exactly the name should be retrieved. combination of bits for get_...name() methods bits
@returns name

◆ get_id()

str get_id ( self)
netnode name

◆ get_parent_cursor()

'dirtree_cursor_t' get_parent_cursor ( self,
'dirtree_cursor_t' cursor )
Get parent cursor. 

@param cursor: a valid ditree cursor
@returns cursor's parent

◆ get_rank()

'ssize_t' get_rank ( self,
'diridx_t' diridx,
'direntry_t' de )
Get ordering rank of an item. 

@param diridx: index of the parent directory
@param de: directory entry
@returns number in a range of [0..n) where n is the number of entries in the parent directory. -1 if error

◆ getcwd()

str getcwd ( self)
Get current directory 

@returns the current working directory

◆ is_dir_ordered()

bool is_dir_ordered ( self,
'diridx_t' diridx )
Is dir ordered? 

@returns true if the dirtree has natural ordering

◆ is_orderable()

bool is_orderable ( self)
Is dirtree orderable? 

@returns true if the dirtree is orderable

◆ isdir()

bool isdir ( self,
* args )
This function has the following signatures:

0. isdir(path: str) -> bool
1. isdir(de: const direntry_t &) -> bool

# 0: isdir(path: str) -> bool

Is a directory? 

@returns true if the specified path is a directory

# 1: isdir(de: const direntry_t &) -> bool

◆ isfile()

bool isfile ( self,
* args )
This function has the following signatures:

0. isfile(path: str) -> bool
1. isfile(de: const direntry_t &) -> bool

# 0: isfile(path: str) -> bool

Is a file? 

@returns true if the specified path is a file

# 1: isfile(de: const direntry_t &) -> bool

◆ link()

'dterr_t' link ( self,
* args )
This function has the following signatures:

0. link(path: str) -> dterr_t
1. link(inode: inode_t) -> dterr_t

# 0: link(path: str) -> dterr_t

Add a file item into a directory. 

@returns dterr_t error code

# 1: link(inode: inode_t) -> dterr_t

Add an inode into the current directory 

@returns dterr_t error code

◆ load()

bool load ( self)
Load the tree structure from the netnode. If dirspec_t::id is empty, the operation will be considered a success. In addition, calling load() more than once will not do anything, and will be considered a success. 

@returns success

◆ mkdir()

'dterr_t' mkdir ( self,
str path )
Create a directory. 

@param path: directory to create
@returns dterr_t error code

◆ notify_dirtree()

None notify_dirtree ( self,
bool added,
'inode_t' inode )
Notify dirtree about a change of an inode. 

@param added: are we adding or deleting an inode?
@param inode: inode in question

◆ rename()

'dterr_t' rename ( self,
str _from,
str to )
Rename a directory entry. 

@param to: destination path
@returns dterr_t error code

◆ resolve_cursor()

'direntry_t' resolve_cursor ( self,
'dirtree_cursor_t' cursor )
Resolve cursor 

@param cursor: to analyze
@returns directory entry; if the cursor is bad, the resolved entry will be invalid.

◆ resolve_path()

'direntry_t' resolve_path ( self,
str path )
Resolve path 

@param path: to analyze
@returns directory entry

◆ rmdir()

'dterr_t' rmdir ( self,
str path )
Remove a directory. 

@param path: directory to delete
@returns dterr_t error code

◆ save()

bool save ( self)
Save the tree structure to the netnode. 

@returns success

◆ set_id()

None set_id ( self,
str nm )

◆ set_natural_order()

bool set_natural_order ( self,
'diridx_t' diridx,
bool enable )
Enable/disable natural inode order in a directory. 

@param diridx: directory index
@param enable: action to do TRUE - enable ordering: re-order existing entries so that all subdirs are at the to beginning of the list, file entries are sorted and placed after the subdirs FALSE - disable ordering, no changes to existing entries
@returns SUCCESS

◆ traverse()

'ssize_t' traverse ( self,
'dirtree_visitor_t' v )
Traverse dirtree, and be notified at each entry If the the visitor returns anything other than 0, iteration will stop, and that value returned. The tree is traversed using a depth-first algorithm. It is forbidden to modify the dirtree_t during traversal; doing so will result in undefined behavior. 

@param v: the callback
@returns 0, or whatever the visitor returned

◆ unlink()

'dterr_t' unlink ( self,
* args )
This function has the following signatures:

0. unlink(path: str) -> dterr_t
1. unlink(inode: inode_t) -> dterr_t

# 0: unlink(path: str) -> dterr_t

Remove a file item from a directory. 

@returns dterr_t error code

# 1: unlink(inode: inode_t) -> dterr_t

Remove an inode from the current directory 

@returns dterr_t error code

Member Data Documentation

◆ get_nodename

str get_nodename = get_id
static

◆ set_nodename

None set_nodename = set_id
static

Property Documentation

◆ thisown

thisown
static
Initial value:
= property(lambda x: x.this.own(), lambda x, v: x.this.own(v),
doc='The membership flag')

The documentation for this class was generated from the following file: