Subversion
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_uri_join(),
00110  * svn_relpath_join() or 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 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, const char *base, ...);
00135 
00136 
00137 /** Get the basename of the specified canonicalized @a path.  The
00138  * basename is defined as the last component of the path (ignoring any
00139  * trailing slashes).  If the @a path is root ("/"), then that is
00140  * returned.  Otherwise, the returned value will have no slashes in
00141  * it.
00142  *
00143  * Example: svn_path_basename("/foo/bar") -> "bar"
00144  *
00145  * The returned basename will be allocated in @a pool.
00146  *
00147  * @note If an empty string is passed, then an empty string will be returned.
00148  *
00149  * @deprecated Provided for backward compatibility with the 1.6 API.
00150  * New code should use svn_dirent_basename(), svn_uri_basename(),
00151  * svn_relpath_basename() or svn_fspath__basename().
00152  */
00153 SVN_DEPRECATED
00154 char *
00155 svn_path_basename(const char *path, apr_pool_t *pool);
00156 
00157 /** Get the dirname of the specified canonicalized @a path, defined as
00158  * the path with its basename removed.  If @a path is root ("/"), it is
00159  * returned unchanged.
00160  *
00161  * The returned dirname will be allocated in @a pool.
00162  *
00163  * @deprecated Provided for backward compatibility with the 1.6 API.
00164  * New code should use svn_dirent_dirname(), svn_uri_dirname(),
00165  * svn_relpath_dirname() or svn_fspath__dirname().
00166  */
00167 SVN_DEPRECATED
00168 char *
00169 svn_path_dirname(const char *path, apr_pool_t *pool);
00170 
00171 /** Split @a path into a root portion and an extension such that
00172  * the root + the extension = the original path, and where the
00173  * extension contains no period (.) characters.  If not @c NULL, set
00174  * @a *path_root to the root portion.  If not @c NULL, set
00175  * @a *path_ext to the extension (or "" if there is no extension
00176  * found).  Allocate both @a *path_root and @a *path_ext in @a pool.
00177  *
00178  * @since New in 1.5.
00179  */
00180 void
00181 svn_path_splitext(const char **path_root, const char **path_ext,
00182                   const char *path, apr_pool_t *pool);
00183 
00184 /** Return the number of components in the canonicalized @a path.
00185  *
00186  * @since New in 1.1.
00187 */
00188 apr_size_t
00189 svn_path_component_count(const char *path);
00190 
00191 /** Add a @a component (a NULL-terminated C-string) to the
00192  * canonicalized @a path.  @a component is allowed to contain
00193  * directory separators.
00194  *
00195  * If @a path is non-empty, append the appropriate directory separator
00196  * character, and then @a component.  If @a path is empty, simply set it to
00197  * @a component; don't add any separator character.
00198  *
00199  * If the result ends in a separator character, then remove the separator.
00200  */
00201 void
00202 svn_path_add_component(svn_stringbuf_t *path, const char *component);
00203 
00204 /** Remove one component off the end of the canonicalized @a path. */
00205 void
00206 svn_path_remove_component(svn_stringbuf_t *path);
00207 
00208 /** Remove @a n components off the end of the canonicalized @a path.
00209  * Equivalent to calling svn_path_remove_component() @a n times.
00210  *
00211  * @since New in 1.1.
00212  */
00213 void
00214 svn_path_remove_components(svn_stringbuf_t *path, apr_size_t n);
00215 
00216 /** Divide the canonicalized @a path into @a *dirpath and @a
00217  * *base_name, allocated in @a pool.
00218  *
00219  * If @a dirpath or @a base_name is NULL, then don't set that one.
00220  *
00221  * Either @a dirpath or @a base_name may be @a path's own address, but they
00222  * may not both be the same address, or the results are undefined.
00223  *
00224  * If @a path has two or more components, the separator between @a dirpath
00225  * and @a base_name is not included in either of the new names.
00226  *
00227  *   examples:
00228  *             - <pre>"/foo/bar/baz"  ==>  "/foo/bar" and "baz"</pre>
00229  *             - <pre>"/bar"          ==>  "/"  and "bar"</pre>
00230  *             - <pre>"/"             ==>  "/"  and "/"</pre>
00231  *             - <pre>"X:/"           ==>  "X:/" and "X:/"</pre>
00232  *             - <pre>"bar"           ==>  ""   and "bar"</pre>
00233  *             - <pre>""              ==>  ""   and ""</pre>
00234  *
00235  * @deprecated Provided for backward compatibility with the 1.6 API.
00236  * New code should use svn_dirent_split(), svn_uri_split(),
00237  * svn_relpath_split() or svn_fspath__split().
00238  */
00239 SVN_DEPRECATED
00240 void
00241 svn_path_split(const char *path,
00242                const char **dirpath,
00243                const char **base_name,
00244                apr_pool_t *pool);
00245 
00246 
00247 /** Return non-zero iff @a path is empty ("") or represents the current
00248  * directory -- that is, if prepending it as a component to an existing
00249  * path would result in no meaningful change.
00250  */
00251 int
00252 svn_path_is_empty(const char *path);
00253 
00254 
00255 #ifndef SVN_DIRENT_URI_H
00256 /* This declaration has been moved to svn_dirent_uri.h, and remains
00257    here only for compatibility reasons. */
00258 svn_boolean_t
00259 svn_dirent_is_root(const char *dirent, apr_size_t len);
00260 #endif /* SVN_DIRENT_URI_H */
00261 
00262 
00263 /** Return a new path (or URL) like @a path, but transformed such that
00264  * some types of path specification redundancies are removed.
00265  *
00266  * This involves collapsing redundant "/./" elements, removing
00267  * multiple adjacent separator characters, removing trailing
00268  * separator characters, and possibly other semantically inoperative
00269  * transformations.
00270  *
00271  * Convert the scheme and hostname to lowercase (see issue #2475)
00272  *
00273  * The returned path may be statically allocated, equal to @a path, or
00274  * allocated from @a pool.
00275  *
00276  * @deprecated Provided for backward compatibility with the 1.6 API.
00277  * New code should use svn_dirent_canonicalize(), svn_uri_canonicalize(),
00278  * svn_relpath_canonicalize() or svn_fspath__canonicalize().
00279  */
00280 SVN_DEPRECATED
00281 const char *
00282 svn_path_canonicalize(const char *path, apr_pool_t *pool);
00283 
00284 /** Return @c TRUE iff path is canonical. Use @a pool for temporary
00285  * allocations.
00286  *
00287  * @since New in 1.5.
00288  * @deprecated Provided for backward compatibility with the 1.6 API.
00289  * New code should use svn_dirent_is_canonical(), svn_uri_is_canonical(),
00290  * svn_relpath_is_canonical() or svn_fspath__is_canonical().
00291  */
00292 SVN_DEPRECATED
00293 svn_boolean_t
00294 svn_path_is_canonical(const char *path, apr_pool_t *pool);
00295 
00296 
00297 /** Return an integer greater than, equal to, or less than 0, according
00298  * as @a path1 is greater than, equal to, or less than @a path2.
00299  */
00300 int
00301 svn_path_compare_paths(const char *path1, const char *path2);
00302 
00303 
00304 /** Return the longest common path shared by two canonicalized paths,
00305  * @a path1 and @a path2.  If there's no common ancestor, return the
00306  * empty path.
00307  *
00308  * @a path1 and @a path2 may be URLs.  In order for two URLs to have
00309  * a common ancestor, they must (a) have the same protocol (since two URLs
00310  * with the same path but different protocols may point at completely
00311  * different resources), and (b) share a common ancestor in their path
00312  * component, i.e. 'protocol://' is not a sufficient ancestor.
00313  *
00314  * @deprecated Provided for backward compatibility with the 1.6 API.
00315  * New code should use svn_dirent_get_longest_ancestor(),
00316  * svn_uri_get_longest_ancestor(), svn_relpath_get_longest_ancestor() or
00317  * svn_fspath__get_longest_ancestor().
00318  */
00319 SVN_DEPRECATED
00320 char *
00321 svn_path_get_longest_ancestor(const char *path1,
00322                               const char *path2,
00323                               apr_pool_t *pool);
00324 
00325 /** Convert @a relative canonicalized path to an absolute path and
00326  * return the results in @a *pabsolute, allocated in @a pool.
00327  *
00328  * @a relative may be a URL, in which case no attempt is made to convert it,
00329  * and a copy of the URL is returned.
00330  *
00331  * @deprecated Provided for backward compatibility with the 1.6 API.
00332  * New code should use svn_dirent_get_absolute() on a non-URL input.
00333  */
00334 SVN_DEPRECATED
00335 svn_error_t *
00336 svn_path_get_absolute(const char **pabsolute,
00337                       const char *relative,
00338                       apr_pool_t *pool);
00339 
00340 /** Return the path part of the canonicalized @a path in @a
00341  * *pdirectory, and the file part in @a *pfile.  If @a path is a
00342  * directory, set @a *pdirectory to @a path, and @a *pfile to the
00343  * empty string.  If @a path does not exist it is treated as if it is
00344  * a file, since directories do not normally vanish.
00345  *
00346  * @deprecated Provided for backward compatibility with the 1.6 API.
00347  * New code should implement the required logic directly; no direct
00348  * replacement is provided.
00349  */
00350 SVN_DEPRECATED
00351 svn_error_t *
00352 svn_path_split_if_file(const char *path,
00353                        const char **pdirectory,
00354                        const char **pfile,
00355                        apr_pool_t *pool);
00356 
00357 /** Find the common prefix of the canonicalized paths in @a targets
00358  * (an array of <tt>const char *</tt>'s), and remove redundant paths if @a
00359  * remove_redundancies is TRUE.
00360  *
00361  *   - Set @a *pcommon to the absolute path of the path or URL common to
00362  *     all of the targets.  If the targets have no common prefix, or
00363  *     are a mix of URLs and local paths, set @a *pcommon to the
00364  *     empty string.
00365  *
00366  *   - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
00367  *     to an array of targets relative to @a *pcommon, and if
00368  *     @a remove_redundancies is TRUE, omit any paths/URLs that are
00369  *     descendants of another path/URL in @a targets.  If *pcommon
00370  *     is empty, @a *pcondensed_targets will contain full URLs and/or
00371  *     absolute paths; redundancies can still be removed (from both URLs
00372  *     and paths).  If @a pcondensed_targets is NULL, leave it alone.
00373  *
00374  * Else if there is exactly one target, then
00375  *
00376  *   - Set @a *pcommon to that target, and
00377  *
00378  *   - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
00379  *     to an array containing zero elements.  Else if
00380  *     @a pcondensed_targets is NULL, leave it alone.
00381  *
00382  * If there are no items in @a targets, set @a *pcommon and (if
00383  * applicable) @a *pcondensed_targets to @c NULL.
00384  *
00385  * @note There is no guarantee that @a *pcommon is within a working
00386  * copy.
00387  *
00388  * @deprecated Provided for backward compatibility with the 1.6 API.
00389  * New code should use svn_dirent_condense_targets() or
00390  * svn_uri_condense_targets().
00391  */
00392 SVN_DEPRECATED
00393 svn_error_t *
00394 svn_path_condense_targets(const char **pcommon,
00395                           apr_array_header_t **pcondensed_targets,
00396                           const apr_array_header_t *targets,
00397                           svn_boolean_t remove_redundancies,
00398                           apr_pool_t *pool);
00399 
00400 
00401 /** Copy a list of canonicalized @a targets, one at a time, into @a
00402  * pcondensed_targets, omitting any targets that are found earlier in
00403  * the list, or whose ancestor is found earlier in the list.  Ordering
00404  * of targets in the original list is preserved in the condensed list
00405  * of targets.  Use @a pool for any allocations.
00406  *
00407  * How does this differ in functionality from svn_path_condense_targets()?
00408  *
00409  * Here's the short version:
00410  *
00411  * 1.  Disclaimer: if you wish to debate the following, talk to Karl. :-)
00412  *     Order matters for updates because a multi-arg update is not
00413  *     atomic, and CVS users are used to, when doing 'cvs up targetA
00414  *     targetB' seeing targetA get updated, then targetB.  I think the
00415  *     idea is that if you're in a time-sensitive or flaky-network
00416  *     situation, a user can say, "I really *need* to update
00417  *     wc/A/D/G/tau, but I might as well update my whole working copy if
00418  *     I can."  So that user will do 'svn up wc/A/D/G/tau wc', and if
00419  *     something dies in the middles of the 'wc' update, at least the
00420  *     user has 'tau' up-to-date.
00421  *
00422  * 2.  Also, we have this notion of an anchor and a target for updates
00423  *     (the anchor is where the update editor is rooted, the target is
00424  *     the actual thing we want to update).  I needed a function that
00425  *     would NOT screw with my input paths so that I could tell the
00426  *     difference between someone being in A/D and saying 'svn up G' and
00427  *     being in A/D/G and saying 'svn up .' -- believe it or not, these
00428  *     two things don't mean the same thing.  svn_path_condense_targets()
00429  *     plays with absolute paths (which is fine, so does
00430  *     svn_path_remove_redundancies()), but the difference is that it
00431  *     actually tweaks those targets to be relative to the "grandfather
00432  *     path" common to all the targets.  Updates don't require a
00433  *     "grandfather path" at all, and even if it did, the whole
00434  *     conversion to an absolute path drops the crucial difference
00435  *     between saying "i'm in foo, update bar" and "i'm in foo/bar,
00436  *     update '.'"
00437  */
00438 svn_error_t *
00439 svn_path_remove_redundancies(apr_array_header_t **pcondensed_targets,
00440                              const apr_array_header_t *targets,
00441                              apr_pool_t *pool);
00442 
00443 
00444 /** Decompose the canonicalized @a path into an array of <tt>const
00445  * char *</tt> components, allocated in @a pool.  If @a path is
00446  * absolute, the first component will be a lone dir separator (the
00447  * root directory).
00448  */
00449 apr_array_header_t *
00450 svn_path_decompose(const char *path, apr_pool_t *pool);
00451 
00452 /** Join an array of <tt>const char *</tt> components into a '/'
00453  * separated path, allocated in @a pool.  The joined path is absolute if
00454  * the first component is a lone dir separator.
00455  *
00456  * Calling svn_path_compose() on the output of svn_path_decompose()
00457  * will return the exact same path.
00458  *
00459  * @since New in 1.5.
00460  */
00461 const char *
00462 svn_path_compose(const apr_array_header_t *components, apr_pool_t *pool);
00463 
00464 /** Test that @a name is a single path component, that is:
00465  *   - not @c NULL or empty.
00466  *   - not a `/'-separated directory path
00467  *   - not empty or `..'
00468  */
00469 svn_boolean_t
00470 svn_path_is_single_path_component(const char *name);
00471 
00472 
00473 /**
00474  * Test to see if a backpath, i.e. '..', is present in @a path.
00475  * If not, return @c FALSE.
00476  * If so, return @c TRUE.
00477  *
00478  * @since New in 1.1.
00479  */
00480 svn_boolean_t
00481 svn_path_is_backpath_present(const char *path);
00482 
00483 
00484 /**
00485  * Test to see if a dotpath, i.e. '.', is present in @a path.
00486  * If not, return @c FALSE.
00487  * If so, return @c TRUE.
00488  *
00489  * @since New in 1.6.
00490  */
00491 svn_boolean_t
00492 svn_path_is_dotpath_present(const char *path);
00493 
00494 
00495 /** Test if @a path2 is a child of @a path1.
00496  * If not, return @c NULL.
00497  * If so, return a copy of the remainder path, allocated in @a pool.
00498  * (The remainder is the component which, added to @a path1, yields
00499  * @a path2.  The remainder does not begin with a dir separator.)
00500  *
00501  * Both paths must be in canonical form, and must either be absolute,
00502  * or contain no ".." components.
00503  *
00504  * If @a path2 is the same as @a path1, it is not considered a child, so the
00505  * result is @c NULL; an empty string is never returned.
00506  *
00507  * @note In 1.5 this function has been extended to allow a @c NULL @a pool
00508  *       in which case a pointer into @a path2 will be returned to
00509  *       identify the remainder path.
00510  *
00511  * @deprecated Provided for backward compatibility with the 1.6 API.
00512  * New code should use svn_dirent_is_child(), svn_uri_is_child(),
00513  * svn_relpath_is_child() or svn_fspath__is_child().
00514  */
00515 SVN_DEPRECATED
00516 const char *
00517 svn_path_is_child(const char *path1, const char *path2, apr_pool_t *pool);
00518 
00519 /** Return TRUE if @a path1 is an ancestor of @a path2 or the paths are equal
00520  * and FALSE otherwise.
00521  *
00522  * @since New in 1.3.
00523  *
00524  * @deprecated Provided for backward compatibility with the 1.6 API.
00525  * New code should use svn_dirent_is_ancestor(), svn_uri_is_ancestor(),
00526  * svn_relpath_is_ancestor() or svn_fspath__is_ancestor().
00527  */
00528 SVN_DEPRECATED
00529 svn_boolean_t
00530 svn_path_is_ancestor(const char *path1, const char *path2);
00531 
00532 /**
00533  * Check whether @a path is a valid Subversion path.
00534  *
00535  * A valid Subversion pathname is a UTF-8 string without control
00536  * characters.  "Valid" means Subversion can store the pathname in
00537  * a repository.  There may be other, OS-specific, limitations on
00538  * what paths can be represented in a working copy.
00539  *
00540  * ASSUMPTION: @a path is a valid UTF-8 string.  This function does
00541  * not check UTF-8 validity.
00542  *
00543  * Return @c SVN_NO_ERROR if valid and @c SVN_ERR_FS_PATH_SYNTAX if
00544  * invalid.
00545  *
00546  * @note Despite returning an @c SVN_ERR_FS_* error, this function has
00547  * nothing to do with the versioned filesystem's concept of validity.
00548  *
00549  * @since New in 1.2.
00550  */
00551 svn_error_t *
00552 svn_path_check_valid(const char *path, apr_pool_t *pool);
00553 
00554 
00555 /** URI/URL stuff
00556  *
00557  * @defgroup svn_path_uri_stuff URI/URL conversion
00558  * @{
00559  */
00560 
00561 /** Return TRUE iff @a path looks like a valid absolute URL. */
00562 svn_boolean_t
00563 svn_path_is_url(const char *path);
00564 
00565 /** Return @c TRUE iff @a path is URI-safe, @c FALSE otherwise. */
00566 svn_boolean_t
00567 svn_path_is_uri_safe(const char *path);
00568 
00569 /** Return a URI-encoded copy of @a path, allocated in @a pool.  (@a
00570     path can be an arbitrary UTF-8 string and does not have to be a
00571     canonical path.) */
00572 const char *
00573 svn_path_uri_encode(const char *path, apr_pool_t *pool);
00574 
00575 /** Return a URI-decoded copy of @a path, allocated in @a pool. */
00576 const char *
00577 svn_path_uri_decode(const char *path, apr_pool_t *pool);
00578 
00579 /** Extend @a url by @a component, URI-encoding that @a component
00580  * before adding it to the @a url; return the new @a url, allocated in
00581  * @a pool.  If @a component is @c NULL, just return a copy of @a url,
00582  * allocated in @a pool.
00583  *
00584  * @a component need not be a single path segment, but if it contains
00585  * multiple segments, they must be separated by '/'.  @a component
00586  * should not begin with '/', however; if it does, the behavior is
00587  * undefined.
00588  *
00589  * @a url must be in canonical format; it may not have a trailing '/'.
00590  *
00591  * @note To add a component that is already URI-encoded, use
00592  *       <tt>svn_path_join(url, component, pool)</tt> instead.
00593  *
00594  * @note gstein suggests this for when @a component begins with '/':
00595  *
00596  *       "replace the path entirely
00597  *        https://example.com:4444/base/path joined with /leading/slash,
00598  *        should return: https://example.com:4444/leading/slash
00599  *        per the RFCs on combining URIs"
00600  *
00601  *       We may implement that someday, which is why leading '/' is
00602  *       merely undefined right now.
00603  *
00604  * @since New in 1.6.
00605  */
00606 const char *
00607 svn_path_url_add_component2(const char *url,
00608                             const char *component,
00609                             apr_pool_t *pool);
00610 
00611 /** Like svn_path_url_add_component2(), but allows path components that
00612  * end with a trailing '/'
00613  *
00614  * @deprecated Provided for backward compatibility with the 1.5 API.
00615  */
00616 SVN_DEPRECATED
00617 const char *
00618 svn_path_url_add_component(const char *url,
00619                            const char *component,
00620                            apr_pool_t *pool);
00621 
00622 /**
00623  * Convert @a iri (Internationalized URI) to an URI.
00624  * The return value may be the same as @a iri if it was already
00625  * a URI.  Else, allocate the return value in @a pool.
00626  *
00627  * @since New in 1.1.
00628  */
00629 const char *
00630 svn_path_uri_from_iri(const char *iri, apr_pool_t *pool);
00631 
00632 /**
00633  * URI-encode certain characters in @a uri that are not valid in an URI, but
00634  * doesn't have any special meaning in @a uri at their positions.  If no
00635  * characters need escaping, just return @a uri.
00636  *
00637  * @note Currently, this function escapes <, >, ", space, {, }, |, \, ^, and `.
00638  * This may be extended in the future to do context-dependent escaping.
00639  *
00640  * @since New in 1.1.
00641  */
00642 const char *
00643 svn_path_uri_autoescape(const char *uri, apr_pool_t *pool);
00644 
00645 /** @} */
00646 
00647 /** Charset conversion stuff
00648  *
00649  * @defgroup svn_path_charset_stuff Charset conversion
00650  * @{
00651  */
00652 
00653 /** Convert @a path_utf8 from UTF-8 to the internal encoding used by APR. */
00654 svn_error_t *
00655 svn_path_cstring_from_utf8(const char **path_apr,
00656                            const char *path_utf8,
00657                            apr_pool_t *pool);
00658 
00659 /** Convert @a path_apr from the internal encoding used by APR to UTF-8. */
00660 svn_error_t *
00661 svn_path_cstring_to_utf8(const char **path_utf8,
00662                          const char *path_apr,
00663                          apr_pool_t *pool);
00664 
00665 
00666 /** @} */
00667 
00668 #ifdef __cplusplus
00669 }
00670 #endif /* __cplusplus */
00671 
00672 
00673 #endif /* SVN_PATH_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines