Subversion
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
subversion
include
svn_iter.h
Go to the documentation of this file.
1
/**
2
* @copyright
3
* ====================================================================
4
* Copyright (c) 2007 CollabNet. All rights reserved.
5
*
6
* This software is licensed as described in the file COPYING, which
7
* you should have received as part of this distribution. The terms
8
* are also available at http://subversion.tigris.org/license-1.html.
9
* If newer versions of this license are posted there, you may use a
10
* newer version instead, at your option.
11
*
12
* This software consists of voluntary contributions made by many
13
* individuals. For exact contribution history, see the revision
14
* history and logs, available at http://subversion.tigris.org/.
15
* ====================================================================
16
* @endcopyright
17
*
18
* @file svn_iter.h
19
* @brief The Subversion Iteration drivers helper routines
20
*
21
*/
22
23
#ifndef SVN_ITER_H
24
#define SVN_ITER_H
25
26
#include <apr.h>
/* for apr_ssize_t */
27
#include <apr_pools.h>
/* for apr_pool_t */
28
#include <apr_hash.h>
/* for apr_hash_t */
29
#include <apr_tables.h>
/* for apr_array_header_t */
30
31
#include "
svn_types.h
"
32
33
#ifdef __cplusplus
34
extern
"C"
{
35
#endif
/* __cplusplus */
36
37
38
/** Callback function for use with svn_iter_apr_hash().
39
* Use @a pool for temporary allocation, it's cleared between invocations.
40
*
41
* @a key, @a klen and @a val are the values normally retrieved with
42
* apr_hash_this().
43
*
44
* @a baton is the baton passed into svn_iter_apr_hash().
45
*
46
* @since New in 1.5.
47
*/
48
typedef
svn_error_t
*(*svn_iter_apr_hash_cb_t)(
void
*baton,
49
const
void
*key,
50
apr_ssize_t klen,
51
void
*val, apr_pool_t *pool);
52
53
/** Iterate over the elements in @a hash, calling @a func for each one until
54
* there are no more elements or @a func returns an error.
55
*
56
* Uses @a pool for temporary allocations.
57
*
58
* If @a completed is not NULL, then on return - if @a func returns no
59
* errors - @a *completed will be set to @c TRUE.
60
*
61
* If @a func returns an error other than @c SVN_ERR_ITER_BREAK, that
62
* error is returned. When @a func returns @c SVN_ERR_ITER_BREAK,
63
* iteration is interrupted, but no error is returned and @a *completed is
64
* set to @c FALSE.
65
*
66
* @since New in 1.5.
67
*/
68
svn_error_t
*
69
svn_iter_apr_hash
(
svn_boolean_t
*completed,
70
apr_hash_t *hash,
71
svn_iter_apr_hash_cb_t
func,
72
void
*baton,
73
apr_pool_t *pool);
74
75
/** Iteration callback used in conjuction with svn_iter_apr_array().
76
*
77
* Use @a pool for temporary allocation, it's cleared between invocations.
78
*
79
* @a baton is the baton passed to svn_iter_apr_array(). @a item
80
* is a pointer to the item written to the array with the APR_ARRAY_PUSH()
81
* macro.
82
*
83
* @since New in 1.5.
84
*/
85
typedef
svn_error_t
*(*svn_iter_apr_array_cb_t)(
void
*baton,
86
void
*item,
87
apr_pool_t *pool);
88
89
/** Iterate over the elements in @a array calling @a func for each one until
90
* there are no more elements or @a func returns an error.
91
*
92
* Uses @a pool for temporary allocations.
93
*
94
* If @a completed is not NULL, then on return - if @a func returns no
95
* errors - @a *completed will be set to @c TRUE.
96
*
97
* If @a func returns an error other than @c SVN_ERR_ITER_BREAK, that
98
* error is returned. When @a func returns @c SVN_ERR_ITER_BREAK,
99
* iteration is interrupted, but no error is returned and @a *completed is
100
* set to @c FALSE.
101
*
102
* @since New in 1.5.
103
*/
104
svn_error_t
*
105
svn_iter_apr_array
(
svn_boolean_t
*completed,
106
const
apr_array_header_t *array,
107
svn_iter_apr_array_cb_t
func,
108
void
*baton,
109
apr_pool_t *pool);
110
111
112
/** Internal routine used by svn_iter_break() macro.
113
*/
114
svn_error_t
*
115
svn_iter__break
(
void
);
116
117
118
/** Helper macro to break looping in svn_iter_apr_array() and
119
* svn_iter_apr_hash() driven loops.
120
*
121
* @note The error is just a means of communicating between
122
* driver and callback. There is no need for it to exist
123
* past the lifetime of the iterpool.
124
*
125
* @since New in 1.5.
126
*/
127
#define svn_iter_break(pool) return svn_iter__break()
128
129
130
#ifdef __cplusplus
131
}
132
#endif
/* __cplusplus */
133
134
#endif
/* SVN_ITER_H */
Generated on Tue Feb 3 2015 11:22:57 for Subversion by
1.8.1.2