libsqsh v1.5.2
Loading...
Searching...
No Matches
SqshTreeWalker Struct Reference

A walker over the contents of a file. More...

#include <sqsh_tree_private.h>

Public Member Functions

struct SqshTreeWalkersqsh_tree_walker_new (struct SqshArchive *archive, int *err)
 Creates a new SqshTreeWalker object at the root inode.
 
SQSH_NO_UNUSED int sqsh_tree_walker_up (struct SqshTreeWalker *walker)
 Moves the walker one level up.
 
SQSH_NO_UNUSED int sqsh_tree_walker_next (struct SqshTreeWalker *walker)
 Moves the walker to the next entry int the current directory.
 
enum SqshFileType sqsh_tree_walker_type (const struct SqshTreeWalker *walker)
 Returns the inode type of the current entry.
 
const char * sqsh_tree_walker_name (const struct SqshTreeWalker *walker)
 Returns the name of the current entry. This entry is not zero terminated.
 
uint16_t sqsh_tree_walker_name_size (const struct SqshTreeWalker *walker)
 Returns the size of the name of the current entry.
 
SQSH_NO_UNUSED char * sqsh_tree_walker_name_dup (const struct SqshTreeWalker *walker)
 creates a heap allocated copy of the name of the current entry.
 
SQSH_NO_UNUSED int sqsh_tree_walker_revert (struct SqshTreeWalker *walker)
 reverts the walker to the begining of the current directory.
 
SQSH_NO_UNUSED int sqsh_tree_walker_lookup (struct SqshTreeWalker *walker, const char *name, const size_t name_size)
 Looks up an entry in the current directory.
 
SQSH_NO_UNUSED int sqsh_tree_walker_down (struct SqshTreeWalker *walker)
 Lets the walker enter the current entry.
 
SQSH_NO_UNUSED int sqsh_tree_walker_to_root (struct SqshTreeWalker *walker)
 Moves the walker to the root directory.
 
SQSH_NO_UNUSED struct SqshFilesqsh_tree_walker_open_file (const struct SqshTreeWalker *walker, int *err)
 Returns the inode of the current entry.
 
SQSH_NO_UNUSED int sqsh_tree_walker_resolve (struct SqshTreeWalker *walker, const char *path, bool follow_symlinks)
 Resolve a path with the tree walker.
 
int sqsh_tree_walker_free (struct SqshTreeWalker *reader)
 Cleans up resources used by a SqshTreeWalker struct.
 

Detailed Description

A walker over the contents of a file.

Deprecated
Since 1.2.0. Use struct SqshPathResolver instead.

Definition at line 162 of file sqsh_tree_private.h.

Member Function Documentation

◆ sqsh_tree_walker_down()

SQSH_NO_UNUSED int sqsh_tree_walker_down ( struct SqshTreeWalker * walker)

Lets the walker enter the current entry.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_down() instead.
Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_tree_walker_free()

int sqsh_tree_walker_free ( struct SqshTreeWalker * reader)

Cleans up resources used by a SqshTreeWalker struct.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_free() instead.
Parameters
[in,out]readerThe file reader struct to clean up.
Returns
0 on success, less than 0 on error.

◆ sqsh_tree_walker_lookup()

SQSH_NO_UNUSED int sqsh_tree_walker_lookup ( struct SqshTreeWalker * walker,
const char * name,
const size_t name_size )

Looks up an entry in the current directory.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_lookup() instead.
Parameters
[in,out]walkerThe walker to use
[in]nameThe name of the entry to look up.
[in]name_sizeThe size of the name.
Returns
0 on success, less than 0 on error.

◆ sqsh_tree_walker_name()

const char * sqsh_tree_walker_name ( const struct SqshTreeWalker * walker)

Returns the name of the current entry. This entry is not zero terminated.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_name() instead.
Parameters
[in]walkerThe walker to use
Returns
the name of the current entry.

◆ sqsh_tree_walker_name_dup()

SQSH_NO_UNUSED char * sqsh_tree_walker_name_dup ( const struct SqshTreeWalker * walker)

creates a heap allocated copy of the name of the current entry.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_name_dup() instead.

The caller is responsible for calling free() on the returned pointer.

The returned string is 0 terminated.

Parameters
[in]walkerThe walker to use
Returns
the name of the current entry.

◆ sqsh_tree_walker_name_size()

uint16_t sqsh_tree_walker_name_size ( const struct SqshTreeWalker * walker)

Returns the size of the name of the current entry.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_name_size() instead.
Parameters
[in]walkerThe walker to use
Returns
the size of the name of the current entry.

◆ sqsh_tree_walker_new()

struct SqshTreeWalker * sqsh_tree_walker_new ( struct SqshArchive * archive,
int * err )

Creates a new SqshTreeWalker object at the root inode.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_new() instead.
Parameters
[in]archiveThe archive to use
[out]errPointer to an int where the error code will be stored.
Returns
a new file reader.

◆ sqsh_tree_walker_next()

SQSH_NO_UNUSED int sqsh_tree_walker_next ( struct SqshTreeWalker * walker)

Moves the walker to the next entry int the current directory.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_next() instead.

This function was deprecated to align the API with other iterator APIs. The sqsh_tree_walker_next2() uses the same signature as the other iterator.

Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_tree_walker_open_file()

SQSH_NO_UNUSED struct SqshFile * sqsh_tree_walker_open_file ( const struct SqshTreeWalker * walker,
int * err )

Returns the inode of the current entry.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_open_file() instead.
Parameters
[in,out]walkerThe walker to use
[out]errPointer to an int where the error code will be
Returns
the inode of the current entry.

◆ sqsh_tree_walker_resolve()

SQSH_NO_UNUSED int sqsh_tree_walker_resolve ( struct SqshTreeWalker * walker,
const char * path,
bool follow_symlinks )

Resolve a path with the tree walker.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_open_file() instead.

This function will resolve the given path with the tree walker. The base is the current directory.

Parameters
[in,out]walkerThe walker to use
[in]pathThe path to resolve.
[in]follow_symlinksWhether to follow symlinks.
Returns
the inode of the current entry.

◆ sqsh_tree_walker_revert()

SQSH_NO_UNUSED int sqsh_tree_walker_revert ( struct SqshTreeWalker * walker)

reverts the walker to the begining of the current directory.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_revert() instead.
Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_tree_walker_to_root()

SQSH_NO_UNUSED int sqsh_tree_walker_to_root ( struct SqshTreeWalker * walker)

Moves the walker to the root directory.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_to_root() instead.
Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

◆ sqsh_tree_walker_type()

enum SqshFileType sqsh_tree_walker_type ( const struct SqshTreeWalker * walker)

Returns the inode type of the current entry.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_type() instead.
Parameters
[in]walkerThe walker to use
Returns
the inode type of the current entry.

◆ sqsh_tree_walker_up()

SQSH_NO_UNUSED int sqsh_tree_walker_up ( struct SqshTreeWalker * walker)

Moves the walker one level up.

Deprecated
Since 1.2.0. Use sqsh_path_resolver_up() instead.
Parameters
[in,out]walkerThe walker to use
Returns
0 on success, less than 0 on error.

The documentation for this struct was generated from the following files: