TortoiseGitMerge: Updated libsvn stuff
[TortoiseGit.git] / src / TortoiseMerge / libsvn_diff / private / svn_fspath.h
blobc9ce0370c920cbfd05655019a6919f70754fc30d
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
23 * @file svn_fspath.h
24 * @brief Implementation of path manipulation functions similar to
25 * those in svn_dirent_uri.h (which see for details) but for
26 * the private fspath class of paths.
29 #ifndef SVN_FSPATH_H
30 #define SVN_FSPATH_H
32 #include <apr.h>
33 #include <apr_pools.h>
35 #include "svn_types.h"
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
42 /** Return TRUE iff @a fspath is canonical.
43 * @a fspath need not be canonical, of course.
45 * @since New in 1.7.
47 svn_boolean_t
48 svn_fspath__is_canonical(const char *fspath);
51 /** This function is similar to svn_relpath_canonicalize(), except
52 * that it returns an fspath (which is essentially just a relpath
53 * tacked onto a leading forward slash).
55 * The returned fspath may be statically allocated or allocated from
56 * @a pool.
58 * This is similar to svn_fs__canonicalize_abspath() but also treats "."
59 * segments as special.
61 * @since New in 1.7.
63 const char *
64 svn_fspath__canonicalize(const char *fspath,
65 apr_pool_t *pool);
67 /** Return the dirname of @a fspath, defined as the path with its basename
68 * removed. If @a fspath is "/", return "/".
70 * Allocate the result in @a pool.
72 * @since New in 1.7.
74 const char *
75 svn_fspath__dirname(const char *fspath,
76 apr_pool_t *pool);
78 /** Return the last component of @a fspath. The returned value will have no
79 * slashes in it. If @a fspath is "/", return "".
81 * If @a pool is NULL, return a pointer to within @a fspath, else allocate
82 * the result in @a pool.
84 * @since New in 1.7.
86 const char *
87 svn_fspath__basename(const char *fspath,
88 apr_pool_t *pool);
90 /** Divide the canonical @a fspath into @a *dirpath and @a
91 * *base_name, allocated in @a pool.
93 * If @a dirpath or @a base_name is NULL, then don't set that one.
95 * Either @a dirpath or @a base_name may be @a fspath's own address, but they
96 * may not both be the same address, or the results are undefined.
98 * If @a fspath has two or more components, the separator between @a dirpath
99 * and @a base_name is not included in either of the new names.
101 * @since New in 1.7.
103 void
104 svn_fspath__split(const char **dirpath,
105 const char **base_name,
106 const char *fspath,
107 apr_pool_t *result_pool);
109 /** Return the fspath composed of @a fspath with @a relpath appended.
110 * Allocate the result in @a result_pool.
112 * @since New in 1.7.
114 char *
115 svn_fspath__join(const char *fspath,
116 const char *relpath,
117 apr_pool_t *result_pool);
120 /** Return TRUE if @a fspath (with length @a len) is the root
121 * directory; return FALSE otherwise.
123 * @since New in 1.7.
125 svn_boolean_t
126 svn_fspath__is_root(const char *fspath,
127 apr_size_t len);
129 /** Return the relative path part of @a child_fspath that is below
130 * @a parent_fspath, or just "" if @a parent_fspath is equal to
131 * @a child_fspath. If @a child_fspath is not below @a parent_fspath
132 * or equal to it, return @c NULL.
134 * @since New in 1.7.
136 const char *
137 svn_fspath__skip_ancestor(const char *parent_fspath,
138 const char *child_fspath);
140 /** Return the longest common path shared by two fspaths, @a fspath1 and
141 * @a fspath2. If there's no common ancestor, return "/".
143 * @since New in 1.7.
145 char *
146 svn_fspath__get_longest_ancestor(const char *fspath1,
147 const char *fspath2,
148 apr_pool_t *result_pool);
153 /** A faux fspath API used by the DAV modules to help us distinguish
154 * between real URI-decoded fspaths and URI-encoded URL path-portions.
156 #define svn_urlpath__basename svn_fspath__basename
157 #define svn_urlpath__dirname svn_fspath__dirname
158 #define svn_urlpath__get_longest_ancestor svn_fspath__get_longest_ancestor
159 #define svn_urlpath__is_canonical svn_fspath__is_canonical
160 #define svn_urlpath__is_root svn_fspath__is_root
161 #define svn_urlpath__join svn_fspath__join
162 #define svn_urlpath__skip_ancestor svn_fspath__skip_ancestor
163 #define svn_urlpath__split svn_fspath__split
165 /* Like svn_fspath__canonicalize(), but this one accepts both full
166 URLs and URL path-portions. */
167 const char *
168 svn_urlpath__canonicalize(const char *uri, apr_pool_t *pool);
171 #ifdef __cplusplus
173 #endif /* __cplusplus */
175 #endif /* SVN_FSPATH_H */