svn_path.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_path.h
00024  * @brief A path manipulation library
00025  *
00026  * All incoming and outgoing paths are non-NULL and in UTF-8, unless
00027  * otherwise documented.
00028  *
00029  * No result path ever ends with a separator, no matter whether the
00030  * path is a file or directory, because we always canonicalize() it.
00031  *
00032  * Nearly all the @c svn_path_xxx functions expect paths passed into
00033  * them to be in canonical form as defined by the Subversion path
00034  * library itself.  The only functions which do *not* have such
00035  * expectations are:
00036  *
00037  *    - @c svn_path_canonicalize()
00038  *    - @c svn_path_is_canonical()
00039  *    - @c svn_path_internal_style()
00040  *    - @c svn_path_uri_encode()
00041  *
00042  * For the most part, we mean what most anyone would mean when talking
00043  * about canonical paths, but to be on the safe side, you must run
00044  * your paths through @c svn_path_canonicalize() before passing them to
00045  * other functions in this API.
00046  */
00047 
00048 #ifndef SVN_PATH_H
00049 #define SVN_PATH_H
00050 
00051 #include <apr.h>
00052 #include <apr_pools.h>
00053 #include <apr_tables.h>
00054 
00055 #include "svn_types.h"
00056 #include "svn_string.h"
00057 #include "svn_dirent_uri.h"
00058 
00059 
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif /* __cplusplus */
00063 
00064 
00065 
00066 /** Convert @a path from the local style to the canonical internal style.
00067  *
00068  * @deprecated Provided for backward compatibility with the 1.6 API.
00069  * New code should use svn_dirent_internal_style().
00070  */
00071 SVN_DEPRECATED
00072 const char *
00073 svn_path_internal_style(const char *path, apr_pool_t *pool);
00074 
00075 /** Convert @a path from the canonical internal style to the local style.
00076  *
00077  * @deprecated Provided for backward compatibility with the 1.6 API.
00078  * New code should use svn_dirent_local_style().
00079  */
00080 SVN_DEPRECATED
00081 const char *
00082 svn_path_local_style(const char *path, apr_pool_t *pool);
00083 
00084 
00085 /** Join a base path (@a base) with a component (@a component), allocating
00086  * the result in @a pool. @a component need not be a single component: it
00087  * can be any path, absolute or relative to @a base.
00088  *
00089  * If either @a base or @a component is the empty path, then the other
00090  * argument will be copied and returned.  If both are the empty path the
00091  * empty path is returned.
00092  *
00093  * If the @a component is an absolute path, then it is copied and returned.
00094  * Exactly one slash character ('/') is used to join the components,
00095  * accounting for any trailing slash in @a base.
00096  *
00097  * Note that the contents of @a base are not examined, so it is possible to
00098  * use this function for constructing URLs, or for relative URLs or
00099  * repository paths.
00100  *
00101  * This function is NOT appropriate for native (local) file
00102  * paths. Only for "internal" canonicalized paths, since it uses '/'
00103  * for the separator. Further, an absolute path (for @a component) is
00104  * based on a leading '/' character.  Thus, an "absolute URI" for the
00105  * @a component won't be detected. An absolute URI can only be used
00106  * for the base.
00107  *
00108  * @deprecated Provided for backward compatibility with the 1.6 API.
00109  * New code should use svn_dirent_join(), svn_relpath_join() or
00110  * svn_fspath__join().
00111  */
00112 SVN_DEPRECATED
00113 char *
00114 svn_path_join(const char *base, const char *component, apr_pool_t *pool);
00115 
00116 /** Join multiple components onto a @a base path, allocated in @a pool. The
00117  * components are terminated by a @c SVN_VA_NULL.
00118  *
00119  * If any component is the empty string, it will be ignored.
00120  *
00121  * If any component is an absolute path, then it resets the base and
00122  * further components will be appended to it.
00123  *
00124  * This function does not support URLs.
00125  *
00126  * See svn_path_join() for further notes about joining paths.
00127  *
00128  * @deprecated Provided for backward compatibility with the 1.6 API.
00129  * For new code, consider using svn_dirent_join_many() or a sequence of
00130  * calls to one of the *_join() functions.
00131  */
00132 SVN_DEPRECATED
00133 char *
00134 svn_path_join_many(apr_pool_t *pool,
00135                    const char *base,
00136                    ...) SVN_NEEDS_SENTINEL_NULL;
00137 
00138 
00139 /** Get the basename of the specified canonicalized @a path.  The
00140  * basename is defined as the last component of the path (ignoring any
00141  * trailing slashes).  If the @a path is root ("/"), then that is
00142  * returned.  Otherwise, the returned value will have no slashes in
00143  * it.
00144  *
00145  * Example: svn_path_basename("/foo/bar") -> "bar"
00146  *
00147  * The returned basename will be allocated in @a pool.
00148  *
00149  * @note If an empty string is passed, then an empty string will be returned.
00150  *
00151  * @deprecated Provided for backward compatibility with the 1.6 API.
00152  * New code should use svn_dirent_basename(), svn_uri_basename(),
00153  * svn_relpath_basename() or svn_fspath__basename().
00154  */
00155 SVN_DEPRECATED
00156 char *
00157 svn_path_basename(const char *path, apr_pool_t *pool);
00158 
00159 /** Get the dirname of the specified canonicalized @a path, defined as
00160  * the path with its basename removed.  If @a path is root ("/"), it is
00161  * returned unchanged.
00162  *
00163  * The returned dirname will be allocated in @a pool.
00164  *
00165  * @deprecated Provided for backward compatibility with the 1.6 API.
00166  * New code should use svn_dirent_dirname(), svn_uri_dirname(),
00167  * svn_relpath_dirname() or svn_fspath__dirname().
00168  */
00169 SVN_DEPRECATED
00170 char *
00171 svn_path_dirname(const char *path, apr_pool_t *pool);
00172 
00173 /** Split @a path into a root portion and an extension such that
00174  * the root + the extension = the original path, and where the
00175  * extension contains no period (.) characters.  If not @c NULL, set
00176  * @a *path_root to the root portion.  If not @c NULL, set
00177  * @a *path_ext to the extension (or "" if there is no extension
00178  * found).  Allocate both @a *path_root and @a *path_ext in @a pool.
00179  *
00180  * @since New in 1.5.
00181  */
00182 void
00183 svn_path_splitext(const char **path_root, const char **path_ext,
00184                   const char *path, apr_pool_t *pool);
00185 
00186 /** Return the number of components in the canonicalized @a path.
00187  *
00188  * @since New in 1.1.
00189 */
00190 apr_size_t
00191 svn_path_component_count(const char *path);
00192 
00193 /** Add a @a component (a NULL-terminated C-string) to the
00194  * canonicalized @a path.  @a component is allowed to contain
00195  * directory separators.
00196  *
00197  * If @a path is non-empty, append the appropriate directory separator
00198  * character, and then @a component.  If @a path is empty, simply set it to
00199  * @a component; don't add any separator character.
00200  *
00201  * If the result ends in a separator character, then remove the separator.
00202  */
00203 void
00204 svn_path_add_component(svn_stringbuf_t *path, const char *component);
00205 
00206 /** Remove one component off the end of the canonicalized @a path. */
00207 void
00208 svn_path_remove_component(svn_stringbuf_t *path);
00209 
00210 /** Remove @a n components off the end of the canonicalized @a path.
00211  * Equivalent to calling svn_path_remove_component() @a n times.
00212  *
00213  * @since New in 1.1.
00214  */
00215 void
00216 svn_path_remove_components(svn_stringbuf_t *path, apr_size_t n);
00217 
00218 /** Divide the canonicalized @a path into @a *dirpath and @a
00219  * *base_name, allocated in @a pool.
00220  *
00221  * If @a dirpath or @a base_name is NULL, then don't set that one.
00222  *
00223  * Either @a dirpath or @a base_name may be @a path's own address, but they
00224  * may not both be the same address, or the results are undefined.
00225  *
00226  * If @a path has two or more components, the separator between @a dirpath
00227  * and @a base_name is not included in either of the new names.
00228  *
00229  *   examples:
00230  *             - <pre>"/foo/bar/baz"  ==>  "/foo/bar" and "baz"</pre>
00231  *             - <pre>"/bar"          ==>  "/"  and "bar"</pre>
00232  *             - <pre>"/"             ==>  "/"  and "/"</pre>
00233  *             - <pre>"X:/"           ==>  "X:/" and "X:/"</pre>
00234  *             - <pre>"bar"           ==>  ""   and "bar"</pre>
00235  *             - <pre>""              ==>  ""   and ""</pre>
00236  *
00237  * @deprecated Provided for backward compatibility with the 1.6 API.
00238  * New code should use svn_dirent_split(), svn_uri_split(),
00239  * svn_relpath_split() or svn_fspath__split().
00240  */
00241 SVN_DEPRECATED
00242 void
00243 svn_path_split(const char *path,
00244                const char **dirpath,
00245                const char **base_name,
00246                apr_pool_t *pool);
00247 
00248 
00249 /** Return non-zero iff @a path is empty ("") or represents the current
00250  * directory -- that is, if prepending it as a component to an existing
00251  * path would result in no meaningful change.
00252  */
00253 int
00254 svn_path_is_empty(const char *path);
00255 
00256 
00257 #ifndef SVN_DIRENT_URI_H
00258 /* This declaration has been moved to svn_dirent_uri.h, and remains
00259    here only for compatibility reasons. */
00260 svn_boolean_t
00261 svn_dirent_is_root(const char *dirent, apr_size_t len);
00262 #endif /* SVN_DIRENT_URI_H */
00263 
00264 
00265 /** Return a new path (or URL) like @a path, but transformed such that
00266  * some types of path specification redundancies are removed.
00267  *
00268  * This involves collapsing redundant "/./" elements, removing
00269  * multiple adjacent separator characters, removing trailing
00270  * separator characters, and possibly other semantically inoperative
00271  * transformations.
00272  *
00273  * Convert the scheme and hostname to lowercase (see issue #2475)
00274  *
00275  * The returned path may be statically allocated, equal to @a path, or
00276  * allocated from @a pool.
00277  *
00278  * @deprecated Provided for backward compatibility with the 1.6 API.
00279  * New code should use svn_dirent_canonicalize(), svn_uri_canonicalize(),
00280  * svn_relpath_canonicalize() or svn_fspath__canonicalize().
00281  */
00282 SVN_DEPRECATED
00283 const char *
00284 svn_path_canonicalize(const char *path, apr_pool_t *pool);
00285 
00286 /** Return @c TRUE iff path is canonical. Use @a pool for temporary
00287  * allocations.
00288  *
00289  * @since New in 1.5.
00290  * @deprecated Provided for backward compatibility with the 1.6 API.
00291  * New code should use svn_dirent_is_canonical(), svn_uri_is_canonical(),
00292  * svn_relpath_is_canonical() or svn_fspath__is_canonical().
00293  */
00294 SVN_DEPRECATED
00295 svn_boolean_t
00296 svn_path_is_canonical(const char *path, apr_pool_t *pool);
00297 
00298 
00299 /** Return an integer greater than, equal to, or less than 0, according
00300  * as @a path1 is greater than, equal to, or less than @a path2.
00301  *
00302  * This function works like strcmp() except that it orders children in
00303  * subdirectories directly after their parents. This allows using the
00304  * given ordering for a depth first walk.
00305  */
00306 int
00307 svn_path_compare_paths(const char *path1, const char *path2);
00308 
00309 
00310 /** Return the longest common path shared by two canonicalized paths,
00311  * @a path1 and @a path2.  If there's no common ancestor, return the
00312  * empty path.
00313  *
00314  * @a path1 and @a path2 may be URLs.  In order for two URLs to have
00315  * a common ancestor, they must (a) have the same protocol (since two URLs
00316  * with the same path but different protocols may point at completely
00317  * different resources), and (b) share a common ancestor in their path
00318  * component, i.e. 'protocol://' is not a sufficient ancestor.
00319  *
00320  * @deprecated Provided for backward compatibility with the 1.6 API.
00321  * New code should use svn_dirent_get_longest_ancestor(),
00322  * svn_uri_get_longest_ancestor(), svn_relpath_get_longest_ancestor() or
00323  * svn_fspath__get_longest_ancestor().
00324  */
00325 SVN_DEPRECATED
00326 char *
00327 svn_path_get_longest_ancestor(const char *path1,
00328                               const char *path2,
00329                               apr_pool_t *pool);
00330 
00331 /** Convert @a relative canonicalized path to an absolute path and
00332  * return the results in @a *pabsolute, allocated in @a pool.
00333  *
00334  * @a relative may be a URL, in which case no attempt is made to convert it,
00335  * and a copy of the URL is returned.
00336  *
00337  * @deprecated Provided for backward compatibility with the 1.6 API.
00338  * New code should use svn_dirent_get_absolute() on a non-URL input.
00339  */
00340 SVN_DEPRECATED
00341 svn_error_t *
00342 svn_path_get_absolute(const char **pabsolute,
00343                       const char *relative,
00344                       apr_pool_t *pool);
00345 
00346 /** Return the path part of the canonicalized @a path in @a
00347  * *pdirectory, and the file part in @a *pfile.  If @a path is a
00348  * directory, set @a *pdirectory to @a path, and @a *pfile to the
00349  * empty string.  If @a path does not exist it is treated as if it is
00350  * a file, since directories do not normally vanish.
00351  *
00352  * @deprecated Provided for backward compatibility with the 1.6 API.
00353  * New code should implement the required logic directly; no direct
00354  * replacement is provided.
00355  */
00356 SVN_DEPRECATED
00357 svn_error_t *
00358 svn_path_split_if_file(const char *path,
00359                        const char **pdirectory,
00360                        const char **pfile,
00361                        apr_pool_t *pool);
00362 
00363 /** Find the common prefix of the canonicalized paths in @a targets
00364  * (an array of <tt>const char *</tt>'s), and remove redundant paths if @a
00365  * remove_redundancies is TRUE.
00366  *
00367  *   - Set @a *pcommon to the absolute path of the path or URL common to
00368  *     all of the targets.  If the targets have no common prefix, or
00369  *     are a mix of URLs and local paths, set @a *pcommon to the
00370  *     empty string.
00371  *
00372  *   - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
00373  *     to an array of targets relative to @a *pcommon, and if
00374  *     @a remove_redundancies is TRUE, omit any paths/URLs that are
00375  *     descendants of another path/URL in @a targets.  If *pcommon
00376  *     is empty, @a *pcondensed_targets will contain full URLs and/or
00377  *     absolute paths; redundancies can still be removed (from both URLs
00378  *     and paths).  If @a pcondensed_targets is NULL, leave it alone.
00379  *
00380  * Else if there is exactly one target, then
00381  *
00382  *   - Set @a *pcommon to that target, and
00383  *
00384  *   - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
00385  *     to an array containing zero elements.  Else if
00386  *     @a pcondensed_targets is NULL, leave it alone.
00387  *
00388  * If there are no items in @a targets, set @a *pcommon and (if
00389  * applicable) @a *pcondensed_targets to @c NULL.
00390  *
00391  * @note There is no guarantee that @a *pcommon is within a working
00392  * copy.
00393  *
00394  * @deprecated Provided for backward compatibility with the 1.6 API.
00395  * New code should use svn_dirent_condense_targets() or
00396  * svn_uri_condense_targets().
00397  */
00398 SVN_DEPRECATED
00399 svn_error_t *
00400 svn_path_condense_targets(const char **pcommon,
00401                           apr_array_header_t **pcondensed_targets,
00402                           const apr_array_header_t *targets,
00403                           svn_boolean_t remove_redundancies,
00404                           apr_pool_t *pool);
00405 
00406 
00407 /** Copy a list of canonicalized @a targets, one at a time, into @a
00408  * pcondensed_targets, omitting any targets that are found earlier in
00409  * the list, or whose ancestor is found earlier in the list.  Ordering
00410  * of targets in the original list is preserved in the condensed list
00411  * of targets.  Use @a pool for any allocations.
00412  *
00413  * How does this differ in functionality from svn_path_condense_targets()?
00414  *
00415  * Here's the short version:
00416  *
00417  * 1.  Disclaimer: if you wish to debate the following, talk to Karl. :-)
00418  *     Order matters for updates because a multi-arg update is not
00419  *     atomic, and CVS users are used to, when doing 'cvs up targetA
00420  *     targetB' seeing targetA get updated, then targetB.  I think the
00421  *     idea is that if you're in a time-sensitive or flaky-network
00422  *     situation, a user can say, "I really *need* to update
00423  *     wc/A/D/G/tau, but I might as well update my whole working copy if
00424  *     I can."  So that user will do 'svn up wc/A/D/G/tau wc', and if
00425  *     something dies in the middles of the 'wc' update, at least the
00426  *     user has 'tau' up-to-date.
00427  *
00428  * 2.  Also, we have this notion of an anchor and a target for updates
00429  *     (the anchor is where the update editor is rooted, the target is
00430  *     the actual thing we want to update).  I needed a function that
00431  *     would NOT screw with my input paths so that I could tell the
00432  *     difference between someone being in A/D and saying 'svn up G' and
00433  *     being in A/D/G and saying 'svn up .' -- believe it or not, these
00434  *     two things don't mean the same thing.  svn_path_condense_targets()
00435  *     plays with absolute paths (which is fine, so does
00436  *     svn_path_remove_redundancies()), but the difference is that it
00437  *     actually tweaks those targets to be relative to the "grandfather
00438  *     path" common to all the targets.  Updates don't require a
00439  *     "grandfather path" at all, and even if it did, the whole
00440  *     conversion to an absolute path drops the crucial difference
00441  *     between saying "i'm in foo, update bar" and "i'm in foo/bar,
00442  *     update '.'"
00443  */
00444 svn_error_t *
00445 svn_path_remove_redundancies(apr_array_header_t **pcondensed_targets,
00446                              const apr_array_header_t *targets,
00447                              apr_pool_t *pool);
00448 
00449 
00450 /** Decompose the canonicalized @a path into an array of <tt>const
00451  * char *</tt> components, allocated in @a pool.  If @a path is
00452  * absolute, the first component will be a lone dir separator (the
00453  * root directory).
00454  */
00455 apr_array_header_t *
00456 svn_path_decompose(const char *path, apr_pool_t *pool);
00457 
00458 /** Join an array of <tt>const char *</tt> components into a '/'
00459  * separated path, allocated in @a pool.  The joined path is absolute if
00460  * the first component is a lone dir separator.
00461  *
00462  * Calling svn_path_compose() on the output of svn_path_decompose()
00463  * will return the exact same path.
00464  *
00465  * @since New in 1.5.
00466  */
00467 const char *
00468 svn_path_compose(const apr_array_header_t *components, apr_pool_t *pool);
00469 
00470 /** Test that @a name is a single path component, that is:
00471  *   - not @c NULL or empty.
00472  *   - not a `/'-separated directory path
00473  *   - not empty or `..'
00474  */
00475 svn_boolean_t
00476 svn_path_is_single_path_component(const char *name);
00477 
00478 
00479 /**
00480  * Test to see if a backpath, i.e. '..', is present in @a path.
00481  * If not, return @c FALSE.
00482  * If so, return @c TRUE.
00483  *
00484  * @since New in 1.1.
00485  */
00486 svn_boolean_t
00487 svn_path_is_backpath_present(const char *path);
00488 
00489 
00490 /**
00491  * Test to see if a dotpath, i.e. '.', is present in @a path.
00492  * If not, return @c FALSE.
00493  * If so, return @c TRUE.
00494  *
00495  * @since New in 1.6.
00496  */
00497 svn_boolean_t
00498 svn_path_is_dotpath_present(const char *path);
00499 
00500 
00501 /** Test if @a path2 is a child of @a path1.
00502  * If not, return @c NULL.
00503  * If so, return a copy of the remainder path, allocated in @a pool.
00504  * (The remainder is the component which, added to @a path1, yields
00505  * @a path2.  The remainder does not begin with a dir separator.)
00506  *
00507  * Both paths must be in canonical form, and must either be absolute,
00508  * or contain no ".." components.
00509  *
00510  * If @a path2 is the same as @a path1, it is not considered a child, so the
00511  * result is @c NULL; an empty string is never returned.
00512  *
00513  * @note In 1.5 this function has been extended to allow a @c NULL @a pool
00514  *       in which case a pointer into @a path2 will be returned to
00515  *       identify the remainder path.
00516  *
00517  * @deprecated Provided for backward compatibility with the 1.6 API.
00518  * For replacement functionality, see svn_dirent_skip_ancestor(),
00519  * svn_dirent_is_child(), svn_uri_skip_ancestor(), and
00520  * svn_relpath_skip_ancestor().
00521  */
00522 SVN_DEPRECATED
00523 const char *
00524 svn_path_is_child(const char *path1, const char *path2, apr_pool_t *pool);
00525 
00526 /** Return TRUE if @a path1 is an ancestor of @a path2 or the paths are equal
00527  * and FALSE otherwise.
00528  *
00529  * @since New in 1.3.
00530  *
00531  * @deprecated Provided for backward compatibility with the 1.6 API.
00532  * For replacement functionality, see svn_dirent_skip_ancestor(),
00533  * svn_uri_skip_ancestor(), and svn_relpath_skip_ancestor().
00534  */
00535 SVN_DEPRECATED
00536 svn_boolean_t
00537 svn_path_is_ancestor(const char *path1, const char *path2);
00538 
00539 /**
00540  * Check whether @a path is a valid Subversion path.
00541  *
00542  * A valid Subversion pathname is a UTF-8 string without control
00543  * characters.  "Valid" means Subversion can store the pathname in
00544  * a repository.  There may be other, OS-specific, limitations on
00545  * what paths can be represented in a working copy.
00546  *
00547  * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
00548  * not check UTF-8 validity.
00549  *
00550  * Return @c SVN_NO_ERROR if valid and @c SVN_ERR_FS_PATH_SYNTAX if
00551  * invalid.
00552  *
00553  * @note Despite returning an @c SVN_ERR_FS_* error, this function has
00554  * nothing to do with the versioned filesystem's concept of validity.
00555  *
00556  * @since New in 1.2.
00557  */
00558 svn_error_t *
00559 svn_path_check_valid(const char *path, apr_pool_t *pool);
00560 
00561 
00562 /** URI/URL stuff
00563  *
00564  * @defgroup svn_path_uri_stuff URI/URL conversion
00565  * @{
00566  */
00567 
00568 /** Return TRUE iff @a path looks like a valid absolute URL. */
00569 svn_boolean_t
00570 svn_path_is_url(const char *path);
00571 
00572 /** Return @c TRUE iff @a path is URI-safe, @c FALSE otherwise. */
00573 svn_boolean_t
00574 svn_path_is_uri_safe(const char *path);
00575 
00576 /** Return a URI-encoded copy of @a path, allocated in @a pool.  (@a
00577     path can be an arbitrary UTF-8 string and does not have to be a
00578     canonical path.) */
00579 const char *
00580 svn_path_uri_encode(const char *path, apr_pool_t *pool);
00581 
00582 /** Return a URI-decoded copy of @a path, allocated in @a pool. */
00583 const char *
00584 svn_path_uri_decode(const char *path, apr_pool_t *pool);
00585 
00586 /** Extend @a url by @a component, URI-encoding that @a component
00587  * before adding it to the @a url; return the new @a url, allocated in
00588  * @a pool.  If @a component is @c NULL, just return a copy of @a url,
00589  * allocated in @a pool.
00590  *
00591  * @a component need not be a single path segment, but if it contains
00592  * multiple segments, they must be separated by '/'.  @a component
00593  * should not begin with '/', however; if it does, the behavior is
00594  * undefined.
00595  *
00596  * @a url must be in canonical format; it may not have a trailing '/'.
00597  *
00598  * @note To add a component that is already URI-encoded, use
00599  *       <tt>svn_path_join(url, component, pool)</tt> instead.
00600  *
00601  * @note gstein suggests this for when @a component begins with '/':
00602  *
00603  *       "replace the path entirely
00604  *        https://example.com:4444/base/path joined with /leading/slash,
00605  *        should return: https://example.com:4444/leading/slash
00606  *        per the RFCs on combining URIs"
00607  *
00608  *       We may implement that someday, which is why leading '/' is
00609  *       merely undefined right now.
00610  *
00611  * @since New in 1.6.
00612  */
00613 const char *
00614 svn_path_url_add_component2(const char *url,
00615                             const char *component,
00616                             apr_pool_t *pool);
00617 
00618 /** Like svn_path_url_add_component2(), but allows path components that
00619  * end with a trailing '/'
00620  *
00621  * @deprecated Provided for backward compatibility with the 1.5 API.
00622  */
00623 SVN_DEPRECATED
00624 const char *
00625 svn_path_url_add_component(const char *url,
00626                            const char *component,
00627                            apr_pool_t *pool);
00628 
00629 /**
00630  * Convert @a iri (Internationalized URI) to an URI.
00631  * The return value may be the same as @a iri if it was already
00632  * a URI.  Else, allocate the return value in @a pool.
00633  *
00634  * @since New in 1.1.
00635  */
00636 const char *
00637 svn_path_uri_from_iri(const char *iri, apr_pool_t *pool);
00638 
00639 /**
00640  * URI-encode certain characters in @a uri that are not valid in an URI, but
00641  * doesn't have any special meaning in @a uri at their positions.  If no
00642  * characters need escaping, just return @a uri.
00643  *
00644  * @note Currently, this function escapes <, >, ", space, {, }, |, \, ^, and `.
00645  * This may be extended in the future to do context-dependent escaping.
00646  *
00647  * @since New in 1.1.
00648  */
00649 const char *
00650 svn_path_uri_autoescape(const char *uri, apr_pool_t *pool);
00651 
00652 /** @} */
00653 
00654 /** Charset conversion stuff
00655  *
00656  * @defgroup svn_path_charset_stuff Charset conversion
00657  * @{
00658  */
00659 
00660 /** Convert @a path_utf8 from UTF-8 to the internal encoding used by APR. */
00661 svn_error_t *
00662 svn_path_cstring_from_utf8(const char **path_apr,
00663                            const char *path_utf8,
00664                            apr_pool_t *pool);
00665 
00666 /** Convert @a path_apr from the internal encoding used by APR to UTF-8. */
00667 svn_error_t *
00668 svn_path_cstring_to_utf8(const char **path_utf8,
00669                          const char *path_apr,
00670                          apr_pool_t *pool);
00671 
00672 
00673 /** @} */
00674 
00675 
00676 /** Repository relative URLs
00677  *
00678  * @defgroup svn_path_repos_relative_urls Repository relative URLs
00679  * @{
00680  */
00681 
00682 /**
00683  * Return @c TRUE iff @a path is a repository-relative URL:  specifically
00684  * that it starts with the characters "^/"
00685  *
00686  * @a path is in UTF-8 encoding.
00687  *
00688  * Does not check whether @a path is a properly URI-encoded, canonical, or
00689  * valid in any other way.
00690  *
00691  * @since New in 1.8.
00692  */
00693 svn_boolean_t
00694 svn_path_is_repos_relative_url(const char *path);
00695 
00696 /**
00697  * Set @a absolute_url to the absolute URL represented by @a relative_url
00698  * relative to @a repos_root_url, preserving any peg revision
00699  * specifier present in @a relative_url.  Allocate @a absolute_url
00700  * from @a pool.
00701  *
00702  * @a relative_url is in repository-relative syntax: "^/[REL-URL][@PEG]"
00703  *
00704  * @a repos_root_url is the absolute URL of the repository root.
00705  *
00706  * All strings are in UTF-8 encoding.
00707  *
00708  * @a repos_root_url and @a relative_url do not have to be properly
00709  * URI-encoded, canonical, or valid in any other way.  The caller is
00710  * expected to perform canonicalization on @a absolute_url after the
00711  * call to the function.
00712  *
00713  * @since New in 1.8.
00714  */
00715 svn_error_t *
00716 svn_path_resolve_repos_relative_url(const char **absolute_url,
00717                                     const char *relative_url,
00718                                     const char *repos_root_url,
00719                                     apr_pool_t *pool);
00720 
00721 /** Return a copy of @a path, allocated from @a pool, for which control
00722  * characters have been escaped using the form "\NNN" (where NNN is the
00723  * octal representation of the byte's ordinal value).
00724  *
00725  * @since New in 1.8. */
00726 const char *
00727 svn_path_illegal_path_escape(const char *path, apr_pool_t *pool);
00728 
00729 /** @} */
00730 
00731 #ifdef __cplusplus
00732 }
00733 #endif /* __cplusplus */
00734 
00735 
00736 #endif /* SVN_PATH_H */

Generated on Tue Aug 4 16:57:47 2015 for Subversion by  doxygen 1.4.7