File: UpperMiddle.cs

package info (click to toggle)
mono 6.14.1%2Bds2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,282,732 kB
  • sloc: cs: 11,182,461; xml: 2,850,281; ansic: 699,123; cpp: 122,919; perl: 58,604; javascript: 30,841; asm: 21,845; makefile: 19,602; sh: 10,973; python: 4,772; pascal: 925; sql: 859; sed: 16; php: 1
file content (282 lines) | stat: -rw-r--r-- 11,398 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
//------------------------------------------------------------------------------
// <copyright file="UpperMiddle.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace System.Web.Security.AntiXss.CodeCharts {
    using System.Collections;
    using System.Linq;

    /// <summary>
    /// Provides safe character positions for the upper middle section of the UTF code tables.
    /// </summary>
    internal static class UpperMiddle {
        /// <summary>
        /// Determines if the specified flag is set.
        /// </summary>
        /// <param name="flags">The value to check.</param>
        /// <param name="flagToCheck">The flag to check for.</param>
        /// <returns>true if the flag is set, otherwise false.</returns>
        public static bool IsFlagSet(UpperMidCodeCharts flags, UpperMidCodeCharts flagToCheck) {
            return (flags & flagToCheck) != 0;
        }

        /// <summary>
        /// Provides the safe characters for the Cyrillic Extended A code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CyrillicExtendedA() {
            return CodeChartHelper.GetRange(0x2DE0, 0x2DFF);
        }

        /// <summary>
        /// Provides the safe characters for the Cyrillic Extended A code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable SupplementalPunctuation() {
            return CodeChartHelper.GetRange(0x2E00, 0x2E31);
        }

        /// <summary>
        /// Provides the safe characters for the CJK Radicals Supplement code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CjkRadicalsSupplement() {
            return CodeChartHelper.GetRange(0x2E80, 0x2EF3, 
                i => (i == 0x2E9A));
        }

        /// <summary>
        /// Provides the safe characters for the Kangxi Radicals code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable KangxiRadicals() {
            return CodeChartHelper.GetRange(0x2F00, 0x2FD5);
        }

        /// <summary>
        /// Provides the safe characters for the Ideographic Description Characters code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable IdeographicDescriptionCharacters() {
            return CodeChartHelper.GetRange(0x2FF0, 0x2FFB);
        }

        /// <summary>
        /// Provides the safe characters for the CJK Symbols and Punctuation code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CjkSymbolsAndPunctuation() {
            return CodeChartHelper.GetRange(0x3000, 0x303F);
        }

        /// <summary>
        /// Provides the safe characters for the Hiragana code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Hiragana() {
            return CodeChartHelper.GetRange(0x3041, 0x309F, 
                i => (i == 0x3097 ||
                    i == 0x3098));
        }

        /// <summary>
        /// Provides the safe characters for the Hiragana code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Katakana() {
            return CodeChartHelper.GetRange(0x30A0, 0x30FF);
        }

        /// <summary>
        /// Provides the safe characters for the Bopomofo code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Bopomofo() {
            return CodeChartHelper.GetRange(0x3105, 0x312D);
        }

        /// <summary>
        /// Provides the safe characters for the Hangul Compatibility Jamo code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable HangulCompatibilityJamo() {
            return CodeChartHelper.GetRange(0x3131, 0x318E);
        }

        /// <summary>
        /// Provides the safe characters for the Kanbun code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Kanbun() {
            return CodeChartHelper.GetRange(0x3190, 0x319F);
        }

        /// <summary>
        /// Provides the safe characters for the Bopomofo Extended code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable BopomofoExtended() {
            return CodeChartHelper.GetRange(0x31A0, 0x31B7);
        }

        /// <summary>
        /// Provides the safe characters for the CJK Strokes code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CjkStrokes() {
            return CodeChartHelper.GetRange(0x31C0, 0x31E3);
        }

        /// <summary>
        /// Provides the safe characters for the Katakana Phonetic Extensions code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable KatakanaPhoneticExtensions() {
            return CodeChartHelper.GetRange(0x31F0, 0x31FF);
        }

        /// <summary>
        /// Provides the safe characters for the Enclosed CJK Letters and Months code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable EnclosedCjkLettersAndMonths() {
            return CodeChartHelper.GetRange(0x3200, 0x32FE, 
                i => (i == 0x321F));
        }

        /// <summary>
        /// Provides the safe characters for the CJK Compatibility code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CjkCompatibility() {
            return CodeChartHelper.GetRange(0x3300, 0x33FF);
        }

        /// <summary>
        /// Provides the safe characters for the CJK Unified Ideographs Extension A code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CjkUnifiedIdeographsExtensionA() {
            return CodeChartHelper.GetRange(0x3400, 0x4DB5);
        }

        /// <summary>
        /// Provides the safe characters for the Yijing Hexagram Symbols code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable YijingHexagramSymbols() {
            return CodeChartHelper.GetRange(0x4DC0, 0x4DFF);
        }

        /// <summary>
        /// Provides the safe characters for the CJK Unified Ideographs code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CjkUnifiedIdeographs() {
            return CodeChartHelper.GetRange(0x4E00, 0x9FCB);
        }

        /// <summary>
        /// Provides the safe characters for the Yi Syllables code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable YiSyllables() {
            return CodeChartHelper.GetRange(0xA000, 0xA48C);
        }

        /// <summary>
        /// Provides the safe characters for the Yi Radicals code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable YiRadicals() {
            return CodeChartHelper.GetRange(0xA490, 0xA4C6);
        }

        /// <summary>
        /// Provides the safe characters for the Lisu code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Lisu() {
            return CodeChartHelper.GetRange(0xA4D0, 0xA4FF);
        }

        /// <summary>
        /// Provides the safe characters for the Vai code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Vai() {
            return CodeChartHelper.GetRange(0xA500, 0xA62B);
        }

        /// <summary>
        /// Provides the safe characters for the Cyrillic Extended B code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CyrillicExtendedB() {
            return CodeChartHelper.GetRange(0xA640, 0xA697, 
                i => (i == 0xA660 ||
                    i == 0xA661 ||
                    (i >= 0xA674 && i <= 0xA67b)));
        }

        /// <summary>
        /// Provides the safe characters for the Bamum code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Bamum() {
            return CodeChartHelper.GetRange(0xA6A0, 0xA6F7);
        }

        /// <summary>
        /// Provides the safe characters for the Modifier Tone Letters code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable ModifierToneLetters() {
            return CodeChartHelper.GetRange(0xA700, 0xA71F);
        }

        /// <summary>
        /// Provides the safe characters for the Latin Extended D code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable LatinExtendedD() {
            return CodeChartHelper.GetRange(0xA720, 0xA78C).Concat(
                   CodeChartHelper.GetRange(0xA7FB, 0xA7FF));
        }

        /// <summary>
        /// Provides the safe characters for the Syloti Nagri code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable SylotiNagri() {
            return CodeChartHelper.GetRange(0xA800, 0xA82B);
        }

        /// <summary>
        /// Provides the safe characters for the Common Indic Number Forms code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable CommonIndicNumberForms() {
            return CodeChartHelper.GetRange(0xA830, 0xA839);
        }

        /// <summary>
        /// Provides the safe characters for the Phags-pa code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Phagspa() {
            return CodeChartHelper.GetRange(0xA840, 0xA877);
        }

        /// <summary>
        /// Provides the safe characters for the Saurashtra code table.
        /// </summary>
        /// <returns>The safe characters for the code table.</returns>
        public static IEnumerable Saurashtra() {
            return CodeChartHelper.GetRange(0xA880, 0xA8D9, 
                i => (i >= 0xA8C5 && i <= 0xA8CD));
        }
    }
}