OSDN Git Service

Merge from feature_merge branch. Build TortoiseMerge successfully.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / libsvn_diff / svn_utf_private.h
1 /**\r
2  * @copyright\r
3  * ====================================================================\r
4  * Copyright (c) 2008-2009 CollabNet.  All rights reserved.\r
5  *\r
6  * This software is licensed as described in the file COPYING, which\r
7  * you should have received as part of this distribution.  The terms\r
8  * are also available at http://subversion.tigris.org/license-1.html.\r
9  * If newer versions of this license are posted there, you may use a\r
10  * newer version instead, at your option.\r
11  *\r
12  * This software consists of voluntary contributions made by many\r
13  * individuals.  For exact contribution history, see the revision\r
14  * history and logs, available at http://subversion.tigris.org/.\r
15  * ====================================================================\r
16  * @endcopyright\r
17  *\r
18  * @file svn_utf_private.h\r
19  * @brief UTF validation routines\r
20  */\r
21 \r
22 #ifndef SVN_UTF_PRIVATE_H\r
23 #define SVN_UTF_PRIVATE_H\r
24 \r
25 #include <apr.h>\r
26 #include <apr_pools.h>\r
27 \r
28 #include "svn_types.h"\r
29 \r
30 #ifdef __cplusplus\r
31 extern "C" {\r
32 #endif /* __cplusplus */\r
33 \r
34 \r
35 /* Return TRUE if the string SRC of length LEN is a valid UTF-8 encoding\r
36  * according to the rules laid down by the Unicode 4.0 standard, FALSE\r
37  * otherwise.  This function is faster than svn_utf__last_valid().\r
38  */\r
39 svn_boolean_t\r
40 svn_utf__is_valid(const char *src, apr_size_t len);\r
41 \r
42 /* As for svn_utf__is_valid but SRC is NULL terminated. */\r
43 svn_boolean_t\r
44 svn_utf__cstring_is_valid(const char *src);\r
45 \r
46 /* Return a pointer to the first character after the last valid UTF-8\r
47  * potentially multi-byte character in the string SRC of length LEN.\r
48  * Validity of bytes from SRC to SRC+LEN-1, inclusively, is checked.\r
49  * If SRC is a valid UTF-8, the return value will point to the byte SRC+LEN,\r
50  * otherwise it will point to the start of the first invalid character.\r
51  * In either case all the characters between SRC and the return pointer - 1,\r
52  * inclusively, are valid UTF-8.\r
53  *\r
54  * See also svn_utf__is_valid().\r
55  */\r
56 const char *\r
57 svn_utf__last_valid(const char *src, apr_size_t len);\r
58 \r
59 /* As for svn_utf__last_valid but uses a different implementation without\r
60    lookup tables.  It avoids the table memory use (about 400 bytes) but the\r
61    function is longer (about 200 bytes extra) and likely to be slower when\r
62    the string is valid.  If the string is invalid this function may be\r
63    faster since it returns immediately rather than continuing to the end of\r
64    the string.  The main reason this function exists is to test the table\r
65    driven implementation.  */\r
66 const char *\r
67 svn_utf__last_valid2(const char *src, apr_size_t len);\r
68 \r
69 const char *\r
70 svn_utf__cstring_from_utf8_fuzzy(const char *src,\r
71                                  apr_pool_t *pool,\r
72                                  svn_error_t *(*convert_from_utf8)\r
73                                               (const char **,\r
74                                                const char *,\r
75                                                apr_pool_t *));\r
76 \r
77 \r
78 #ifdef __cplusplus\r
79 }\r
80 #endif /* __cplusplus */\r
81 \r
82 #endif /* SVN_UTF_PRIVATE_H */\r