Subversion
|
Path-based editor drives. More...
Typedefs | |
typedef svn_error_t *(* | svn_delta_path_driver_cb_func2_t) (void **dir_baton, const svn_delta_editor_t *editor, void *edit_baton, void *parent_baton, void *callback_baton, const char *relpath, apr_pool_t *pool) |
Callback function type for svn_delta_path_driver(). More... | |
typedef svn_error_t *(* | svn_delta_path_driver_cb_func_t) (void **dir_baton, void *parent_baton, void *callback_baton, const char *path, apr_pool_t *pool) |
Like svn_delta_path_driver_cb_func2_t but without the editor and edit_baton parameters. More... | |
typedef struct svn_delta_path_driver_state_t | svn_delta_path_driver_state_t |
A state object for the path driver that is obtained from svn_delta_path_driver_start() and driven by svn_delta_path_driver_step() and svn_delta_path_driver_finish(). More... | |
Functions | |
svn_error_t * | svn_delta_path_driver3 (const svn_delta_editor_t *editor, void *edit_baton, const apr_array_header_t *relpaths, svn_boolean_t sort_paths, svn_delta_path_driver_cb_func2_t callback_func, void *callback_baton, apr_pool_t *pool) |
Drive editor (with its edit_baton) to visit each path in relpaths. More... | |
svn_error_t * | svn_delta_path_driver2 (const svn_delta_editor_t *editor, void *edit_baton, const apr_array_header_t *paths, svn_boolean_t sort_paths, svn_delta_path_driver_cb_func_t callback_func, void *callback_baton, apr_pool_t *scratch_pool) |
Like svn_delta_path_driver3() but with a different callback function signature. More... | |
svn_error_t * | svn_delta_path_driver (const svn_delta_editor_t *editor, void *edit_baton, svn_revnum_t revision, const apr_array_header_t *paths, svn_delta_path_driver_cb_func_t callback_func, void *callback_baton, apr_pool_t *scratch_pool) |
Similar to svn_delta_path_driver2, but takes an (unused) revision, and will sort the provided paths using svn_sort_compare_paths. More... | |
svn_error_t * | svn_delta_path_driver_start (svn_delta_path_driver_state_t **state_p, const svn_delta_editor_t *editor, void *edit_baton, svn_delta_path_driver_cb_func2_t callback_func, void *callback_baton, apr_pool_t *result_pool) |
Return a path driver object that can drive editor (with its edit_baton) to visit a series of paths. More... | |
svn_error_t * | svn_delta_path_driver_step (svn_delta_path_driver_state_t *state, const char *relpath, apr_pool_t *scratch_pool) |
Visit relpath. More... | |
svn_error_t * | svn_delta_path_driver_finish (svn_delta_path_driver_state_t *state, apr_pool_t *scratch_pool) |
Finish driving the editor. More... | |
Path-based editor drives.
typedef svn_error_t*(* svn_delta_path_driver_cb_func2_t) (void **dir_baton, const svn_delta_editor_t *editor, void *edit_baton, void *parent_baton, void *callback_baton, const char *relpath, apr_pool_t *pool) |
Callback function type for svn_delta_path_driver().
The handler of this callback is given the callback baton callback_baton, editor and edit_baton which represent the editor being driven, relpath which is a relpath relative to the root of the edit, and the parent_baton which represents relpath's parent directory as created by the editor.
If the handler deletes the node at relpath (and does not replace it with an added directory) it must set *dir_baton to null or leave it unchanged.
If the handler opens (or adds) a directory at relpath, it must set *dir_baton to the directory baton for relpath, generated from the same editor. The driver will close the directory later.
If the handler opens (or adds) a file at relpath, the handler must set *dir_baton to null or leave it unchanged. The handler must either close the file immediately, or delay that close until the end of the edit when svn_delta_path_driver() returns.
Finally, if parent_baton is NULL
, then the root of the edit is also one of the paths passed to svn_delta_path_driver(). The handler of this callback must call the editor's open_root() function and return the top-level root dir baton in *dir_baton.
Definition at line 1317 of file svn_delta.h.
typedef svn_error_t*(* svn_delta_path_driver_cb_func_t) (void **dir_baton, void *parent_baton, void *callback_baton, const char *path, apr_pool_t *pool) |
Like svn_delta_path_driver_cb_func2_t but without the editor and edit_baton parameters.
The user must arrange for the editor to be passed through callback_baton (if required, which it usually is). And path could possibly have a '/' prefix instead of being a relpath; see the note on svn_delta_path_driver2().
Definition at line 1334 of file svn_delta.h.
typedef struct svn_delta_path_driver_state_t svn_delta_path_driver_state_t |
A state object for the path driver that is obtained from svn_delta_path_driver_start() and driven by svn_delta_path_driver_step() and svn_delta_path_driver_finish().
Definition at line 1422 of file svn_delta.h.
svn_error_t* svn_delta_path_driver | ( | const svn_delta_editor_t * | editor, |
void * | edit_baton, | ||
svn_revnum_t | revision, | ||
const apr_array_header_t * | paths, | ||
svn_delta_path_driver_cb_func_t | callback_func, | ||
void * | callback_baton, | ||
apr_pool_t * | scratch_pool | ||
) |
Similar to svn_delta_path_driver2, but takes an (unused) revision, and will sort the provided paths using svn_sort_compare_paths.
svn_error_t* svn_delta_path_driver2 | ( | const svn_delta_editor_t * | editor, |
void * | edit_baton, | ||
const apr_array_header_t * | paths, | ||
svn_boolean_t | sort_paths, | ||
svn_delta_path_driver_cb_func_t | callback_func, | ||
void * | callback_baton, | ||
apr_pool_t * | scratch_pool | ||
) |
Like svn_delta_path_driver3() but with a different callback function signature.
Optionally, paths in paths could have a '/' prefix instead of being relpaths. If any of them do, then (since 1.12) ALL paths sent to the callback will have a '/' prefix.
svn_error_t* svn_delta_path_driver3 | ( | const svn_delta_editor_t * | editor, |
void * | edit_baton, | ||
const apr_array_header_t * | relpaths, | ||
svn_boolean_t | sort_paths, | ||
svn_delta_path_driver_cb_func2_t | callback_func, | ||
void * | callback_baton, | ||
apr_pool_t * | pool | ||
) |
Drive editor (with its edit_baton) to visit each path in relpaths.
As each path is hit as part of the editor drive, use callback_func and callback_baton to allow the caller to handle the portion of the editor drive related to that path.
Each path in relpaths is a (const char *) relpath, relative to the root path of the edit. The editor drive will be performed in the same order as relpaths. The paths should be sorted using something like svn_sort_compare_paths() to ensure that each directory in the depth-first walk is visited only once. If sort_paths is set, the function will sort the paths for you. Some callers may need further customization of the order (ie. libsvn_delta/compat.c).
If the first target path (after any requested sorting) is ""
(the root of the edit), the callback function will be responsible for calling the editor's open_root
method; otherwise, this function will call open_root
.
Use scratch_pool for all necessary allocations.
svn_error_t* svn_delta_path_driver_finish | ( | svn_delta_path_driver_state_t * | state, |
apr_pool_t * | scratch_pool | ||
) |
Finish driving the editor.
state is the object returned by svn_delta_path_driver_start().
This drives the editor to close any open directories and then calls the editor's close_edit
method.
svn_error_t* svn_delta_path_driver_start | ( | svn_delta_path_driver_state_t ** | state_p, |
const svn_delta_editor_t * | editor, | ||
void * | edit_baton, | ||
svn_delta_path_driver_cb_func2_t | callback_func, | ||
void * | callback_baton, | ||
apr_pool_t * | result_pool | ||
) |
Return a path driver object that can drive editor (with its edit_baton) to visit a series of paths.
As each path is hit as part of the editor drive, the path driver will call callback_func and callback_baton to allow the caller to handle the portion of the editor drive related to that path.
This will not call the editor's open_root method; for that, see svn_delta_path_driver_step().
svn_error_t* svn_delta_path_driver_step | ( | svn_delta_path_driver_state_t * | state, |
const char * | relpath, | ||
apr_pool_t * | scratch_pool | ||
) |
Visit relpath.
state is the object returned by svn_delta_path_driver_start().
relpath is a relpath relative to the root path of the edit.
This function uses the editor and the callback that were originally supplied to svn_delta_path_driver_start().
This drives the editor in a depth-first order, closing and then opening directories if necessary to move from the last visited path to the new path, as required by the editor driving rules.
This then calls the callback to allow the caller to handle the portion of the editor drive related to that path.
If the first path to visit is ""
(the root of the edit), the callback function will be responsible for calling the editor's open_root
method; otherwise, this function will call open_root
.
The order of paths to visit should in general be sorted using something like svn_sort_compare_paths() to ensure that each directory in the depth-first walk is visited only once. Some editors may rely on such a restriction.