OSDN Git Service

Success build TortoiseMerge.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / libsvn_diff / svn_dirent_uri.h
diff --git a/src/TortoiseMerge/libsvn_diff/svn_dirent_uri.h b/src/TortoiseMerge/libsvn_diff/svn_dirent_uri.h
new file mode 100644 (file)
index 0000000..92ef985
--- /dev/null
@@ -0,0 +1,225 @@
+/**\r
+ * @copyright\r
+ * ====================================================================\r
+ * Copyright (c) 2008 CollabNet.  All rights reserved.\r
+ *\r
+ * This software is licensed as described in the file COPYING, which\r
+ * you should have received as part of this distribution.  The terms\r
+ * are also available at http://subversion.tigris.org/license-1.html.\r
+ * If newer versions of this license are posted there, you may use a\r
+ * newer version instead, at your option.\r
+ *\r
+ * This software consists of voluntary contributions made by many\r
+ * individuals.  For exact contribution history, see the revision\r
+ * history and logs, available at http://subversion.tigris.org/.\r
+ * ====================================================================\r
+ * @endcopyright\r
+ *\r
+ * @file svn_dirent_uri.h\r
+ * @brief A library to manipulate URIs and directory entries.\r
+ *\r
+ * This library makes a clear distinction between directory entries (dirents)\r
+ * and URIs where:\r
+ *  - a dirent is a path on (local) disc or a UNC path (Windows)\r
+ *    examples: "/foo/bar", "X:/temp", "//server/share"\r
+ *  - a URI is a path in a repository or a URL\r
+ *    examples: "/trunk/README", "http://hostname/svn/repos"\r
+ *\r
+ * This distinction is needed because on Windows we have to handle some\r
+ * dirents and URIs differently. Since it's not possible to determine from\r
+ * the path string if it's a dirent or a URI, it's up to the API user to\r
+ * make this choice. See also issue #2028.\r
+ *\r
+ * Nearly all the @c svn_dirent_xxx functions expect paths passed into them\r
+ * to be in canonical form.  The only functions which do *not* have such \r
+ * expectations are:\r
+ *\r
+ *    - @c svn_dirent_canonicalize()\r
+ *    - @c svn_dirent_is_canonical()\r
+ *    - @c svn_dirent_internal_style()\r
+ *    - @c svn_dirent_local_style()\r
+ *\r
+ * ### TODO: add description in line with svn_path.h, once more functions\r
+ * are moved.\r
+ * ### END TODO\r
+ */\r
+\r
+#ifndef SVN_DIRENT_URI_H\r
+#define SVN_DIRENT_URI_H\r
+\r
+#include <apr.h>\r
+#include <apr_pools.h>\r
+#include <apr_tables.h>\r
+\r
+#include "svn_types.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+\f\r
+/** Convert @a dirent from the local style to the canonical internal style.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+const char *\r
+svn_dirent_internal_style(const char *dirent,\r
+                          apr_pool_t *pool);\r
+\r
+/** Convert @a dirent from the canonical internal style to the local style.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+const char *\r
+svn_dirent_local_style(const char *dirent,\r
+                       apr_pool_t *pool);\r
+\r
+/** Join a base dirent (@a base) with a component (@a component), allocated in\r
+ * @a pool.\r
+ *\r
+ * If either @a base or @a component is the empty string, then the other\r
+ * argument will be copied and returned.  If both are the empty string then\r
+ * empty string is returned.\r
+ *\r
+ * If the @a component is an absolute dirent, then it is copied and returned.\r
+ * The platform specific rules for joining paths are used to join the components.\r
+ *\r
+ * This function is NOT appropriate for native (local) file\r
+ * dirents. Only for "internal" canonicalized dirents, since it uses '/'\r
+ * for the separator.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+char *\r
+svn_dirent_join(const char *base,\r
+                const char *component,\r
+                apr_pool_t *pool);\r
+\r
+/** Join multiple components onto a @a base dirent, allocated in @a pool. The\r
+ * components are terminated by a @c NULL.\r
+ *\r
+ * If any component is the empty string, it will be ignored.\r
+ *\r
+ * If any component is an absolute dirent, then it resets the base and\r
+ * further components will be appended to it.\r
+ *\r
+ * See svn_dirent_join() for further notes about joining dirents.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+char *\r
+svn_dirent_join_many(apr_pool_t *pool,\r
+                     const char *base,\r
+                     ...);\r
+\r
+/** Get the dirname of the specified canonicalized @a dirent, defined as\r
+ * the dirent with its basename removed.\r
+ *\r
+ * If @a dirent is root  ("/", "X:/", "//server/share/"), it is returned\r
+ * unchanged.\r
+ *\r
+ * The returned dirname will be allocated in @a pool.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+char *\r
+svn_dirent_dirname(const char *dirent,\r
+                   apr_pool_t *pool);\r
+\r
+/** Return TRUE if @a dirent is considered absolute on the platform at\r
+ * hand. E.g. '/foo' on posix or 'X:/foo', '//server/share/foo' \r
+ * on Windows.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+svn_boolean_t\r
+svn_dirent_is_absolute(const char *dirent);\r
+\r
+/** Return TRUE if @a dirent is considered a root directory on the platform\r
+ * at hand. E.g. '/' on posix platforms or 'X:/', '//server/share'\r
+ * on Windows.\r
+ *\r
+ * @since New in 1.5.\r
+ */\r
+svn_boolean_t\r
+svn_dirent_is_root(const char *dirent,\r
+                   apr_size_t len);\r
+\r
+/** Return a new dirent like @a dirent, but transformed such that some types\r
+ * of dirent specification redundancies are removed.\r
+ *\r
+ * This involves collapsing redundant "/./" elements, removing\r
+ * multiple adjacent separator characters, removing trailing\r
+ * separator characters, and possibly other semantically inoperative\r
+ * transformations.\r
+ *\r
+ * Convert the server name of UNC paths lowercase on Windows.\r
+ *\r
+ * The returned dirent may be statically allocated, equal to @a dirent, or\r
+ * allocated from @a pool.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+const char *\r
+svn_dirent_canonicalize(const char *dirent,\r
+                        apr_pool_t *pool);\r
+\r
+/** Return @c TRUE iff @a dirent is canonical.  Use @a pool for temporary\r
+ * allocations.\r
+ *\r
+ * @note The test for canonicalization is currently defined as\r
+ * "looks exactly the same as @c svn_dirent_canonicalize() would make\r
+ * it look".\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+svn_boolean_t\r
+svn_dirent_is_canonical(const char *dirent,\r
+                        apr_pool_t *pool);\r
+\r
+/** Return the longest common dirent shared by two canonicalized dirents,\r
+ * @a dirent1 and @a dirent2.  If there's no common ancestor, return the\r
+ * empty path.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+char *\r
+svn_dirent_get_longest_ancestor(const char *dirent1,\r
+                                const char *dirent2,\r
+                                apr_pool_t *pool);\r
+\r
+/** Convert @a relative canonicalized dirent to an absolute dirent and\r
+ * return the results in @a *pabsolute, allocated in @a pool.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+svn_error_t *\r
+svn_dirent_get_absolute(const char **pabsolute,\r
+                        const char *relative,\r
+                        apr_pool_t *pool);\r
+\r
+/**\r
+ * This function is similar as @c svn_path_is_child, except that it supports\r
+ * Windows dirents and UNC paths on Windows.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+const char *\r
+svn_dirent_is_child(const char *dirent1,\r
+                    const char *dirent2,\r
+                    apr_pool_t *pool);\r
+\r
+/** Return TRUE if @a dirent1 is an ancestor of @a dirent2 or the dirents are\r
+ * equal and FALSE otherwise.\r
+ *\r
+ * @since New in 1.6.\r
+ */\r
+svn_boolean_t\r
+svn_dirent_is_ancestor(const char *path1,\r
+                       const char *path2);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* SVN_DIRENT_URI_H */\r