renamed ITEMIS_SUBMODULE to ITEMIS_SUBMODULECONTAINER
[TortoiseGit.git] / src / TortoiseMerge / svninclude / svn_ctype.h
blob7d7164e843f67fde7586ca7a4a898f9ef9d6f16a
1 /**
2 * @copyright
3 * ====================================================================
4 * Copyright (c) 2000-2004, 2008 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
16 * @endcopyright
18 * @file svn_ctype.h
19 * @brief Character classification routines
20 * @since New in 1.2.
24 #ifndef SVN_CTYPE_H
25 #define SVN_CTYPE_H
27 #include <apr.h>
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
35 /** Table of flags for character classification. */
36 extern const apr_uint32_t *const svn_ctype_table;
39 /** Check if @a c is in the character class described by @a flags.
40 * The @a flags is a bitwise-or combination of @c SVN_CTYPE_*
41 * constants. Uses #svn_ctype_table.
43 #define svn_ctype_test(c, flags) \
44 (0 != (svn_ctype_table[(unsigned char)(c)] & (flags)))
47 /**
48 * @defgroup ctype_basic Basic character classification - 7-bit ASCII only
49 * @{
52 /* Basic character classes */
53 #define SVN_CTYPE_CNTRL 0x0001 /**< Control character */
54 #define SVN_CTYPE_SPACE 0x0002 /**< Whitespace */
55 #define SVN_CTYPE_DIGIT 0x0004 /**< Decimal digit */
56 #define SVN_CTYPE_UPPER 0x0008 /**< Uppercase letter */
57 #define SVN_CTYPE_LOWER 0x0010 /**< Lowercase letter */
58 #define SVN_CTYPE_PUNCT 0x0020 /**< Punctuation mark */
59 #define SVN_CTYPE_XALPHA 0x0040 /**< Hexadecimal digits A to F */
60 #define SVN_CTYPE_ASCII 0x0080 /**< ASCII subset*/
62 /* Derived character classes */
63 /** ASCII letter */
64 #define SVN_CTYPE_ALPHA (SVN_CTYPE_LOWER | SVN_CTYPE_UPPER)
65 /** ASCII letter or decimal digit */
66 #define SVN_CTYPE_ALNUM (SVN_CTYPE_ALPHA | SVN_CTYPE_DIGIT)
67 /** ASCII hexadecimal digit */
68 #define SVN_CTYPE_XDIGIT (SVN_CTYPE_DIGIT | SVN_CTYPE_XALPHA)
69 /** Printable ASCII except space */
70 #define SVN_CTYPE_GRAPH (SVN_CTYPE_PUNCT | SVN_CTYPE_ALNUM)
71 /** All printable ASCII */
72 #define SVN_CTYPE_PRINT (SVN_CTYPE_GRAPH | SVN_CTYPE_SPACE)
75 /** Check if @a c is an ASCII control character. */
76 #define svn_ctype_iscntrl(c) svn_ctype_test((c), SVN_CTYPE_CNTRL)
78 /** Check if @a c is an ASCII whitespace character. */
79 #define svn_ctype_isspace(c) svn_ctype_test((c), SVN_CTYPE_SPACE)
81 /** Check if @a c is an ASCII digit. */
82 #define svn_ctype_isdigit(c) svn_ctype_test((c), SVN_CTYPE_DIGIT)
84 /** Check if @a c is an ASCII uppercase letter. */
85 #define svn_ctype_isupper(c) svn_ctype_test((c), SVN_CTYPE_UPPER)
87 /** Check if @a c is an ASCII lowercase letter. */
88 #define svn_ctype_islower(c) svn_ctype_test((c), SVN_CTYPE_LOWER)
90 /** Check if @a c is an ASCII punctuation mark. */
91 #define svn_ctype_ispunct(c) svn_ctype_test((c), SVN_CTYPE_PUNCT)
93 /** Check if @a c is an ASCII character. */
94 #define svn_ctype_isascii(c) svn_ctype_test((c), SVN_CTYPE_ASCII)
96 /** Check if @a c is an ASCII letter. */
97 #define svn_ctype_isalpha(c) svn_ctype_test((c), SVN_CTYPE_ALPHA)
99 /** Check if @a c is an ASCII letter or decimal digit. */
100 #define svn_ctype_isalnum(c) svn_ctype_test((c), SVN_CTYPE_ALNUM)
102 /** Check if @a c is an ASCII hexadecimal digit. */
103 #define svn_ctype_isxdigit(c) svn_ctype_test((c), SVN_CTYPE_XDIGIT)
105 /** Check if @a c is an ASCII graphical (visible printable) character. */
106 #define svn_ctype_isgraph(c) svn_ctype_test((c), SVN_CTYPE_GRAPH)
108 /** Check if @a c is an ASCII printable character. */
109 #define svn_ctype_isprint(c) svn_ctype_test((c), SVN_CTYPE_PRINT)
111 /** @} */
114 * @defgroup ctype_extra Extended character classification
115 * @{
118 /* Basic extended character classes */
119 #define SVN_CTYPE_UTF8LEAD 0x0100 /**< UTF-8 multibyte lead byte */
120 #define SVN_CTYPE_UTF8CONT 0x0200 /**< UTF-8 multibyte non-lead byte */
121 /* ### TBD
122 #define SVN_CTYPE_XMLNAME 0x0400
123 #define SVN_CTYPE_URISAFE 0x0800
126 /* Derived extended character classes */
127 /** Part of a UTF-8 multibyte character. */
128 #define SVN_CTYPE_UTF8MBC (SVN_CTYPE_UTF8LEAD | SVN_CTYPE_UTF8CONT)
129 /** All valid UTF-8 bytes. */
130 #define SVN_CTYPE_UTF8 (SVN_CTYPE_ASCII | SVN_CTYPE_UTF8MBC)
132 /** Check if @a c is a UTF-8 multibyte lead byte. */
133 #define svn_ctype_isutf8lead(c) svn_ctype_test((c), SVN_CTYPE_UTF8LEAD)
135 /** Check if @a c is a UTF-8 multibyte continuation (non-lead) byte. */
136 #define svn_ctype_isutf8cont(c) svn_ctype_test((c), SVN_CTYLE_UTF8CONT)
138 /** Check if @a c is part of a UTF-8 multibyte character. */
139 #define svn_ctype_isutf8mbc(c) svn_ctype_test((c), SVN_CTYPE_UTF8MBC)
141 /** Check if @a c is valid in UTF-8. */
142 #define svn_ctype_isutf8(c) svn_ctype_test((c), SVN_CTYPE_UTF8)
144 /** @} */
147 * @defgroup ctype_ascii ASCII character value constants
148 * @{
151 #define SVN_CTYPE_ASCII_MINUS 45 /**< ASCII value of '-' */
152 #define SVN_CTYPE_ASCII_DOT 46 /**< ASCII value of '.' */
153 #define SVN_CTYPE_ASCII_COLON 58 /**< ASCII value of ':' */
154 #define SVN_CTYPE_ASCII_UNDERSCORE 95 /**< ASCII value of '_' */
155 #define SVN_CTYPE_ASCII_TAB 9 /**< ASCII value of a tab */
156 #define SVN_CTYPE_ASCII_LINEFEED 10 /**< ASCII value of a line feed */
157 #define SVN_CTYPE_ASCII_CARRIAGERETURN 13
158 /**< ASCII value of a carriage return */
159 #define SVN_CTYPE_ASCII_DELETE 127
160 /**< ASCII value of a delete character */
163 /** @} */
166 * @defgroup ctype_case ASCII-subset case folding
167 * @{
171 * Compare two characters @a a and @a b, treating case-equivalent
172 * unaccented Latin (ASCII subset) letters as equal.
174 * Returns in integer greater than, equal to, or less than 0,
175 * according to whether @a a is considered greater than, equal to,
176 * or less than @a b.
178 * @since New in 1.5.
181 svn_ctype_casecmp(int a,
182 int b);
185 /** @} */
187 #ifdef __cplusplus
189 #endif /* __cplusplus */
191 #endif /* SVN_CTYPE_H */