]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/include/private/svn_opt_private.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / include / private / svn_opt_private.h
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_opt_private.h
24  * @brief Subversion-internal option parsing APIs.
25  */
26
27 #ifndef SVN_OPT_PRIVATE_H
28 #define SVN_OPT_PRIVATE_H
29
30 #include <apr_pools.h>
31 #include <apr_tables.h>
32 #include <apr_getopt.h>
33
34 #include "svn_error.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 /* Extract the peg revision, if any, from UTF8_TARGET.
41  *
42  * If PEG_REVISION is not NULL, return the peg revision in *PEG_REVISION.
43  * *PEG_REVISION will be an empty string if no peg revision is found.
44  * Return the true target portion in *TRUE_TARGET.
45  *
46  * UTF8_TARGET need not be canonical. *TRUE_TARGET will not be canonical
47  * unless UTF8_TARGET is.
48  *
49  * Note that *PEG_REVISION will still contain the '@' symbol as the first
50  * character if a peg revision was found. If a trailing '@' symbol was
51  * used to escape other '@' characters in UTF8_TARGET, *PEG_REVISION will
52  * point to the string "@", containing only a single character.
53  *
54  * All allocations are done in POOL.
55  */
56 svn_error_t *
57 svn_opt__split_arg_at_peg_revision(const char **true_target,
58                                    const char **peg_revision,
59                                    const char *utf8_target,
60                                    apr_pool_t *pool);
61
62 /* Attempt to transform URL_IN, which is a URL-like user input, into a
63  * valid URL:
64  *   - escape IRI characters and some other non-URI characters
65  *   - check that no back-path ("..") components are present
66  *   - call svn_uri_canonicalize()
67  * URL_IN is in UTF-8 encoding and has no peg revision specifier.
68  * Set *URL_OUT to the result, allocated from POOL.
69  */
70 svn_error_t *
71 svn_opt__arg_canonicalize_url(const char **url_out,
72                               const char *url_in,
73                               apr_pool_t *pool);
74
75 /*
76  * Attempt to transform PATH_IN, which is a local path-like user input, into a
77  * valid local path:
78  *   - Attempt to get the correct capitalization by trying to actually find
79  *     the path specified.
80  *   - If the path does not exist (which is valid) the given capitalization
81  *     is used.
82  *   - canonicalize the separator ("/") characters
83  *   - call svn_dirent_canonicalize()
84  * PATH_IN is in UTF-8 encoding and has no peg revision specifier.
85  * Set *PATH_OUT to the result, allocated from POOL.
86  */
87 svn_error_t *
88 svn_opt__arg_canonicalize_path(const char **path_out,
89                                const char *path_in,
90                                apr_pool_t *pool);
91
92 /*
93  * Pull remaining target arguments from OS into *TARGETS_P,
94  * converting them to UTF-8, followed by targets from KNOWN_TARGETS
95  * (which might come from, for example, the "--targets" command line
96  * option), which are already in UTF-8.
97  *
98  * On each URL target, do some IRI-to-URI encoding and some
99  * auto-escaping.  On each local path, canonicalize case and path
100  * separators.
101  *
102  * Allocate *TARGETS_P and its elements in POOL.
103  *
104  * If a path has the same name as a Subversion working copy
105  * administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED;
106  * if multiple reserved paths are encountered, return a chain of
107  * errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED.  Do
108  * not return this type of error in a chain with any other type of
109  * error, and if this is the only type of error encountered, complete
110  * the operation before returning the error(s).
111  */
112 svn_error_t *
113 svn_opt__args_to_target_array(apr_array_header_t **targets_p,
114                               apr_getopt_t *os,
115                               const apr_array_header_t *known_targets,
116                               apr_pool_t *pool);
117
118 /**
119  * Return a human-readable description of @a revision.  The result
120  * will be allocated statically or from @a result_pool.
121  *
122  * @since New in 1.7.
123  */
124 const char *
125 svn_opt__revision_to_string(const svn_opt_revision_t *revision,
126                             apr_pool_t *result_pool);
127
128 /**
129  * Create a revision range structure from two revisions.  Return a new range
130  * allocated in @a result_pool with the start and end initialized to
131  * (deep copies of) @a *start_revision and @a *end_revision.
132  */
133 svn_opt_revision_range_t *
134 svn_opt__revision_range_create(const svn_opt_revision_t *start_revision,
135                                const svn_opt_revision_t *end_revision,
136                                apr_pool_t *result_pool);
137
138 /**
139  * Create a revision range structure from two revnums.  Return a new range
140  * allocated in @a result_pool with the start and end kinds initialized to
141  * #svn_opt_revision_number and values @a start_revnum and @a end_revnum.
142  */
143 svn_opt_revision_range_t *
144 svn_opt__revision_range_from_revnums(svn_revnum_t start_revnum,
145                                      svn_revnum_t end_revnum,
146                                      apr_pool_t *result_pool);
147
148 #ifdef __cplusplus
149 }
150 #endif /* __cplusplus */
151
152 #endif /* SVN_OPT_PRIVATE_H */