Subversion 1.6.16
Functions

svn_dirent_uri.h File Reference

A library to manipulate URIs and directory entries. More...

#include <apr.h>
#include <apr_pools.h>
#include <apr_tables.h>
#include "svn_types.h"

Go to the source code of this file.

Functions

const char * svn_dirent_internal_style (const char *dirent, apr_pool_t *pool)
 Convert dirent from the local style to the canonical internal style.
const char * svn_dirent_local_style (const char *dirent, apr_pool_t *pool)
 Convert dirent from the canonical internal style to the local style.
char * svn_dirent_join (const char *base, const char *component, apr_pool_t *pool)
 Join a base dirent (base) with a component (component), allocated in pool.
char * svn_dirent_join_many (apr_pool_t *pool, const char *base,...)
 Join multiple components onto a base dirent, allocated in pool.
char * svn_dirent_dirname (const char *dirent, apr_pool_t *pool)
 Get the dirname of the specified canonicalized dirent, defined as the dirent with its basename removed.
svn_boolean_t svn_dirent_is_absolute (const char *dirent)
 Return TRUE if dirent is considered absolute on the platform at hand.
svn_boolean_t svn_dirent_is_root (const char *dirent, apr_size_t len)
 Return TRUE if dirent is considered a root directory on the platform at hand.
const char * svn_dirent_canonicalize (const char *dirent, apr_pool_t *pool)
 Return a new dirent like dirent, but transformed such that some types of dirent specification redundancies are removed.
svn_boolean_t svn_dirent_is_canonical (const char *dirent, apr_pool_t *pool)
 Return TRUE iff dirent is canonical.
char * svn_dirent_get_longest_ancestor (const char *dirent1, const char *dirent2, apr_pool_t *pool)
 Return the longest common dirent shared by two canonicalized dirents, dirent1 and dirent2.
svn_error_tsvn_dirent_get_absolute (const char **pabsolute, const char *relative, apr_pool_t *pool)
 Convert relative canonicalized dirent to an absolute dirent and return the results in *pabsolute, allocated in pool.
const char * svn_dirent_is_child (const char *dirent1, const char *dirent2, apr_pool_t *pool)
 This function is similar as svn_path_is_child, except that it supports Windows dirents and UNC paths on Windows.
svn_boolean_t svn_dirent_is_ancestor (const char *path1, const char *path2)
 Return TRUE if dirent1 is an ancestor of dirent2 or the dirents are equal and FALSE otherwise.

Detailed Description

A library to manipulate URIs and directory entries.

This library makes a clear distinction between directory entries (dirents) and URIs where:

This distinction is needed because on Windows we have to handle some dirents and URIs differently. Since it's not possible to determine from the path string if it's a dirent or a URI, it's up to the API user to make this choice. See also issue #2028.

Nearly all the svn_dirent_xxx functions expect paths passed into them to be in canonical form. The only functions which do *not* have such expectations are:

### TODO: add description in line with svn_path.h, once more functions are moved. ### END TODO

Definition in file svn_dirent_uri.h.


Function Documentation

const char* svn_dirent_canonicalize ( const char *  dirent,
apr_pool_t *  pool 
)

Return a new dirent like dirent, but transformed such that some types of dirent specification redundancies are removed.

This involves collapsing redundant "/./" elements, removing multiple adjacent separator characters, removing trailing separator characters, and possibly other semantically inoperative transformations.

Convert the server name of UNC paths lowercase on Windows.

The returned dirent may be statically allocated, equal to dirent, or allocated from pool.

Since:
New in 1.6.
char* svn_dirent_dirname ( const char *  dirent,
apr_pool_t *  pool 
)

Get the dirname of the specified canonicalized dirent, defined as the dirent with its basename removed.

If dirent is root ("/", "X:/", "//server/share/"), it is returned unchanged.

The returned dirname will be allocated in pool.

Since:
New in 1.6.
svn_error_t* svn_dirent_get_absolute ( const char **  pabsolute,
const char *  relative,
apr_pool_t *  pool 
)

Convert relative canonicalized dirent to an absolute dirent and return the results in *pabsolute, allocated in pool.

Since:
New in 1.6.
char* svn_dirent_get_longest_ancestor ( const char *  dirent1,
const char *  dirent2,
apr_pool_t *  pool 
)

Return the longest common dirent shared by two canonicalized dirents, dirent1 and dirent2.

If there's no common ancestor, return the empty path.

Since:
New in 1.6.
const char* svn_dirent_internal_style ( const char *  dirent,
apr_pool_t *  pool 
)

Convert dirent from the local style to the canonical internal style.

Since:
New in 1.6.
svn_boolean_t svn_dirent_is_absolute ( const char *  dirent)

Return TRUE if dirent is considered absolute on the platform at hand.

E.g. '/foo' on posix or 'X:/foo', '//server/share/foo' on Windows.

Since:
New in 1.6.
svn_boolean_t svn_dirent_is_ancestor ( const char *  path1,
const char *  path2 
)

Return TRUE if dirent1 is an ancestor of dirent2 or the dirents are equal and FALSE otherwise.

Since:
New in 1.6.
svn_boolean_t svn_dirent_is_canonical ( const char *  dirent,
apr_pool_t *  pool 
)

Return TRUE iff dirent is canonical.

Use pool for temporary allocations.

Note:
The test for canonicalization is currently defined as "looks exactly the same as @c svn_dirent_canonicalize() would make it look".
Since:
New in 1.6.
const char* svn_dirent_is_child ( const char *  dirent1,
const char *  dirent2,
apr_pool_t *  pool 
)

This function is similar as svn_path_is_child, except that it supports Windows dirents and UNC paths on Windows.

Since:
New in 1.6.
svn_boolean_t svn_dirent_is_root ( const char *  dirent,
apr_size_t  len 
)

Return TRUE if dirent is considered a root directory on the platform at hand.

E.g. '/' on posix platforms or 'X:/', '//server/share' on Windows.

Since:
New in 1.5.
char* svn_dirent_join ( const char *  base,
const char *  component,
apr_pool_t *  pool 
)

Join a base dirent (base) with a component (component), allocated in pool.

If either base or component is the empty string, then the other argument will be copied and returned. If both are the empty string then empty string is returned.

If the component is an absolute dirent, then it is copied and returned. The platform specific rules for joining paths are used to join the components.

This function is NOT appropriate for native (local) file dirents. Only for "internal" canonicalized dirents, since it uses '/' for the separator.

Since:
New in 1.6.
char* svn_dirent_join_many ( apr_pool_t *  pool,
const char *  base,
  ... 
)

Join multiple components onto a base dirent, allocated in pool.

The components are terminated by a NULL.

If any component is the empty string, it will be ignored.

If any component is an absolute dirent, then it resets the base and further components will be appended to it.

See svn_dirent_join() for further notes about joining dirents.

Since:
New in 1.6.
const char* svn_dirent_local_style ( const char *  dirent,
apr_pool_t *  pool 
)

Convert dirent from the canonical internal style to the local style.

Since:
New in 1.6.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines