1/**
2 * @copyright
3 * ====================================================================
4 *    Licensed to the Apache Software Foundation (ASF) under one
5 *    or more contributor license agreements.  See the NOTICE file
6 *    distributed with this work for additional information
7 *    regarding copyright ownership.  The ASF licenses this file
8 *    to you under the Apache License, Version 2.0 (the
9 *    "License"); you may not use this file except in compliance
10 *    with the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 *    Unless required by applicable law or agreed to in writing,
15 *    software distributed under the License is distributed on an
16 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 *    KIND, either express or implied.  See the License for the
18 *    specific language governing permissions and limitations
19 *    under the License.
20 * ====================================================================
21 * @endcopyright
22 *
23 * @file svn_delta_private.h
24 * @brief The Subversion delta/diff/editor library - Internal routines
25 */
26
27#ifndef SVN_DELTA_PRIVATE_H
28#define SVN_DELTA_PRIVATE_H
29
30#include <apr_pools.h>
31
32#include "svn_types.h"
33#include "svn_error.h"
34#include "svn_delta.h"
35#include "svn_editor.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif /* __cplusplus */
40
41
42typedef svn_error_t *(*svn_delta__start_edit_func_t)(
43  void *baton,
44  svn_revnum_t base_revision);
45
46typedef svn_error_t *(*svn_delta__target_revision_func_t)(
47  void *baton,
48  svn_revnum_t target_revision,
49  apr_pool_t *scratch_pool);
50
51typedef svn_error_t *(*svn_delta__unlock_func_t)(
52  void *baton,
53  const char *path,
54  apr_pool_t *scratch_pool);
55
56
57/* See svn_editor__insert_shims() for more information. */
58struct svn_delta__extra_baton
59{
60  svn_delta__start_edit_func_t start_edit;
61  svn_delta__target_revision_func_t target_revision;
62  void *baton;
63};
64
65
66/** A temporary API to convert from a delta editor to an Ev2 editor. */
67svn_error_t *
68svn_delta__editor_from_delta(svn_editor_t **editor_p,
69                             struct svn_delta__extra_baton **exb,
70                             svn_delta__unlock_func_t *unlock_func,
71                             void **unlock_baton,
72                             const svn_delta_editor_t *deditor,
73                             void *dedit_baton,
74                             svn_boolean_t *send_abs_paths,
75                             const char *repos_root,
76                             const char *base_relpath,
77                             svn_cancel_func_t cancel_func,
78                             void *cancel_baton,
79                             svn_delta_fetch_kind_func_t fetch_kind_func,
80                             void *fetch_kind_baton,
81                             svn_delta_fetch_props_func_t fetch_props_func,
82                             void *fetch_props_baton,
83                             apr_pool_t *result_pool,
84                             apr_pool_t *scratch_pool);
85
86
87/** A temporary API to convert from an Ev2 editor to a delta editor. */
88svn_error_t *
89svn_delta__delta_from_editor(const svn_delta_editor_t **deditor,
90                             void **dedit_baton,
91                             svn_editor_t *editor,
92                             svn_delta__unlock_func_t unlock_func,
93                             void *unlock_baton,
94                             svn_boolean_t *found_abs_paths,
95                             const char *repos_root,
96                             const char *base_relpath,
97                             svn_delta_fetch_props_func_t fetch_props_func,
98                             void *fetch_props_baton,
99                             svn_delta_fetch_base_func_t fetch_base_func,
100                             void *fetch_base_baton,
101                             struct svn_delta__extra_baton *exb,
102                             apr_pool_t *pool);
103
104/**
105 * Get the data from IN, compress it according to the specified
106 * COMPRESSION_LEVEL and write the result to OUT.
107 * SVN_DELTA_COMPRESSION_LEVEL_NONE is valid for COMPRESSION_LEVEL.
108 */
109svn_error_t *
110svn__compress(svn_string_t *in,
111              svn_stringbuf_t *out,
112              int compression_level);
113
114/**
115 * Get the compressed data from IN, decompress it and write the result to
116 * OUT.  Return an error if the decompressed size is larger than LIMIT.
117 */
118svn_error_t *
119svn__decompress(svn_string_t *in,
120                svn_stringbuf_t *out,
121                apr_size_t limit);
122
123
124#ifdef __cplusplus
125}
126#endif /* __cplusplus */
127
128#endif /* SVN_DELTA_PRIVATE_H */
129