|
IDA C++ SDK 9.2
|
Directory tree. More...
#include <dirtree.hpp>
Public Member Functions | |
| dirtree_t (dirspec_t *ds) | |
| dirtree_t (dirtree_impl_t *di) | |
| ~dirtree_t () | |
| bool | is_orderable () const |
| Is dirtree orderable? | |
| dterr_t | chdir (const char *path) |
| Change current directory. | |
| qstring | getcwd () const |
| Get current directory. | |
| qstring | get_abspath (const dirtree_cursor_t &cursor, uint32 name_flags=DTN_FULL_NAME) const |
| Get absolute path pointed by the cursor. | |
| qstring | get_abspath (const char *relpath) const |
| Construct an absolute path from the specified relative path. | |
| direntry_t | resolve_cursor (const dirtree_cursor_t &cursor) const |
| Resolve cursor. | |
| dirtree_cursor_t | make_cursor (const char *path) const |
| Make cursor from path. | |
| direntry_t | resolve_path (const char *path) const |
| Resolve path. | |
| bool | isdir (const char *path) const |
| Is a directory? | |
| bool | isfile (const char *path) const |
| Is a file? | |
| qstring | get_entry_name (const direntry_t &de, uint32 name_flags=DTN_FULL_NAME) const |
| Get entry name. | |
| bool | is_dir_ordered (diridx_t diridx) const |
| Is dir ordered? | |
| dterr_t | set_natural_order (diridx_t diridx, bool enable) const |
| Enable/disable natural inode order in a directory. | |
| ssize_t | get_dir_size (diridx_t diridx) const |
| Get dir size. | |
| qstring | get_entry_attrs (const direntry_t &de) const |
| Get entry attributes. | |
| bool | findfirst (dirtree_iterator_t *ff, const char *pattern) const |
| Start iterating over files in a directory. | |
| bool | findnext (dirtree_iterator_t *ff) const |
| Continue iterating over files in a directory. | |
| dterr_t | mkdir (const char *path) |
| Create a directory. | |
| dterr_t | rmdir (const char *path) |
| Remove a directory. | |
| dterr_t | link (const char *path) |
| Add a file item into a directory. | |
| dterr_t | unlink (const char *path) |
| Remove a file item from a directory. | |
| dterr_t | link (inode_t inode) |
| Add an inode into the current directory. | |
| dterr_t | unlink (inode_t inode) |
| Remove an inode from the current directory. | |
| dterr_t | rename (const char *from, const char *to) |
| Rename a directory entry. | |
| dterr_t | fold_common_prefix (const char *path=nullptr, char sep=DIRTREE_FOLDED_SEP) |
| Collapse single child folders into a single folder item The default separator (DIRTREE_FOLDED_SEP, ASCII 0x1D) is rendered as '/' by the UI but is not split by the path parser, so folded folders behave like a single item for rmdir/cd/rename/etc. | |
| dterr_t | bulk_move (const dirtree_cursor_vec_t &items, const char *dstdir, ssize_t dst_rank=-1, dirtree_cursor_vec_t *moved_items=nullptr, dirtree_bulk_results_t *errs=nullptr) |
| Move many items to a directory. | |
| dterr_t | bulk_remove (const dirtree_cursor_vec_t &items, dirtree_bulk_results_t *errs=nullptr) |
| Delete many items. | |
| ssize_t | get_rank (diridx_t diridx, const direntry_t &de) const |
| Get ordering rank of an item. | |
| dterr_t | change_rank (const char *path, ssize_t rank_delta) |
| Change ordering rank of an item. | |
| dirtree_cursor_t | get_parent_cursor (const dirtree_cursor_t &cursor) const |
| Get parent cursor. | |
| bool | load () |
| Load the tree structure from the netnode. | |
| bool | save () const |
| Save the tree structure to the netnode. | |
| 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. | |
| 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. | |
| dirtree_cursor_t | find_entry (const direntry_t &de) const |
| Find the cursor corresponding to an entry of a directory. | |
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) |
Friends | |
| struct | dirtree_internal_t |
Directory tree.
This class organizes a virtual directory tree over items that are represented by dirspec_t.
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Get textual representation of the error code.
|
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 |
Make cursor from path.
| path | to analyze |
|
inline |
Resolve path.
| path | to analyze |
|
inlinestatic |
|
inlinestatic |
|
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 |
Is dir ordered?
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 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 |
Collapse single child folders into a single folder item The default separator (DIRTREE_FOLDED_SEP, ASCII 0x1D) is rendered as '/' by the UI but is not split by the path parser, so folded folders behave like a single item for rmdir/cd/rename/etc.
| path | starting directory; nullptr or "/" means root |
| sep | character used to join names |
|
inline |
Move many items to a directory.
| items | items to move |
| dstdir | destination directory. will be created if does not exist. |
| dst_rank | rank inside the destination directory, where the items should be moved to. example: 0 means to insert to the very beginning of the directory. -1 means to append files to the end of the directory and insert directories after the first existing directory. if the rank is different from -1 and the destination directory has natural ordering and some moved items are files, then the natural ordering will be disabled. |
| moved_items | buffer for cursors of the successfully moved items |
| errs | buffer for errors. only errors are reported here, in any order |
|
inline |
Delete many items.
| items | items to delete |
| errs | buffer for errors. only errors are reported here, in any order Directories are deleted recursively, even if they are not empty. |
|
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 |
|
inline |
netnode name
|
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 |
|
friend |