IDAPython 9.0
Loading...
Searching...
No Matches
dirtree_t Class Reference

Proxy of C++ dirtree_t class.

Inheritance diagram for dirtree_t:

Public Member Functions

 __init__ (self, "dirspec_t" ds)
 init(self, ds) -> dirtree_t
 
"bool" is_orderable (self)
 is_orderable(self) -> bool Is dirtree orderable?
 
"dterr_t" chdir (self, "char const *" path)
 chdir(self, path) -> dterr_t Change current directory
 
"qstring" getcwd (self)
 getcwd(self) -> qstring Get current directory
 
"qstring" get_abspath (self, *args)
 get_abspath(self, cursor, name_flags=DTN_FULL_NAME) -> qstring Construct an absolute path from the specified relative path.
 
"direntry_t" resolve_cursor (self, "dirtree_cursor_t" cursor)
 resolve_cursor(self, cursor) -> direntry_t Resolve cursor
 
"direntry_t" resolve_path (self, "char const *" path)
 resolve_path(self, path) -> direntry_t Resolve path
 
"bool" isdir (self, *args)
 isdir(self, de) -> bool
 
"bool" isfile (self, *args)
 isfile(self, de) -> bool
 
"qstring" get_entry_name (self, "direntry_t" de, "uint32" name_flags=DTN_FULL_NAME)
 get_entry_name(self, de, name_flags=DTN_FULL_NAME) -> qstring Get entry name
 
"bool" is_dir_ordered (self, "diridx_t" diridx)
 is_dir_ordered(self, diridx) -> bool Is dir ordered?
 
"bool" set_natural_order (self, "diridx_t" diridx, "bool" enable)
 set_natural_order(self, diridx, enable) -> bool Enable/disable natural inode order in a directory.
 
"ssize_t" get_dir_size (self, "diridx_t" diridx)
 get_dir_size(self, diridx) -> ssize_t Get dir size
 
"qstring" get_entry_attrs (self, "direntry_t" de)
 get_entry_attrs(self, de) -> qstring Get entry attributes
 
"bool" findfirst (self, "dirtree_iterator_t" ff, "char const *" pattern)
 findfirst(self, ff, pattern) -> bool Start iterating over files in a directory
 
"bool" findnext (self, "dirtree_iterator_t" ff)
 findnext(self, ff) -> bool Continue iterating over files in a directory
 
"dterr_t" mkdir (self, "char const *" path)
 mkdir(self, path) -> dterr_t Create a directory.
 
"dterr_t" rmdir (self, "char const *" path)
 rmdir(self, path) -> dterr_t Remove a directory.
 
"dterr_t" link (self, *args)
 link(self, path) -> dterr_t Add an inode into the current directory
 
"dterr_t" unlink (self, *args)
 unlink(self, path) -> dterr_t Remove an inode from the current directory
 
"dterr_t" rename (self, "char const *" _from, "char const *" to)
 rename(self, _from, to) -> dterr_t Rename a directory entry.
 
"ssize_t" get_rank (self, "diridx_t" diridx, "direntry_t" de)
 get_rank(self, diridx, de) -> ssize_t Get ordering rank of an item.
 
"dterr_t" change_rank (self, "char const *" path, "ssize_t" rank_delta)
 change_rank(self, path, rank_delta) -> dterr_t Change ordering rank of an item.
 
"dirtree_cursor_t" get_parent_cursor (self, "dirtree_cursor_t" cursor)
 get_parent_cursor(self, cursor) -> dirtree_cursor_t Get parent cursor.
 
"bool" load (self)
 load(self) -> bool Load the tree structure from the netnode.
 
"bool" save (self)
 save(self) -> bool Save the tree structure to the netnode.
 
"char const *" get_id (self)
 get_id(self) -> char const * netnode name
 
"void" set_id (self, "char const *" nm)
 set_id(self, nm)
 
"void" notify_dirtree (self, "bool" added, "inode_t" inode)
 notify_dirtree(self, added, inode) Notify dirtree about a change of an inode.
 
"ssize_t" traverse (self, "dirtree_visitor_t" v)
 traverse(self, v) -> ssize_t Traverse dirtree, and be notified at each entry If the the visitor returns anything other than 0, iteration will stop, and that value returned.
 
"dirtree_cursor_t" find_entry (self, "direntry_t" de)
 find_entry(self, de) -> dirtree_cursor_t Find the cursor corresponding to an entry of a directory
 

Static Public Member Functions

"char const *" errstr ("dterr_t" err)
 errstr(err) -> char const * Get textual representation of the error code.
 

Static Public Attributes

"char const *" get_nodename = get_id
 
"void" set_nodename = set_id
 

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
"dirspec_t" ds )
Parameters
dsdirspec_t *

Member Function Documentation

◆ change_rank()

"dterr_t" change_rank ( self,
"char const *" path,
"ssize_t" rank_delta )
Parameters
path(C++: const char *) path to the item
rank_delta(C++: ssize_t) 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
Note
: this function may disable natural ordering of the parent folder
See also
: set_natural_order()

◆ chdir()

"dterr_t" chdir ( self,
"char const *" path )
Parameters
path(C++: const char *) new current directory
Returns
: dterr_t error code

◆ errstr()

"char const *" errstr ( "dterr_t" err)
static
Parameters
err(C++: dterr_t) enum dterr_t

◆ find_entry()

"dirtree_cursor_t" find_entry ( self,
"direntry_t" de )
Parameters
de(C++: const direntry_t &) directory entry
Returns
: cursor corresponding to the directory entry

◆ findfirst()

"bool" findfirst ( self,
"dirtree_iterator_t" ff,
"char const *" pattern )
Parameters
ff(C++: dirtree_iterator_t *) directory iterator. it will be initialized by the function
pattern(C++: const char *) pattern to search for
Returns
: success

◆ findnext()

"bool" findnext ( self,
"dirtree_iterator_t" ff )
Parameters
ff(C++: dirtree_iterator_t *) directory iterator
Returns
: success

◆ get_abspath()

"qstring" get_abspath ( self,
* args )

This function verifies the directory part of the specified path. The last component of the specified path is not verified.

Parameters
cursordirtree_cursor_t const &
name_flagsuint32
Returns
: path. empty path means wrong directory part of RELPATH get_abspath(self, relpath) -> qstring
Parameters
relpathchar const *

◆ get_dir_size()

"ssize_t" get_dir_size ( self,
"diridx_t" diridx )
Parameters
diridx(C++: diridx_t) directory index
Returns
: number of entries under this directory; if error, return -1

◆ get_entry_attrs()

"qstring" get_entry_attrs ( self,
"direntry_t" de )
Parameters
de(C++: const direntry_t &) directory entry
Returns
: name

◆ get_entry_name()

"qstring" get_entry_name ( self,
"direntry_t" de,
"uint32" name_flags = DTN_FULL_NAME )
Parameters
de(C++: const direntry_t &) directory entry
name_flags(C++: uint32) how exactly the name should be retrieved. combination of bits for get_...name() methods bits
Returns
: name

◆ get_id()

"char const *" get_id ( self)

◆ get_parent_cursor()

"dirtree_cursor_t" get_parent_cursor ( self,
"dirtree_cursor_t" cursor )
Parameters
cursor(C++: const dirtree_cursor_t &) a valid ditree cursor
Returns
: cursor's parent

◆ get_rank()

"ssize_t" get_rank ( self,
"diridx_t" diridx,
"direntry_t" de )
Parameters
diridx(C++: diridx_t) index of the parent directory
de(C++: const direntry_t &) 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()

"qstring" getcwd ( self)
Returns
: the current working directory

◆ is_dir_ordered()

"bool" is_dir_ordered ( self,
"diridx_t" diridx )
Parameters
diridx(C++: diridx_t)
Returns
: true if the dirtree has natural ordering

◆ is_orderable()

"bool" is_orderable ( self)
Returns
: true if the dirtree is orderable

◆ isdir()

"bool" isdir ( self,
* args )
Parameters
dedirentry_t const &

isdir(self, path) -> bool

Parameters
pathchar const *

◆ isfile()

"bool" isfile ( self,
* args )
Parameters
dedirentry_t const &

isfile(self, path) -> bool

Parameters
pathchar const *

◆ link()

"dterr_t" link ( self,
* args )
Parameters
pathchar const *
Returns
: dterr_t error code link(self, inode) -> dterr_t
Parameters
inodeinode_t

◆ load()

"bool" load ( self)

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
See also
: dirspec_t.id.

◆ mkdir()

"dterr_t" mkdir ( self,
"char const *" path )
Parameters
path(C++: const char *) directory to create
Returns
: dterr_t error code

◆ notify_dirtree()

"void" notify_dirtree ( self,
"bool" added,
"inode_t" inode )
Parameters
added(C++: bool) are we adding or deleting an inode?
inode(C++: inode_t) inode in question

◆ rename()

"dterr_t" rename ( self,
"char const *" _from,
"char const *" to )
Parameters
from(C++: const char *) source path
to(C++: const char *) destination path
Returns
: dterr_t error code
Note
: This function can also rename the item

◆ resolve_cursor()

"direntry_t" resolve_cursor ( self,
"dirtree_cursor_t" cursor )
Parameters
cursor(C++: const dirtree_cursor_t &) to analyze
Returns
: directory entry; if the cursor is bad, the resolved entry will be invalid.
Note
: see also get_abspath()

◆ resolve_path()

"direntry_t" resolve_path ( self,
"char const *" path )
Parameters
path(C++: const char *) to analyze
Returns
: directory entry

◆ rmdir()

"dterr_t" rmdir ( self,
"char const *" path )
Parameters
path(C++: const char *) directory to delete
Returns
: dterr_t error code

◆ save()

"bool" save ( self)
Returns
: success
See also
: dirspec_t.id.

◆ set_id()

"void" set_id ( self,
"char const *" nm )
Parameters
nmchar const *

◆ set_natural_order()

"bool" set_natural_order ( self,
"diridx_t" diridx,
"bool" enable )
Parameters
diridx(C++: diridx_t) directory index
enable(C++: bool) 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 )

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.

Parameters
v(C++: dirtree_visitor_t &) the callback
Returns
: 0, or whatever the visitor returned

◆ unlink()

"dterr_t" unlink ( self,
* args )
Parameters
pathchar const *
Returns
: dterr_t error code unlink(self, inode) -> dterr_t
Parameters
inodeinode_t

Member Data Documentation

◆ get_nodename

"char const *" get_nodename = get_id
static

◆ set_nodename

"void" set_nodename = set_id
static

Property Documentation

◆ thisown

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

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