Debian Codegraph @

components/playlist/xspf/uriparser/UriSets.h

raw symbols SCIP
1 /*
2 * uriparser - RFC 3986 URI parsing library
3 *
4 * Copyright (C) 2025, Sebastian Pipping <[email protected]>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials
18 * provided with the distribution.
19 *
20 * 3. Neither the name of the copyright holder nor the names of
21 * its contributors may be used to endorse or promote products
22 * derived from this software without specific prior written
23 * permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
29 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
36 * OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /**
40 * @file UriSets.h
41 * Holds character set definitions.
42 */
43
44 // NOTE: We cannot use a regular include-once guard here because the
45 // file must support being included twice, e.g. from file UriParse.c.
46 #if !defined(URI_SET_DIGIT)
47
48 // clang-format off
49 # define URI_SET_DIGIT(ut) \
50 ut('0'): \
51 case ut('1'): \
52 /* clang-format on */ \
53 case ut('2'): \
54 case ut('3'): \
55 case ut('4'): \
56 case ut('5'): \
57 case ut('6'): \
58 case ut('7'): \
59 case ut('8'): \
60 case ut('9')
61
62 // clang-format off
63 # define URI_SET_HEX_LETTER_LOWER(ut) \
64 ut('a'): \
65 case ut('b'): \
66 /* clang-format on */ \
67 case ut('c'): \
68 case ut('d'): \
69 case ut('e'): \
70 case ut('f')
71
72 // clang-format off
73 # define URI_SET_HEX_LETTER_UPPER(ut) \
74 ut('A'): \
75 case ut('B'): \
76 /* clang-format on */ \
77 case ut('C'): \
78 case ut('D'): \
79 case ut('E'): \
80 case ut('F')
81
82 // clang-format off
83 # define URI_SET_HEXDIG(ut) \
84 URI_SET_DIGIT(ut): \
85 case URI_SET_HEX_LETTER_LOWER(ut): \
86 /* clang-format on */ \
87 case URI_SET_HEX_LETTER_UPPER(ut)
88
89 // clang-format off
90 # define URI_SET_ALPHA(ut) \
91 URI_SET_HEX_LETTER_UPPER(ut): \
92 case URI_SET_HEX_LETTER_LOWER(ut): \
93 /* clang-format on */ \
94 case ut('g'): \
95 case ut('G'): \
96 case ut('h'): \
97 case ut('H'): \
98 case ut('i'): \
99 case ut('I'): \
100 case ut('j'): \
101 case ut('J'): \
102 case ut('k'): \
103 case ut('K'): \
104 case ut('l'): \
105 case ut('L'): \
106 case ut('m'): \
107 case ut('M'): \
108 case ut('n'): \
109 case ut('N'): \
110 case ut('o'): \
111 case ut('O'): \
112 case ut('p'): \
113 case ut('P'): \
114 case ut('q'): \
115 case ut('Q'): \
116 case ut('r'): \
117 case ut('R'): \
118 case ut('s'): \
119 case ut('S'): \
120 case ut('t'): \
121 case ut('T'): \
122 case ut('u'): \
123 case ut('U'): \
124 case ut('v'): \
125 case ut('V'): \
126 case ut('w'): \
127 case ut('W'): \
128 case ut('x'): \
129 case ut('X'): \
130 case ut('y'): \
131 case ut('Y'): \
132 case ut('z'): \
133 case ut('Z')
134
135 // clang-format off
136 # define URI_SET_SUB_DELIMS(ut) \
137 ut('!'): \
138 case ut('$'): \
139 /* clang-format on */ \
140 case ut('&'): \
141 case ut('\''): \
142 case ut('('): \
143 case ut(')'): \
144 case ut('*'): \
145 case ut('+'): \
146 case ut(','): \
147 case ut(';'): \
148 case ut('=')
149
150 // clang-format off
151 # define URI_SET_UNRESERVED(ut) \
152 URI_SET_ALPHA(ut): \
153 case URI_SET_DIGIT(ut): \
154 /* clang-format on */ \
155 case ut('-'): \
156 case ut('.'): \
157 case ut('_'): \
158 case ut('~')
159
160 // clang-format off
161 # define URI_SET_PCHAR_WITHOUT_PERCENT(ut) \
162 URI_SET_UNRESERVED(ut): \
163 case URI_SET_SUB_DELIMS(ut): \
164 /* clang-format on */ \
165 case ut(':'): \
166 case ut('@')
167
168 // clang-format off
169 # define URI_SET_PCHAR(ut) \
170 URI_SET_PCHAR_WITHOUT_PERCENT(ut): \
171 case ut('%')
172 /* clang-format on */
173
174 #endif // ! defined(URI_SET_DIGIT)