IDA SDK
|
Directory tree.
This class organizes a virtual directory tree over items that are represented by dirspec_t.
Public Member Functions | |
dirtree_t (dirspec_t *ds) | |
bool | is_orderable () const |
Is dirtree orderable? More... | |
dterr_t | chdir (const char *path) |
Change current directory. More... | |
qstring | getcwd () const |
Get current directory. More... | |
qstring | get_abspath (const dirtree_cursor_t &cursor, uint32 name_flags=DTN_FULL_NAME) const |
Get absolute path pointed by the cursor. More... | |
qstring | get_abspath (const char *relpath) const |
Construct an absolute path from the specified relative path. More... | |
direntry_t | resolve_cursor (const dirtree_cursor_t &cursor) const |
Resolve cursor. More... | |
direntry_t | resolve_path (const char *path) const |
Resolve path. More... | |
bool | isdir (const char *path) const |
Is a directory? More... | |
bool | isfile (const char *path) const |
Is a file? More... | |
qstring | get_entry_name (const direntry_t &de, uint32 name_flags=DTN_FULL_NAME) const |
Get entry name. More... | |
bool | is_dir_ordered (diridx_t diridx) const |
Is dir ordered? More... | |
bool | set_natural_order (diridx_t diridx, bool enable) const |
Enable/disable natural inode order in a directory. More... | |
ssize_t | get_dir_size (diridx_t diridx) const |
Get dir size. More... | |
qstring | get_entry_attrs (const direntry_t &de) const |
Get entry attributes. More... | |
bool | findfirst (dirtree_iterator_t *ff, const char *pattern) const |
Start iterating over files in a directory. More... | |
bool | findnext (dirtree_iterator_t *ff) const |
Continue iterating over files in a directory. More... | |
dterr_t | mkdir (const char *path) |
Create a directory. More... | |
dterr_t | rmdir (const char *path) |
Remove a directory. More... | |
dterr_t | link (const char *path) |
Add a file item into a directory. More... | |
dterr_t | unlink (const char *path) |
Remove a file item from a directory. More... | |
dterr_t | link (inode_t inode) |
Add an inode into the current directory. More... | |
dterr_t | unlink (inode_t inode) |
Remove an inode from the current directory. More... | |
dterr_t | rename (const char *from, const char *to) |
Rename a directory entry. More... | |
ssize_t | get_rank (diridx_t diridx, const direntry_t &de) const |
Get ordering rank of an item. More... | |
dterr_t | change_rank (const char *path, ssize_t rank_delta) |
Change ordering rank of an item. More... | |
dirtree_cursor_t | get_parent_cursor (const dirtree_cursor_t &cursor) const |
Get parent cursor. More... | |
bool | load () |
Load the tree structure from the netnode. More... | |
bool | save () const |
Save the tree structure to the netnode. More... | |
const char * | get_id () const |
netnode name | |
void | set_id (const char *nm) |
void | notify_dirtree (bool added, inode_t inode) |
Notify dirtree about a change of an inode. More... | |
ssize_t | traverse (dirtree_visitor_t &v) const |
Traverse dirtree, and be notified at each entry If the the visitor returns anything other than 0, iteration will stop, and that value returned. More... | |
dirtree_cursor_t | find_entry (const direntry_t &de) const |
Find the cursor corresponding to an entry of a directory. More... | |
Static Public Member Functions | |
static const char * | errstr (dterr_t err) |
Get textual representation of the error code. | |
static bool | isdir (const direntry_t &de) |
static bool | isfile (const direntry_t &de) |
|
inline |
Is dirtree orderable?
|
inline |
|
inline |
Get current directory.
|
inline |
Get absolute path pointed by the cursor.
cursor | |
name_flags | how exactly the name should be retrieved. combination of bits for get_...name() methods bits |
|
inline |
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.
relpath | relative path |
|
inline |
Resolve cursor.
cursor | to analyze |
|
inline |
Resolve path.
path | to analyze |
|
inline |
Is a directory?
path | to analyze |
|
inline |
Is a file?
path | to analyze |
|
inline |
Get entry name.
de | directory entry |
name_flags | how exactly the name should be retrieved. combination of bits for get_...name() methods bits |
|
inline |
Is dir ordered?
|
inline |
Enable/disable natural inode order in a directory.
diridx | directory index |
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 |
Get dir size.
diridx | directory index |
|
inline |
Get entry attributes.
de | directory entry |
|
inline |
Start iterating over files in a directory.
ff | directory iterator. it will be initialized by the function |
pattern | pattern to search for |
|
inline |
Continue iterating over files in a directory.
ff | directory iterator |
|
inline |
|
inline |
|
inline |
Add a file item into a directory.
path | path to item to add to a directory |
|
inline |
Remove a file item from a directory.
path | path to item remove from a directory |
|
inline |
Rename a directory entry.
from | source path |
to | destination path |
|
inline |
Get ordering rank of an item.
diridx | index of the parent directory |
de | directory entry |
Change ordering rank of an item.
path | path to the item |
rank_delta | the amount of the change. positive numbers mean to move down in the list; negative numbers mean to move up. |
|
inline |
Get parent cursor.
cursor | a valid ditree cursor |
|
inline |
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.
|
inline |
Save the tree structure to the netnode.
|
inline |
Notify dirtree about a change of an inode.
added | are we adding or deleting an inode? |
inode | inode in question |
|
inline |
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.
v | the callback |
|
inline |
Find the cursor corresponding to an entry of a directory.
de | directory entry |