Main Page   Modules   Data Structures   File List   Data Fields   Globals  

path.h File Reference

Wrapper functions for path manipulation class. More...

#include "translations.h"

Go to the source code of this file.

Functions

DLLIMPORT dar_pathdar_path_create (char *path)
 Creates a new path object from c string.

DLLIMPORT dar_pathdar_path_copy (dar_path *ref)
 Copy constructor.

DLLIMPORT void dar_path_destroy (dar_path *ref)
 Frees memory used by path object.

DLLIMPORT bool dar_path_compare (dar_path *ref, dar_path *path)
 Returns true if paths are exactly alike.

DLLIMPORT bool dar_path_is_relative (dar_path *ref)
 Returns true if the path is relative, false if absolute.

DLLIMPORT bool dar_path_is_subdir_of (dar_path *ref, dar_path *path, bool case_sensit)
 Returns true if reference is a subdirectory of path.

DLLIMPORT char * dar_path_iterate_next (dar_path *ref)
 Gets c string containing the name of the next child directory.

DLLIMPORT void dar_path_iterate_reset (dar_path *ref)
 Resets iteration position at the root or shallowest child.

DLLIMPORT bool dar_path_stack_push (dar_path *ref, dar_path *path)
 Adds another relative path to the end of the reference path.

DLLIMPORT bool dar_path_stack_peek (dar_path *ref, char **name)
 Returns deepest child directory name without removing it from the stack.

DLLIMPORT bool dar_path_stack_pop (dar_path *ref, char **name)
 Pops the deepest child directory off the stack, or returns false if there are no more children left (only one element on the stack).

DLLIMPORT bool dar_path_stack_pop_front (dar_path *ref, char **name)
 Pops the root or topmost directory.

DLLIMPORT char * dar_path_get_string (dar_path *ref)
 Returns full path name.

DLLIMPORT unsigned int dar_path_get_depth (dar_path *ref)
 Returns the number of elements left in the path.


Detailed Description

Wrapper functions for path manipulation class.

Definition in file path.h.


Function Documentation

DLLIMPORT dar_path* dar_path_copy dar_path   ref
 

Copy constructor.

Creates a fresh path object.

Definition at line 53 of file path.cpp.

DLLIMPORT dar_path* dar_path_create char *    path
 

Creates a new path object from c string.

Returns null if string is not a valid path.

Definition at line 42 of file path.cpp.

DLLIMPORT unsigned int dar_path_get_depth dar_path   ref
 

Returns the number of elements left in the path.

An absolute path adds one for the root directory itself.

 foo/bar/directory   3
/foo/bar/directory   4

Definition at line 171 of file path.cpp.

DLLIMPORT char* dar_path_get_string dar_path   ref
 

Returns full path name.

String will represent either an absolute or relative path.

Definition at line 161 of file path.cpp.

DLLIMPORT bool dar_path_is_subdir_of dar_path   ref,
dar_path   path,
bool    case_sensit
 

Returns true if reference is a subdirectory of path.

For example, /one/two/three is a subdirectory of /one/two and this/that is a subdirectory of this.

Definition at line 79 of file path.cpp.

DLLIMPORT bool dar_path_stack_peek dar_path   ref,
char **    name
 

Returns deepest child directory name without removing it from the stack.

Will always output a string, but will return false if the output is the last possible element (no more parent directories).

This method should be used whenever the deepest child is desired. This is equivalent to basename in libdar proper.

Definition at line 118 of file path.cpp.

DLLIMPORT bool dar_path_stack_pop_front dar_path   ref,
char **    name
 

Pops the root or topmost directory.

Returns false when only the deepest child is left or path is equal to the root directory.

Definition at line 145 of file path.cpp.

DLLIMPORT bool dar_path_stack_push dar_path   ref,
dar_path   path
 

Adds another relative path to the end of the reference path.

Returns false if pushed path is not relative (can't add an absolute path to another absolute path!)

Definition at line 106 of file path.cpp.