From c5dc9abff6bac10da4154382e1a9b8b256525174 Mon Sep 17 00:00:00 2001 From: Levi B Date: Tue, 24 Feb 2015 11:51:41 -0800 Subject: [PATCH] Doc comment cleanup, API refactorings Rename CodePointFilters -> UnicodeBlocks Rework allowed / disallowed code point APIs for ease of use Move service registration APIs into WebEncoders project --- .../project.json | 2 - .../AllowedCharsBitmap.cs | 65 + .../CodePointFilter.cs | 273 ++ .../CodePointFilters.cs | 2586 ----------------- .../EncoderExtensions.cs | 22 +- .../EncoderOptions.cs | 7 +- .../EncoderServiceCollectionExtensions.cs | 4 +- .../EncoderServiceProviderExtensions.cs} | 4 +- .../EncoderServices.cs | 12 +- .../HtmlEncoder.cs | 23 +- .../IHtmlEncoder.cs | 3 +- .../IJavaScriptStringEncoder.cs | 7 + .../JavaScriptStringEncoder.cs | 23 +- .../UnicodeBlock.cs | 66 + .../UnicodeBlocks.cs | 64 + .../UnicodeBlocks.generated.cs | 2336 +++++++++++++++ .../UnicodeEncoderBase.cs | 70 +- .../UrlEncoder.cs | 23 +- .../project.json | 3 + 19 files changed, 2922 insertions(+), 2671 deletions(-) create mode 100644 src/Microsoft.Framework.WebEncoders/AllowedCharsBitmap.cs create mode 100644 src/Microsoft.Framework.WebEncoders/CodePointFilter.cs delete mode 100644 src/Microsoft.Framework.WebEncoders/CodePointFilters.cs rename src/{Microsoft.AspNet.Http.Extensions/Encoders => Microsoft.Framework.WebEncoders}/EncoderOptions.cs (65%) rename src/{Microsoft.AspNet.Http.Extensions/Encoders => Microsoft.Framework.WebEncoders}/EncoderServiceCollectionExtensions.cs (96%) rename src/{Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs => Microsoft.Framework.WebEncoders/EncoderServiceProviderExtensions.cs} (95%) rename src/{Microsoft.AspNet.Http.Extensions/Encoders => Microsoft.Framework.WebEncoders}/EncoderServices.cs (73%) create mode 100644 src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs create mode 100644 src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs create mode 100644 src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs diff --git a/src/Microsoft.AspNet.Http.Extensions/project.json b/src/Microsoft.AspNet.Http.Extensions/project.json index cb0f113bcd..be234399ec 100644 --- a/src/Microsoft.AspNet.Http.Extensions/project.json +++ b/src/Microsoft.AspNet.Http.Extensions/project.json @@ -3,9 +3,7 @@ "description": "ASP.NET 5 common extension methods for HTTP abstractions and IApplicationBuilder.", "dependencies": { "Microsoft.AspNet.Http": "1.0.0-*", - "Microsoft.Framework.WebEncoders": "1.0.0-*", "Microsoft.Framework.DependencyInjection": "1.0.0-*", - "Microsoft.Framework.OptionsModel": "1.0.0-*", "Microsoft.Net.Http.Headers": "1.0.0-*" }, "frameworks" : { diff --git a/src/Microsoft.Framework.WebEncoders/AllowedCharsBitmap.cs b/src/Microsoft.Framework.WebEncoders/AllowedCharsBitmap.cs new file mode 100644 index 0000000000..475c47a2b0 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/AllowedCharsBitmap.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; + +namespace Microsoft.Framework.WebEncoders +{ + internal struct AllowedCharsBitmap + { + private const int ALLOWED_CHARS_BITMAP_LENGTH = 0x10000 / (8 * sizeof(uint)); + private uint[] _allowedCharsBitmap; + + public AllowedCharsBitmap() + { + _allowedCharsBitmap = new uint[ALLOWED_CHARS_BITMAP_LENGTH]; + } + + // Marks a character as allowed (can be returned unencoded) + public void AllowCharacter(char c) + { + uint codePoint = (uint)c; + int index = (int)(codePoint >> 5); + int offset = (int)(codePoint & 0x1FU); + _allowedCharsBitmap[index] |= 0x1U << offset; + } + + public AllowedCharsBitmap Clone() + { + AllowedCharsBitmap retVal; + retVal._allowedCharsBitmap = (uint[])this._allowedCharsBitmap.Clone(); + return retVal; + } + + // Marks a character as forbidden (must be returned encoded) + public void ForbidCharacter(char c) + { + uint codePoint = (uint)c; + int index = (int)(codePoint >> 5); + int offset = (int)(codePoint & 0x1FU); + _allowedCharsBitmap[index] &= ~(0x1U << offset); + } + + public void ForbidUndefinedCharacters() + { + // Forbid codepoints which aren't mapped to characters or which are otherwise always disallowed + // (includes categories Cc, Cs, Co, Cn, Zs [except U+0020 SPACE], Zl, Zp) + uint[] definedCharactersBitmap = UnicodeHelpers.GetDefinedCharacterBitmap(); + Debug.Assert(definedCharactersBitmap.Length == _allowedCharsBitmap.Length); + for (int i = 0; i < _allowedCharsBitmap.Length; i++) + { + _allowedCharsBitmap[i] &= definedCharactersBitmap[i]; + } + } + + // Determines whether the given character can be returned unencoded. + public bool IsCharacterAllowed(char c) + { + uint codePoint = (uint)c; + int index = (int)(codePoint >> 5); + int offset = (int)(codePoint & 0x1FU); + return ((_allowedCharsBitmap[index] >> offset) & 0x1U) != 0; + } + } +} diff --git a/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs b/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs new file mode 100644 index 0000000000..97a43b803b --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using Microsoft.Framework.Internal; + +namespace Microsoft.Framework.WebEncoders +{ + /// + /// Represents a filter which allows only certain Unicode code points through. + /// + public sealed class CodePointFilter : ICodePointFilter + { + private AllowedCharsBitmap _allowedCharsBitmap; + + /// + /// Instantiates the filter allowing only the 'Basic Latin' block of characters through. + /// + public CodePointFilter() + { + _allowedCharsBitmap = new AllowedCharsBitmap(); + AllowBlock(UnicodeBlocks.BasicLatin); + } + + /// + /// Instantiates the filter by cloning the allow list of another filter. + /// + public CodePointFilter([NotNull] ICodePointFilter other) + { + CodePointFilter otherAsCodePointFilter = other as CodePointFilter; + if (otherAsCodePointFilter != null) + { + _allowedCharsBitmap = otherAsCodePointFilter.GetAllowedCharsBitmap(); + } + else + { + _allowedCharsBitmap = new AllowedCharsBitmap(); + AllowFilter(other); + } + } + + /// + /// Instantiates the filter where only the provided Unicode character blocks are + /// allowed by the filter. + /// + /// + public CodePointFilter(params UnicodeBlock[] allowedBlocks) + { + _allowedCharsBitmap = new AllowedCharsBitmap(); + AllowBlocks(allowedBlocks); + } + + /// + /// Allows all characters in the specified Unicode character block through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowBlock([NotNull] UnicodeBlock block) + { + int firstCodePoint = block.FirstCodePoint; + int blockSize = block.BlockSize; + for (int i = 0; i < blockSize; i++) + { + _allowedCharsBitmap.AllowCharacter((char)(firstCodePoint + i)); + } + return this; + } + + /// + /// Allows all characters in the specified Unicode character blocks through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowBlocks(params UnicodeBlock[] blocks) + { + if (blocks != null) + { + for (int i = 0; i < blocks.Length; i++) + { + AllowBlock(blocks[i]); + } + } + return this; + } + + /// + /// Allows the specified character through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowChar(char c) + { + _allowedCharsBitmap.AllowCharacter(c); + return this; + } + + /// + /// Allows the specified characters through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowChars(params char[] chars) + { + if (chars != null) + { + for (int i = 0; i < chars.Length; i++) + { + _allowedCharsBitmap.AllowCharacter(chars[i]); + } + } + return this; + } + + /// + /// Allows all characters in the specified string through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowChars([NotNull] string chars) + { + for (int i = 0; i < chars.Length; i++) + { + _allowedCharsBitmap.AllowCharacter(chars[i]); + } + return this; + } + + /// + /// Allows all characters approved by the specified filter through this filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowFilter([NotNull] ICodePointFilter filter) + { + foreach (var allowedCodePoint in filter.GetAllowedCodePoints()) + { + // If the code point can't be represented as a BMP character, skip it. + char codePointAsChar = (char)allowedCodePoint; + if (allowedCodePoint == codePointAsChar) + { + _allowedCharsBitmap.AllowCharacter(codePointAsChar); + } + } + return this; + } + + /// + /// Disallows all characters in the specified Unicode character block through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidBlock([NotNull] UnicodeBlock block) + { + int firstCodePoint = block.FirstCodePoint; + int blockSize = block.BlockSize; + for (int i = 0; i < blockSize; i++) + { + _allowedCharsBitmap.ForbidCharacter((char)(firstCodePoint + i)); + } + return this; + } + + /// + /// Disallows all characters in the specified Unicode character blocks through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidBlocks(params UnicodeBlock[] blocks) + { + if (blocks != null) + { + for (int i = 0; i < blocks.Length; i++) + { + ForbidBlock(blocks[i]); + } + } + return this; + } + + /// + /// Disallows the specified character through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidChar(char c) + { + _allowedCharsBitmap.ForbidCharacter(c); + return this; + } + + /// + /// Disallows the specified characters through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidChars(params char[] chars) + { + if (chars != null) + { + for (int i = 0; i < chars.Length; i++) + { + _allowedCharsBitmap.ForbidCharacter(chars[i]); + } + } + return this; + } + + /// + /// Disallows all characters in the specified string through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidChars([NotNull] string chars) + { + for (int i = 0; i < chars.Length; i++) + { + _allowedCharsBitmap.ForbidCharacter(chars[i]); + } + return this; + } + + /// + /// Retrieves the bitmap of allowed characters from this filter. + /// The returned bitmap is a clone of the original bitmap to avoid unintentional modification. + /// + internal AllowedCharsBitmap GetAllowedCharsBitmap() + { + return _allowedCharsBitmap.Clone(); + } + + /// + /// Gets an enumeration of all allowed code points. + /// + public IEnumerable GetAllowedCodePoints() + { + for (int i = 0; i < 0x10000; i++) + { + if (_allowedCharsBitmap.IsCharacterAllowed((char)i)) + { + yield return i; + } + } + } + + /// + /// Returns a value stating whether the given character is allowed through the filter. + /// + public bool IsCharacterAllowed(char c) + { + return _allowedCharsBitmap.IsCharacterAllowed(c); + } + + /// + /// Wraps the provided filter as a CodePointFilter, avoiding the clone if possible. + /// + internal static CodePointFilter Wrap(ICodePointFilter filter) + { + return (filter as CodePointFilter) ?? new CodePointFilter(filter); + } + } +} diff --git a/src/Microsoft.Framework.WebEncoders/CodePointFilters.cs b/src/Microsoft.Framework.WebEncoders/CodePointFilters.cs deleted file mode 100644 index 781636916c..0000000000 --- a/src/Microsoft.Framework.WebEncoders/CodePointFilters.cs +++ /dev/null @@ -1,2586 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; - -namespace Microsoft.Framework.WebEncoders -{ - /// - /// Contains predefined Unicode code point filters. - /// - public static class CodePointFilters - { - /// - /// A filter which allows no characters. - /// - public static ICodePointFilter None - { - get - { - return LazyInitializer.EnsureInitialized(ref _none); - } - } - private static EmptyCodePointFilter _none; - - /// - /// A filter which allows all Unicode Basic Multilingual Plane characters. - /// - /// - /// This range spans the code points U+0000 .. U+FFFF. - /// - public static ICodePointFilter All - { - get - { - return GetFilter(ref _all, first: '\u0000', last: '\uFFFF'); - } - } - private static DefinedCharacterCodePointFilter _all; - - /// - /// A filter which allows characters in the 'Basic Latin' Unicode range. - /// - /// - /// This range spans the code points U+0000 .. U+007F. - /// See http://www.unicode.org/charts/PDF/U0000.pdf for the full set of characters in this range. - /// - public static ICodePointFilter BasicLatin - { - get - { - return GetFilter(ref _basicLatin, first: '\u0000', last: '\u007F'); - } - } - private static DefinedCharacterCodePointFilter _basicLatin; - - /// - /// A filter which allows characters in the 'Latin-1 Supplement' Unicode range. - /// - /// - /// This range spans the code points U+0080 .. U+00FF. - /// See http://www.unicode.org/charts/PDF/U0080.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Latin1Supplement - { - get - { - return GetFilter(ref _latin1Supplement, first: '\u0080', last: '\u00FF'); - } - } - private static DefinedCharacterCodePointFilter _latin1Supplement; - - /// - /// A filter which allows characters in the 'Latin Extended-A' Unicode range. - /// - /// - /// This range spans the code points U+0100 .. U+017F. - /// See http://www.unicode.org/charts/PDF/U0100.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LatinExtendedA - { - get - { - return GetFilter(ref _latinExtendedA, first: '\u0100', last: '\u017F'); - } - } - private static DefinedCharacterCodePointFilter _latinExtendedA; - - /// - /// A filter which allows characters in the 'Latin Extended-B' Unicode range. - /// - /// - /// This range spans the code points U+0180 .. U+024F. - /// See http://www.unicode.org/charts/PDF/U0180.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LatinExtendedB - { - get - { - return GetFilter(ref _latinExtendedB, first: '\u0180', last: '\u024F'); - } - } - private static DefinedCharacterCodePointFilter _latinExtendedB; - - /// - /// A filter which allows characters in the 'IPA Extensions' Unicode range. - /// - /// - /// This range spans the code points U+0250 .. U+02AF. - /// See http://www.unicode.org/charts/PDF/U0250.pdf for the full set of characters in this range. - /// - public static ICodePointFilter IPAExtensions - { - get - { - return GetFilter(ref _ipaExtensions, first: '\u0250', last: '\u02AF'); - } - } - private static DefinedCharacterCodePointFilter _ipaExtensions; - - /// - /// A filter which allows characters in the 'Spacing Modifier Letters' Unicode range. - /// - /// - /// This range spans the code points U+02B0 .. U+02FF. - /// See http://www.unicode.org/charts/PDF/U02B0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SpacingModifierLetters - { - get - { - return GetFilter(ref _spacingModifierLetters, first: '\u02B0', last: '\u02FF'); - } - } - private static DefinedCharacterCodePointFilter _spacingModifierLetters; - - /// - /// A filter which allows characters in the 'Combining Diacritical Marks' Unicode range. - /// - /// - /// This range spans the code points U+0300 .. U+036F. - /// See http://www.unicode.org/charts/PDF/U0300.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CombiningDiacriticalMarks - { - get - { - return GetFilter(ref _combiningDiacriticalMarks, first: '\u0300', last: '\u036F'); - } - } - private static DefinedCharacterCodePointFilter _combiningDiacriticalMarks; - - /// - /// A filter which allows characters in the 'Greek and Coptic' Unicode range. - /// - /// - /// This range spans the code points U+0370 .. U+03FF. - /// See http://www.unicode.org/charts/PDF/U0370.pdf for the full set of characters in this range. - /// - public static ICodePointFilter GreekandCoptic - { - get - { - return GetFilter(ref _greekandCoptic, first: '\u0370', last: '\u03FF'); - } - } - private static DefinedCharacterCodePointFilter _greekandCoptic; - - /// - /// A filter which allows characters in the 'Cyrillic' Unicode range. - /// - /// - /// This range spans the code points U+0400 .. U+04FF. - /// See http://www.unicode.org/charts/PDF/U0400.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Cyrillic - { - get - { - return GetFilter(ref _cyrillic, first: '\u0400', last: '\u04FF'); - } - } - private static DefinedCharacterCodePointFilter _cyrillic; - - /// - /// A filter which allows characters in the 'Cyrillic Supplement' Unicode range. - /// - /// - /// This range spans the code points U+0500 .. U+052F. - /// See http://www.unicode.org/charts/PDF/U0500.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CyrillicSupplement - { - get - { - return GetFilter(ref _cyrillicSupplement, first: '\u0500', last: '\u052F'); - } - } - private static DefinedCharacterCodePointFilter _cyrillicSupplement; - - /// - /// A filter which allows characters in the 'Armenian' Unicode range. - /// - /// - /// This range spans the code points U+0530 .. U+058F. - /// See http://www.unicode.org/charts/PDF/U0530.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Armenian - { - get - { - return GetFilter(ref _armenian, first: '\u0530', last: '\u058F'); - } - } - private static DefinedCharacterCodePointFilter _armenian; - - /// - /// A filter which allows characters in the 'Hebrew' Unicode range. - /// - /// - /// This range spans the code points U+0590 .. U+05FF. - /// See http://www.unicode.org/charts/PDF/U0590.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Hebrew - { - get - { - return GetFilter(ref _hebrew, first: '\u0590', last: '\u05FF'); - } - } - private static DefinedCharacterCodePointFilter _hebrew; - - /// - /// A filter which allows characters in the 'Arabic' Unicode range. - /// - /// - /// This range spans the code points U+0600 .. U+06FF. - /// See http://www.unicode.org/charts/PDF/U0600.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Arabic - { - get - { - return GetFilter(ref _arabic, first: '\u0600', last: '\u06FF'); - } - } - private static DefinedCharacterCodePointFilter _arabic; - - /// - /// A filter which allows characters in the 'Syriac' Unicode range. - /// - /// - /// This range spans the code points U+0700 .. U+074F. - /// See http://www.unicode.org/charts/PDF/U0700.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Syriac - { - get - { - return GetFilter(ref _syriac, first: '\u0700', last: '\u074F'); - } - } - private static DefinedCharacterCodePointFilter _syriac; - - /// - /// A filter which allows characters in the 'Arabic Supplement' Unicode range. - /// - /// - /// This range spans the code points U+0750 .. U+077F. - /// See http://www.unicode.org/charts/PDF/U0750.pdf for the full set of characters in this range. - /// - public static ICodePointFilter ArabicSupplement - { - get - { - return GetFilter(ref _arabicSupplement, first: '\u0750', last: '\u077F'); - } - } - private static DefinedCharacterCodePointFilter _arabicSupplement; - - /// - /// A filter which allows characters in the 'Thaana' Unicode range. - /// - /// - /// This range spans the code points U+0780 .. U+07BF. - /// See http://www.unicode.org/charts/PDF/U0780.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Thaana - { - get - { - return GetFilter(ref _thaana, first: '\u0780', last: '\u07BF'); - } - } - private static DefinedCharacterCodePointFilter _thaana; - - /// - /// A filter which allows characters in the 'NKo' Unicode range. - /// - /// - /// This range spans the code points U+07C0 .. U+07FF. - /// See http://www.unicode.org/charts/PDF/U07C0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter NKo - { - get - { - return GetFilter(ref _nKo, first: '\u07C0', last: '\u07FF'); - } - } - private static DefinedCharacterCodePointFilter _nKo; - - /// - /// A filter which allows characters in the 'Samaritan' Unicode range. - /// - /// - /// This range spans the code points U+0800 .. U+083F. - /// See http://www.unicode.org/charts/PDF/U0800.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Samaritan - { - get - { - return GetFilter(ref _samaritan, first: '\u0800', last: '\u083F'); - } - } - private static DefinedCharacterCodePointFilter _samaritan; - - /// - /// A filter which allows characters in the 'Mandaic' Unicode range. - /// - /// - /// This range spans the code points U+0840 .. U+085F. - /// See http://www.unicode.org/charts/PDF/U0840.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Mandaic - { - get - { - return GetFilter(ref _mandaic, first: '\u0840', last: '\u085F'); - } - } - private static DefinedCharacterCodePointFilter _mandaic; - - /// - /// A filter which allows characters in the 'Arabic Extended-A' Unicode range. - /// - /// - /// This range spans the code points U+08A0 .. U+08FF. - /// See http://www.unicode.org/charts/PDF/U08A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter ArabicExtendedA - { - get - { - return GetFilter(ref _arabicExtendedA, first: '\u08A0', last: '\u08FF'); - } - } - private static DefinedCharacterCodePointFilter _arabicExtendedA; - - /// - /// A filter which allows characters in the 'Devanagari' Unicode range. - /// - /// - /// This range spans the code points U+0900 .. U+097F. - /// See http://www.unicode.org/charts/PDF/U0900.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Devanagari - { - get - { - return GetFilter(ref _devanagari, first: '\u0900', last: '\u097F'); - } - } - private static DefinedCharacterCodePointFilter _devanagari; - - /// - /// A filter which allows characters in the 'Bengali' Unicode range. - /// - /// - /// This range spans the code points U+0980 .. U+09FF. - /// See http://www.unicode.org/charts/PDF/U0980.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Bengali - { - get - { - return GetFilter(ref _bengali, first: '\u0980', last: '\u09FF'); - } - } - private static DefinedCharacterCodePointFilter _bengali; - - /// - /// A filter which allows characters in the 'Gurmukhi' Unicode range. - /// - /// - /// This range spans the code points U+0A00 .. U+0A7F. - /// See http://www.unicode.org/charts/PDF/U0A00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Gurmukhi - { - get - { - return GetFilter(ref _gurmukhi, first: '\u0A00', last: '\u0A7F'); - } - } - private static DefinedCharacterCodePointFilter _gurmukhi; - - /// - /// A filter which allows characters in the 'Gujarati' Unicode range. - /// - /// - /// This range spans the code points U+0A80 .. U+0AFF. - /// See http://www.unicode.org/charts/PDF/U0A80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Gujarati - { - get - { - return GetFilter(ref _gujarati, first: '\u0A80', last: '\u0AFF'); - } - } - private static DefinedCharacterCodePointFilter _gujarati; - - /// - /// A filter which allows characters in the 'Oriya' Unicode range. - /// - /// - /// This range spans the code points U+0B00 .. U+0B7F. - /// See http://www.unicode.org/charts/PDF/U0B00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Oriya - { - get - { - return GetFilter(ref _oriya, first: '\u0B00', last: '\u0B7F'); - } - } - private static DefinedCharacterCodePointFilter _oriya; - - /// - /// A filter which allows characters in the 'Tamil' Unicode range. - /// - /// - /// This range spans the code points U+0B80 .. U+0BFF. - /// See http://www.unicode.org/charts/PDF/U0B80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Tamil - { - get - { - return GetFilter(ref _tamil, first: '\u0B80', last: '\u0BFF'); - } - } - private static DefinedCharacterCodePointFilter _tamil; - - /// - /// A filter which allows characters in the 'Telugu' Unicode range. - /// - /// - /// This range spans the code points U+0C00 .. U+0C7F. - /// See http://www.unicode.org/charts/PDF/U0C00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Telugu - { - get - { - return GetFilter(ref _telugu, first: '\u0C00', last: '\u0C7F'); - } - } - private static DefinedCharacterCodePointFilter _telugu; - - /// - /// A filter which allows characters in the 'Kannada' Unicode range. - /// - /// - /// This range spans the code points U+0C80 .. U+0CFF. - /// See http://www.unicode.org/charts/PDF/U0C80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Kannada - { - get - { - return GetFilter(ref _kannada, first: '\u0C80', last: '\u0CFF'); - } - } - private static DefinedCharacterCodePointFilter _kannada; - - /// - /// A filter which allows characters in the 'Malayalam' Unicode range. - /// - /// - /// This range spans the code points U+0D00 .. U+0D7F. - /// See http://www.unicode.org/charts/PDF/U0D00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Malayalam - { - get - { - return GetFilter(ref _malayalam, first: '\u0D00', last: '\u0D7F'); - } - } - private static DefinedCharacterCodePointFilter _malayalam; - - /// - /// A filter which allows characters in the 'Sinhala' Unicode range. - /// - /// - /// This range spans the code points U+0D80 .. U+0DFF. - /// See http://www.unicode.org/charts/PDF/U0D80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Sinhala - { - get - { - return GetFilter(ref _sinhala, first: '\u0D80', last: '\u0DFF'); - } - } - private static DefinedCharacterCodePointFilter _sinhala; - - /// - /// A filter which allows characters in the 'Thai' Unicode range. - /// - /// - /// This range spans the code points U+0E00 .. U+0E7F. - /// See http://www.unicode.org/charts/PDF/U0E00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Thai - { - get - { - return GetFilter(ref _thai, first: '\u0E00', last: '\u0E7F'); - } - } - private static DefinedCharacterCodePointFilter _thai; - - /// - /// A filter which allows characters in the 'Lao' Unicode range. - /// - /// - /// This range spans the code points U+0E80 .. U+0EFF. - /// See http://www.unicode.org/charts/PDF/U0E80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Lao - { - get - { - return GetFilter(ref _lao, first: '\u0E80', last: '\u0EFF'); - } - } - private static DefinedCharacterCodePointFilter _lao; - - /// - /// A filter which allows characters in the 'Tibetan' Unicode range. - /// - /// - /// This range spans the code points U+0F00 .. U+0FFF. - /// See http://www.unicode.org/charts/PDF/U0F00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Tibetan - { - get - { - return GetFilter(ref _tibetan, first: '\u0F00', last: '\u0FFF'); - } - } - private static DefinedCharacterCodePointFilter _tibetan; - - /// - /// A filter which allows characters in the 'Myanmar' Unicode range. - /// - /// - /// This range spans the code points U+1000 .. U+109F. - /// See http://www.unicode.org/charts/PDF/U1000.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Myanmar - { - get - { - return GetFilter(ref _myanmar, first: '\u1000', last: '\u109F'); - } - } - private static DefinedCharacterCodePointFilter _myanmar; - - /// - /// A filter which allows characters in the 'Georgian' Unicode range. - /// - /// - /// This range spans the code points U+10A0 .. U+10FF. - /// See http://www.unicode.org/charts/PDF/U10A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Georgian - { - get - { - return GetFilter(ref _georgian, first: '\u10A0', last: '\u10FF'); - } - } - private static DefinedCharacterCodePointFilter _georgian; - - /// - /// A filter which allows characters in the 'Hangul Jamo' Unicode range. - /// - /// - /// This range spans the code points U+1100 .. U+11FF. - /// See http://www.unicode.org/charts/PDF/U1100.pdf for the full set of characters in this range. - /// - public static ICodePointFilter HangulJamo - { - get - { - return GetFilter(ref _hangulJamo, first: '\u1100', last: '\u11FF'); - } - } - private static DefinedCharacterCodePointFilter _hangulJamo; - - /// - /// A filter which allows characters in the 'Ethiopic' Unicode range. - /// - /// - /// This range spans the code points U+1200 .. U+137F. - /// See http://www.unicode.org/charts/PDF/U1200.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Ethiopic - { - get - { - return GetFilter(ref _ethiopic, first: '\u1200', last: '\u137F'); - } - } - private static DefinedCharacterCodePointFilter _ethiopic; - - /// - /// A filter which allows characters in the 'Ethiopic Supplement' Unicode range. - /// - /// - /// This range spans the code points U+1380 .. U+139F. - /// See http://www.unicode.org/charts/PDF/U1380.pdf for the full set of characters in this range. - /// - public static ICodePointFilter EthiopicSupplement - { - get - { - return GetFilter(ref _ethiopicSupplement, first: '\u1380', last: '\u139F'); - } - } - private static DefinedCharacterCodePointFilter _ethiopicSupplement; - - /// - /// A filter which allows characters in the 'Cherokee' Unicode range. - /// - /// - /// This range spans the code points U+13A0 .. U+13FF. - /// See http://www.unicode.org/charts/PDF/U13A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Cherokee - { - get - { - return GetFilter(ref _cherokee, first: '\u13A0', last: '\u13FF'); - } - } - private static DefinedCharacterCodePointFilter _cherokee; - - /// - /// A filter which allows characters in the 'Unified Canadian Aboriginal Syllabics' Unicode range. - /// - /// - /// This range spans the code points U+1400 .. U+167F. - /// See http://www.unicode.org/charts/PDF/U1400.pdf for the full set of characters in this range. - /// - public static ICodePointFilter UnifiedCanadianAboriginalSyllabics - { - get - { - return GetFilter(ref _unifiedCanadianAboriginalSyllabics, first: '\u1400', last: '\u167F'); - } - } - private static DefinedCharacterCodePointFilter _unifiedCanadianAboriginalSyllabics; - - /// - /// A filter which allows characters in the 'Ogham' Unicode range. - /// - /// - /// This range spans the code points U+1680 .. U+169F. - /// See http://www.unicode.org/charts/PDF/U1680.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Ogham - { - get - { - return GetFilter(ref _ogham, first: '\u1680', last: '\u169F'); - } - } - private static DefinedCharacterCodePointFilter _ogham; - - /// - /// A filter which allows characters in the 'Runic' Unicode range. - /// - /// - /// This range spans the code points U+16A0 .. U+16FF. - /// See http://www.unicode.org/charts/PDF/U16A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Runic - { - get - { - return GetFilter(ref _runic, first: '\u16A0', last: '\u16FF'); - } - } - private static DefinedCharacterCodePointFilter _runic; - - /// - /// A filter which allows characters in the 'Tagalog' Unicode range. - /// - /// - /// This range spans the code points U+1700 .. U+171F. - /// See http://www.unicode.org/charts/PDF/U1700.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Tagalog - { - get - { - return GetFilter(ref _tagalog, first: '\u1700', last: '\u171F'); - } - } - private static DefinedCharacterCodePointFilter _tagalog; - - /// - /// A filter which allows characters in the 'Hanunoo' Unicode range. - /// - /// - /// This range spans the code points U+1720 .. U+173F. - /// See http://www.unicode.org/charts/PDF/U1720.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Hanunoo - { - get - { - return GetFilter(ref _hanunoo, first: '\u1720', last: '\u173F'); - } - } - private static DefinedCharacterCodePointFilter _hanunoo; - - /// - /// A filter which allows characters in the 'Buhid' Unicode range. - /// - /// - /// This range spans the code points U+1740 .. U+175F. - /// See http://www.unicode.org/charts/PDF/U1740.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Buhid - { - get - { - return GetFilter(ref _buhid, first: '\u1740', last: '\u175F'); - } - } - private static DefinedCharacterCodePointFilter _buhid; - - /// - /// A filter which allows characters in the 'Tagbanwa' Unicode range. - /// - /// - /// This range spans the code points U+1760 .. U+177F. - /// See http://www.unicode.org/charts/PDF/U1760.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Tagbanwa - { - get - { - return GetFilter(ref _tagbanwa, first: '\u1760', last: '\u177F'); - } - } - private static DefinedCharacterCodePointFilter _tagbanwa; - - /// - /// A filter which allows characters in the 'Khmer' Unicode range. - /// - /// - /// This range spans the code points U+1780 .. U+17FF. - /// See http://www.unicode.org/charts/PDF/U1780.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Khmer - { - get - { - return GetFilter(ref _khmer, first: '\u1780', last: '\u17FF'); - } - } - private static DefinedCharacterCodePointFilter _khmer; - - /// - /// A filter which allows characters in the 'Mongolian' Unicode range. - /// - /// - /// This range spans the code points U+1800 .. U+18AF. - /// See http://www.unicode.org/charts/PDF/U1800.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Mongolian - { - get - { - return GetFilter(ref _mongolian, first: '\u1800', last: '\u18AF'); - } - } - private static DefinedCharacterCodePointFilter _mongolian; - - /// - /// A filter which allows characters in the 'Unified Canadian Aboriginal Syllabics Extended' Unicode range. - /// - /// - /// This range spans the code points U+18B0 .. U+18FF. - /// See http://www.unicode.org/charts/PDF/U18B0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter UnifiedCanadianAboriginalSyllabicsExtended - { - get - { - return GetFilter(ref _unifiedCanadianAboriginalSyllabicsExtended, first: '\u18B0', last: '\u18FF'); - } - } - private static DefinedCharacterCodePointFilter _unifiedCanadianAboriginalSyllabicsExtended; - - /// - /// A filter which allows characters in the 'Limbu' Unicode range. - /// - /// - /// This range spans the code points U+1900 .. U+194F. - /// See http://www.unicode.org/charts/PDF/U1900.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Limbu - { - get - { - return GetFilter(ref _limbu, first: '\u1900', last: '\u194F'); - } - } - private static DefinedCharacterCodePointFilter _limbu; - - /// - /// A filter which allows characters in the 'Tai Le' Unicode range. - /// - /// - /// This range spans the code points U+1950 .. U+197F. - /// See http://www.unicode.org/charts/PDF/U1950.pdf for the full set of characters in this range. - /// - public static ICodePointFilter TaiLe - { - get - { - return GetFilter(ref _taiLe, first: '\u1950', last: '\u197F'); - } - } - private static DefinedCharacterCodePointFilter _taiLe; - - /// - /// A filter which allows characters in the 'New Tai Lue' Unicode range. - /// - /// - /// This range spans the code points U+1980 .. U+19DF. - /// See http://www.unicode.org/charts/PDF/U1980.pdf for the full set of characters in this range. - /// - public static ICodePointFilter NewTaiLue - { - get - { - return GetFilter(ref _newTaiLue, first: '\u1980', last: '\u19DF'); - } - } - private static DefinedCharacterCodePointFilter _newTaiLue; - - /// - /// A filter which allows characters in the 'Khmer Symbols' Unicode range. - /// - /// - /// This range spans the code points U+19E0 .. U+19FF. - /// See http://www.unicode.org/charts/PDF/U19E0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter KhmerSymbols - { - get - { - return GetFilter(ref _khmerSymbols, first: '\u19E0', last: '\u19FF'); - } - } - private static DefinedCharacterCodePointFilter _khmerSymbols; - - /// - /// A filter which allows characters in the 'Buginese' Unicode range. - /// - /// - /// This range spans the code points U+1A00 .. U+1A1F. - /// See http://www.unicode.org/charts/PDF/U1A00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Buginese - { - get - { - return GetFilter(ref _buginese, first: '\u1A00', last: '\u1A1F'); - } - } - private static DefinedCharacterCodePointFilter _buginese; - - /// - /// A filter which allows characters in the 'Tai Tham' Unicode range. - /// - /// - /// This range spans the code points U+1A20 .. U+1AAF. - /// See http://www.unicode.org/charts/PDF/U1A20.pdf for the full set of characters in this range. - /// - public static ICodePointFilter TaiTham - { - get - { - return GetFilter(ref _taiTham, first: '\u1A20', last: '\u1AAF'); - } - } - private static DefinedCharacterCodePointFilter _taiTham; - - /// - /// A filter which allows characters in the 'Combining Diacritical Marks Extended' Unicode range. - /// - /// - /// This range spans the code points U+1AB0 .. U+1AFF. - /// See http://www.unicode.org/charts/PDF/U1AB0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CombiningDiacriticalMarksExtended - { - get - { - return GetFilter(ref _combiningDiacriticalMarksExtended, first: '\u1AB0', last: '\u1AFF'); - } - } - private static DefinedCharacterCodePointFilter _combiningDiacriticalMarksExtended; - - /// - /// A filter which allows characters in the 'Balinese' Unicode range. - /// - /// - /// This range spans the code points U+1B00 .. U+1B7F. - /// See http://www.unicode.org/charts/PDF/U1B00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Balinese - { - get - { - return GetFilter(ref _balinese, first: '\u1B00', last: '\u1B7F'); - } - } - private static DefinedCharacterCodePointFilter _balinese; - - /// - /// A filter which allows characters in the 'Sundanese' Unicode range. - /// - /// - /// This range spans the code points U+1B80 .. U+1BBF. - /// See http://www.unicode.org/charts/PDF/U1B80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Sundanese - { - get - { - return GetFilter(ref _sundanese, first: '\u1B80', last: '\u1BBF'); - } - } - private static DefinedCharacterCodePointFilter _sundanese; - - /// - /// A filter which allows characters in the 'Batak' Unicode range. - /// - /// - /// This range spans the code points U+1BC0 .. U+1BFF. - /// See http://www.unicode.org/charts/PDF/U1BC0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Batak - { - get - { - return GetFilter(ref _batak, first: '\u1BC0', last: '\u1BFF'); - } - } - private static DefinedCharacterCodePointFilter _batak; - - /// - /// A filter which allows characters in the 'Lepcha' Unicode range. - /// - /// - /// This range spans the code points U+1C00 .. U+1C4F. - /// See http://www.unicode.org/charts/PDF/U1C00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Lepcha - { - get - { - return GetFilter(ref _lepcha, first: '\u1C00', last: '\u1C4F'); - } - } - private static DefinedCharacterCodePointFilter _lepcha; - - /// - /// A filter which allows characters in the 'Ol Chiki' Unicode range. - /// - /// - /// This range spans the code points U+1C50 .. U+1C7F. - /// See http://www.unicode.org/charts/PDF/U1C50.pdf for the full set of characters in this range. - /// - public static ICodePointFilter OlChiki - { - get - { - return GetFilter(ref _olChiki, first: '\u1C50', last: '\u1C7F'); - } - } - private static DefinedCharacterCodePointFilter _olChiki; - - /// - /// A filter which allows characters in the 'Sundanese Supplement' Unicode range. - /// - /// - /// This range spans the code points U+1CC0 .. U+1CCF. - /// See http://www.unicode.org/charts/PDF/U1CC0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SundaneseSupplement - { - get - { - return GetFilter(ref _sundaneseSupplement, first: '\u1CC0', last: '\u1CCF'); - } - } - private static DefinedCharacterCodePointFilter _sundaneseSupplement; - - /// - /// A filter which allows characters in the 'Vedic Extensions' Unicode range. - /// - /// - /// This range spans the code points U+1CD0 .. U+1CFF. - /// See http://www.unicode.org/charts/PDF/U1CD0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter VedicExtensions - { - get - { - return GetFilter(ref _vedicExtensions, first: '\u1CD0', last: '\u1CFF'); - } - } - private static DefinedCharacterCodePointFilter _vedicExtensions; - - /// - /// A filter which allows characters in the 'Phonetic Extensions' Unicode range. - /// - /// - /// This range spans the code points U+1D00 .. U+1D7F. - /// See http://www.unicode.org/charts/PDF/U1D00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter PhoneticExtensions - { - get - { - return GetFilter(ref _phoneticExtensions, first: '\u1D00', last: '\u1D7F'); - } - } - private static DefinedCharacterCodePointFilter _phoneticExtensions; - - /// - /// A filter which allows characters in the 'Phonetic Extensions Supplement' Unicode range. - /// - /// - /// This range spans the code points U+1D80 .. U+1DBF. - /// See http://www.unicode.org/charts/PDF/U1D80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter PhoneticExtensionsSupplement - { - get - { - return GetFilter(ref _phoneticExtensionsSupplement, first: '\u1D80', last: '\u1DBF'); - } - } - private static DefinedCharacterCodePointFilter _phoneticExtensionsSupplement; - - /// - /// A filter which allows characters in the 'Combining Diacritical Marks Supplement' Unicode range. - /// - /// - /// This range spans the code points U+1DC0 .. U+1DFF. - /// See http://www.unicode.org/charts/PDF/U1DC0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CombiningDiacriticalMarksSupplement - { - get - { - return GetFilter(ref _combiningDiacriticalMarksSupplement, first: '\u1DC0', last: '\u1DFF'); - } - } - private static DefinedCharacterCodePointFilter _combiningDiacriticalMarksSupplement; - - /// - /// A filter which allows characters in the 'Latin Extended Additional' Unicode range. - /// - /// - /// This range spans the code points U+1E00 .. U+1EFF. - /// See http://www.unicode.org/charts/PDF/U1E00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LatinExtendedAdditional - { - get - { - return GetFilter(ref _latinExtendedAdditional, first: '\u1E00', last: '\u1EFF'); - } - } - private static DefinedCharacterCodePointFilter _latinExtendedAdditional; - - /// - /// A filter which allows characters in the 'Greek Extended' Unicode range. - /// - /// - /// This range spans the code points U+1F00 .. U+1FFF. - /// See http://www.unicode.org/charts/PDF/U1F00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter GreekExtended - { - get - { - return GetFilter(ref _greekExtended, first: '\u1F00', last: '\u1FFF'); - } - } - private static DefinedCharacterCodePointFilter _greekExtended; - - /// - /// A filter which allows characters in the 'General Punctuation' Unicode range. - /// - /// - /// This range spans the code points U+2000 .. U+206F. - /// See http://www.unicode.org/charts/PDF/U2000.pdf for the full set of characters in this range. - /// - public static ICodePointFilter GeneralPunctuation - { - get - { - return GetFilter(ref _generalPunctuation, first: '\u2000', last: '\u206F'); - } - } - private static DefinedCharacterCodePointFilter _generalPunctuation; - - /// - /// A filter which allows characters in the 'Superscripts and Subscripts' Unicode range. - /// - /// - /// This range spans the code points U+2070 .. U+209F. - /// See http://www.unicode.org/charts/PDF/U2070.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SuperscriptsandSubscripts - { - get - { - return GetFilter(ref _superscriptsandSubscripts, first: '\u2070', last: '\u209F'); - } - } - private static DefinedCharacterCodePointFilter _superscriptsandSubscripts; - - /// - /// A filter which allows characters in the 'Currency Symbols' Unicode range. - /// - /// - /// This range spans the code points U+20A0 .. U+20CF. - /// See http://www.unicode.org/charts/PDF/U20A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CurrencySymbols - { - get - { - return GetFilter(ref _currencySymbols, first: '\u20A0', last: '\u20CF'); - } - } - private static DefinedCharacterCodePointFilter _currencySymbols; - - /// - /// A filter which allows characters in the 'Combining Diacritical Marks for Symbols' Unicode range. - /// - /// - /// This range spans the code points U+20D0 .. U+20FF. - /// See http://www.unicode.org/charts/PDF/U20D0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CombiningDiacriticalMarksforSymbols - { - get - { - return GetFilter(ref _combiningDiacriticalMarksforSymbols, first: '\u20D0', last: '\u20FF'); - } - } - private static DefinedCharacterCodePointFilter _combiningDiacriticalMarksforSymbols; - - /// - /// A filter which allows characters in the 'Letterlike Symbols' Unicode range. - /// - /// - /// This range spans the code points U+2100 .. U+214F. - /// See http://www.unicode.org/charts/PDF/U2100.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LetterlikeSymbols - { - get - { - return GetFilter(ref _letterlikeSymbols, first: '\u2100', last: '\u214F'); - } - } - private static DefinedCharacterCodePointFilter _letterlikeSymbols; - - /// - /// A filter which allows characters in the 'Number Forms' Unicode range. - /// - /// - /// This range spans the code points U+2150 .. U+218F. - /// See http://www.unicode.org/charts/PDF/U2150.pdf for the full set of characters in this range. - /// - public static ICodePointFilter NumberForms - { - get - { - return GetFilter(ref _numberForms, first: '\u2150', last: '\u218F'); - } - } - private static DefinedCharacterCodePointFilter _numberForms; - - /// - /// A filter which allows characters in the 'Arrows' Unicode range. - /// - /// - /// This range spans the code points U+2190 .. U+21FF. - /// See http://www.unicode.org/charts/PDF/U2190.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Arrows - { - get - { - return GetFilter(ref _arrows, first: '\u2190', last: '\u21FF'); - } - } - private static DefinedCharacterCodePointFilter _arrows; - - /// - /// A filter which allows characters in the 'Mathematical Operators' Unicode range. - /// - /// - /// This range spans the code points U+2200 .. U+22FF. - /// See http://www.unicode.org/charts/PDF/U2200.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MathematicalOperators - { - get - { - return GetFilter(ref _mathematicalOperators, first: '\u2200', last: '\u22FF'); - } - } - private static DefinedCharacterCodePointFilter _mathematicalOperators; - - /// - /// A filter which allows characters in the 'Miscellaneous Technical' Unicode range. - /// - /// - /// This range spans the code points U+2300 .. U+23FF. - /// See http://www.unicode.org/charts/PDF/U2300.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MiscellaneousTechnical - { - get - { - return GetFilter(ref _miscellaneousTechnical, first: '\u2300', last: '\u23FF'); - } - } - private static DefinedCharacterCodePointFilter _miscellaneousTechnical; - - /// - /// A filter which allows characters in the 'Control Pictures' Unicode range. - /// - /// - /// This range spans the code points U+2400 .. U+243F. - /// See http://www.unicode.org/charts/PDF/U2400.pdf for the full set of characters in this range. - /// - public static ICodePointFilter ControlPictures - { - get - { - return GetFilter(ref _controlPictures, first: '\u2400', last: '\u243F'); - } - } - private static DefinedCharacterCodePointFilter _controlPictures; - - /// - /// A filter which allows characters in the 'Optical Character Recognition' Unicode range. - /// - /// - /// This range spans the code points U+2440 .. U+245F. - /// See http://www.unicode.org/charts/PDF/U2440.pdf for the full set of characters in this range. - /// - public static ICodePointFilter OpticalCharacterRecognition - { - get - { - return GetFilter(ref _opticalCharacterRecognition, first: '\u2440', last: '\u245F'); - } - } - private static DefinedCharacterCodePointFilter _opticalCharacterRecognition; - - /// - /// A filter which allows characters in the 'Enclosed Alphanumerics' Unicode range. - /// - /// - /// This range spans the code points U+2460 .. U+24FF. - /// See http://www.unicode.org/charts/PDF/U2460.pdf for the full set of characters in this range. - /// - public static ICodePointFilter EnclosedAlphanumerics - { - get - { - return GetFilter(ref _enclosedAlphanumerics, first: '\u2460', last: '\u24FF'); - } - } - private static DefinedCharacterCodePointFilter _enclosedAlphanumerics; - - /// - /// A filter which allows characters in the 'Box Drawing' Unicode range. - /// - /// - /// This range spans the code points U+2500 .. U+257F. - /// See http://www.unicode.org/charts/PDF/U2500.pdf for the full set of characters in this range. - /// - public static ICodePointFilter BoxDrawing - { - get - { - return GetFilter(ref _boxDrawing, first: '\u2500', last: '\u257F'); - } - } - private static DefinedCharacterCodePointFilter _boxDrawing; - - /// - /// A filter which allows characters in the 'Block Elements' Unicode range. - /// - /// - /// This range spans the code points U+2580 .. U+259F. - /// See http://www.unicode.org/charts/PDF/U2580.pdf for the full set of characters in this range. - /// - public static ICodePointFilter BlockElements - { - get - { - return GetFilter(ref _blockElements, first: '\u2580', last: '\u259F'); - } - } - private static DefinedCharacterCodePointFilter _blockElements; - - /// - /// A filter which allows characters in the 'Geometric Shapes' Unicode range. - /// - /// - /// This range spans the code points U+25A0 .. U+25FF. - /// See http://www.unicode.org/charts/PDF/U25A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter GeometricShapes - { - get - { - return GetFilter(ref _geometricShapes, first: '\u25A0', last: '\u25FF'); - } - } - private static DefinedCharacterCodePointFilter _geometricShapes; - - /// - /// A filter which allows characters in the 'Miscellaneous Symbols' Unicode range. - /// - /// - /// This range spans the code points U+2600 .. U+26FF. - /// See http://www.unicode.org/charts/PDF/U2600.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MiscellaneousSymbols - { - get - { - return GetFilter(ref _miscellaneousSymbols, first: '\u2600', last: '\u26FF'); - } - } - private static DefinedCharacterCodePointFilter _miscellaneousSymbols; - - /// - /// A filter which allows characters in the 'Dingbats' Unicode range. - /// - /// - /// This range spans the code points U+2700 .. U+27BF. - /// See http://www.unicode.org/charts/PDF/U2700.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Dingbats - { - get - { - return GetFilter(ref _dingbats, first: '\u2700', last: '\u27BF'); - } - } - private static DefinedCharacterCodePointFilter _dingbats; - - /// - /// A filter which allows characters in the 'Miscellaneous Mathematical Symbols-A' Unicode range. - /// - /// - /// This range spans the code points U+27C0 .. U+27EF. - /// See http://www.unicode.org/charts/PDF/U27C0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MiscellaneousMathematicalSymbolsA - { - get - { - return GetFilter(ref _miscellaneousMathematicalSymbolsA, first: '\u27C0', last: '\u27EF'); - } - } - private static DefinedCharacterCodePointFilter _miscellaneousMathematicalSymbolsA; - - /// - /// A filter which allows characters in the 'Supplemental Arrows-A' Unicode range. - /// - /// - /// This range spans the code points U+27F0 .. U+27FF. - /// See http://www.unicode.org/charts/PDF/U27F0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SupplementalArrowsA - { - get - { - return GetFilter(ref _supplementalArrowsA, first: '\u27F0', last: '\u27FF'); - } - } - private static DefinedCharacterCodePointFilter _supplementalArrowsA; - - /// - /// A filter which allows characters in the 'Braille Patterns' Unicode range. - /// - /// - /// This range spans the code points U+2800 .. U+28FF. - /// See http://www.unicode.org/charts/PDF/U2800.pdf for the full set of characters in this range. - /// - public static ICodePointFilter BraillePatterns - { - get - { - return GetFilter(ref _braillePatterns, first: '\u2800', last: '\u28FF'); - } - } - private static DefinedCharacterCodePointFilter _braillePatterns; - - /// - /// A filter which allows characters in the 'Supplemental Arrows-B' Unicode range. - /// - /// - /// This range spans the code points U+2900 .. U+297F. - /// See http://www.unicode.org/charts/PDF/U2900.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SupplementalArrowsB - { - get - { - return GetFilter(ref _supplementalArrowsB, first: '\u2900', last: '\u297F'); - } - } - private static DefinedCharacterCodePointFilter _supplementalArrowsB; - - /// - /// A filter which allows characters in the 'Miscellaneous Mathematical Symbols-B' Unicode range. - /// - /// - /// This range spans the code points U+2980 .. U+29FF. - /// See http://www.unicode.org/charts/PDF/U2980.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MiscellaneousMathematicalSymbolsB - { - get - { - return GetFilter(ref _miscellaneousMathematicalSymbolsB, first: '\u2980', last: '\u29FF'); - } - } - private static DefinedCharacterCodePointFilter _miscellaneousMathematicalSymbolsB; - - /// - /// A filter which allows characters in the 'Supplemental Mathematical Operators' Unicode range. - /// - /// - /// This range spans the code points U+2A00 .. U+2AFF. - /// See http://www.unicode.org/charts/PDF/U2A00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SupplementalMathematicalOperators - { - get - { - return GetFilter(ref _supplementalMathematicalOperators, first: '\u2A00', last: '\u2AFF'); - } - } - private static DefinedCharacterCodePointFilter _supplementalMathematicalOperators; - - /// - /// A filter which allows characters in the 'Miscellaneous Symbols and Arrows' Unicode range. - /// - /// - /// This range spans the code points U+2B00 .. U+2BFF. - /// See http://www.unicode.org/charts/PDF/U2B00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MiscellaneousSymbolsandArrows - { - get - { - return GetFilter(ref _miscellaneousSymbolsandArrows, first: '\u2B00', last: '\u2BFF'); - } - } - private static DefinedCharacterCodePointFilter _miscellaneousSymbolsandArrows; - - /// - /// A filter which allows characters in the 'Glagolitic' Unicode range. - /// - /// - /// This range spans the code points U+2C00 .. U+2C5F. - /// See http://www.unicode.org/charts/PDF/U2C00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Glagolitic - { - get - { - return GetFilter(ref _glagolitic, first: '\u2C00', last: '\u2C5F'); - } - } - private static DefinedCharacterCodePointFilter _glagolitic; - - /// - /// A filter which allows characters in the 'Latin Extended-C' Unicode range. - /// - /// - /// This range spans the code points U+2C60 .. U+2C7F. - /// See http://www.unicode.org/charts/PDF/U2C60.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LatinExtendedC - { - get - { - return GetFilter(ref _latinExtendedC, first: '\u2C60', last: '\u2C7F'); - } - } - private static DefinedCharacterCodePointFilter _latinExtendedC; - - /// - /// A filter which allows characters in the 'Coptic' Unicode range. - /// - /// - /// This range spans the code points U+2C80 .. U+2CFF. - /// See http://www.unicode.org/charts/PDF/U2C80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Coptic - { - get - { - return GetFilter(ref _coptic, first: '\u2C80', last: '\u2CFF'); - } - } - private static DefinedCharacterCodePointFilter _coptic; - - /// - /// A filter which allows characters in the 'Georgian Supplement' Unicode range. - /// - /// - /// This range spans the code points U+2D00 .. U+2D2F. - /// See http://www.unicode.org/charts/PDF/U2D00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter GeorgianSupplement - { - get - { - return GetFilter(ref _georgianSupplement, first: '\u2D00', last: '\u2D2F'); - } - } - private static DefinedCharacterCodePointFilter _georgianSupplement; - - /// - /// A filter which allows characters in the 'Tifinagh' Unicode range. - /// - /// - /// This range spans the code points U+2D30 .. U+2D7F. - /// See http://www.unicode.org/charts/PDF/U2D30.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Tifinagh - { - get - { - return GetFilter(ref _tifinagh, first: '\u2D30', last: '\u2D7F'); - } - } - private static DefinedCharacterCodePointFilter _tifinagh; - - /// - /// A filter which allows characters in the 'Ethiopic Extended' Unicode range. - /// - /// - /// This range spans the code points U+2D80 .. U+2DDF. - /// See http://www.unicode.org/charts/PDF/U2D80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter EthiopicExtended - { - get - { - return GetFilter(ref _ethiopicExtended, first: '\u2D80', last: '\u2DDF'); - } - } - private static DefinedCharacterCodePointFilter _ethiopicExtended; - - /// - /// A filter which allows characters in the 'Cyrillic Extended-A' Unicode range. - /// - /// - /// This range spans the code points U+2DE0 .. U+2DFF. - /// See http://www.unicode.org/charts/PDF/U2DE0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CyrillicExtendedA - { - get - { - return GetFilter(ref _cyrillicExtendedA, first: '\u2DE0', last: '\u2DFF'); - } - } - private static DefinedCharacterCodePointFilter _cyrillicExtendedA; - - /// - /// A filter which allows characters in the 'Supplemental Punctuation' Unicode range. - /// - /// - /// This range spans the code points U+2E00 .. U+2E7F. - /// See http://www.unicode.org/charts/PDF/U2E00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SupplementalPunctuation - { - get - { - return GetFilter(ref _supplementalPunctuation, first: '\u2E00', last: '\u2E7F'); - } - } - private static DefinedCharacterCodePointFilter _supplementalPunctuation; - - /// - /// A filter which allows characters in the 'CJK Radicals Supplement' Unicode range. - /// - /// - /// This range spans the code points U+2E80 .. U+2EFF. - /// See http://www.unicode.org/charts/PDF/U2E80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKRadicalsSupplement - { - get - { - return GetFilter(ref _cjkRadicalsSupplement, first: '\u2E80', last: '\u2EFF'); - } - } - private static DefinedCharacterCodePointFilter _cjkRadicalsSupplement; - - /// - /// A filter which allows characters in the 'Kangxi Radicals' Unicode range. - /// - /// - /// This range spans the code points U+2F00 .. U+2FDF. - /// See http://www.unicode.org/charts/PDF/U2F00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter KangxiRadicals - { - get - { - return GetFilter(ref _kangxiRadicals, first: '\u2F00', last: '\u2FDF'); - } - } - private static DefinedCharacterCodePointFilter _kangxiRadicals; - - /// - /// A filter which allows characters in the 'Ideographic Description Characters' Unicode range. - /// - /// - /// This range spans the code points U+2FF0 .. U+2FFF. - /// See http://www.unicode.org/charts/PDF/U2FF0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter IdeographicDescriptionCharacters - { - get - { - return GetFilter(ref _ideographicDescriptionCharacters, first: '\u2FF0', last: '\u2FFF'); - } - } - private static DefinedCharacterCodePointFilter _ideographicDescriptionCharacters; - - /// - /// A filter which allows characters in the 'CJK Symbols and Punctuation' Unicode range. - /// - /// - /// This range spans the code points U+3000 .. U+303F. - /// See http://www.unicode.org/charts/PDF/U3000.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKSymbolsandPunctuation - { - get - { - return GetFilter(ref _cjkSymbolsandPunctuation, first: '\u3000', last: '\u303F'); - } - } - private static DefinedCharacterCodePointFilter _cjkSymbolsandPunctuation; - - /// - /// A filter which allows characters in the 'Hiragana' Unicode range. - /// - /// - /// This range spans the code points U+3040 .. U+309F. - /// See http://www.unicode.org/charts/PDF/U3040.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Hiragana - { - get - { - return GetFilter(ref _hiragana, first: '\u3040', last: '\u309F'); - } - } - private static DefinedCharacterCodePointFilter _hiragana; - - /// - /// A filter which allows characters in the 'Katakana' Unicode range. - /// - /// - /// This range spans the code points U+30A0 .. U+30FF. - /// See http://www.unicode.org/charts/PDF/U30A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Katakana - { - get - { - return GetFilter(ref _katakana, first: '\u30A0', last: '\u30FF'); - } - } - private static DefinedCharacterCodePointFilter _katakana; - - /// - /// A filter which allows characters in the 'Bopomofo' Unicode range. - /// - /// - /// This range spans the code points U+3100 .. U+312F. - /// See http://www.unicode.org/charts/PDF/U3100.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Bopomofo - { - get - { - return GetFilter(ref _bopomofo, first: '\u3100', last: '\u312F'); - } - } - private static DefinedCharacterCodePointFilter _bopomofo; - - /// - /// A filter which allows characters in the 'Hangul Compatibility Jamo' Unicode range. - /// - /// - /// This range spans the code points U+3130 .. U+318F. - /// See http://www.unicode.org/charts/PDF/U3130.pdf for the full set of characters in this range. - /// - public static ICodePointFilter HangulCompatibilityJamo - { - get - { - return GetFilter(ref _hangulCompatibilityJamo, first: '\u3130', last: '\u318F'); - } - } - private static DefinedCharacterCodePointFilter _hangulCompatibilityJamo; - - /// - /// A filter which allows characters in the 'Kanbun' Unicode range. - /// - /// - /// This range spans the code points U+3190 .. U+319F. - /// See http://www.unicode.org/charts/PDF/U3190.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Kanbun - { - get - { - return GetFilter(ref _kanbun, first: '\u3190', last: '\u319F'); - } - } - private static DefinedCharacterCodePointFilter _kanbun; - - /// - /// A filter which allows characters in the 'Bopomofo Extended' Unicode range. - /// - /// - /// This range spans the code points U+31A0 .. U+31BF. - /// See http://www.unicode.org/charts/PDF/U31A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter BopomofoExtended - { - get - { - return GetFilter(ref _bopomofoExtended, first: '\u31A0', last: '\u31BF'); - } - } - private static DefinedCharacterCodePointFilter _bopomofoExtended; - - /// - /// A filter which allows characters in the 'CJK Strokes' Unicode range. - /// - /// - /// This range spans the code points U+31C0 .. U+31EF. - /// See http://www.unicode.org/charts/PDF/U31C0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKStrokes - { - get - { - return GetFilter(ref _cjkStrokes, first: '\u31C0', last: '\u31EF'); - } - } - private static DefinedCharacterCodePointFilter _cjkStrokes; - - /// - /// A filter which allows characters in the 'Katakana Phonetic Extensions' Unicode range. - /// - /// - /// This range spans the code points U+31F0 .. U+31FF. - /// See http://www.unicode.org/charts/PDF/U31F0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter KatakanaPhoneticExtensions - { - get - { - return GetFilter(ref _katakanaPhoneticExtensions, first: '\u31F0', last: '\u31FF'); - } - } - private static DefinedCharacterCodePointFilter _katakanaPhoneticExtensions; - - /// - /// A filter which allows characters in the 'Enclosed CJK Letters and Months' Unicode range. - /// - /// - /// This range spans the code points U+3200 .. U+32FF. - /// See http://www.unicode.org/charts/PDF/U3200.pdf for the full set of characters in this range. - /// - public static ICodePointFilter EnclosedCJKLettersandMonths - { - get - { - return GetFilter(ref _enclosedCJKLettersandMonths, first: '\u3200', last: '\u32FF'); - } - } - private static DefinedCharacterCodePointFilter _enclosedCJKLettersandMonths; - - /// - /// A filter which allows characters in the 'CJK Compatibility' Unicode range. - /// - /// - /// This range spans the code points U+3300 .. U+33FF. - /// See http://www.unicode.org/charts/PDF/U3300.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKCompatibility - { - get - { - return GetFilter(ref _cjkCompatibility, first: '\u3300', last: '\u33FF'); - } - } - private static DefinedCharacterCodePointFilter _cjkCompatibility; - - /// - /// A filter which allows characters in the 'CJK Unified Ideographs Extension A' Unicode range. - /// - /// - /// This range spans the code points U+3400 .. U+4DBF. - /// See http://www.unicode.org/charts/PDF/U3400.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKUnifiedIdeographsExtensionA - { - get - { - return GetFilter(ref _cjkUnifiedIdeographsExtensionA, first: '\u3400', last: '\u4DBF'); - } - } - private static DefinedCharacterCodePointFilter _cjkUnifiedIdeographsExtensionA; - - /// - /// A filter which allows characters in the 'Yijing Hexagram Symbols' Unicode range. - /// - /// - /// This range spans the code points U+4DC0 .. U+4DFF. - /// See http://www.unicode.org/charts/PDF/U4DC0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter YijingHexagramSymbols - { - get - { - return GetFilter(ref _yijingHexagramSymbols, first: '\u4DC0', last: '\u4DFF'); - } - } - private static DefinedCharacterCodePointFilter _yijingHexagramSymbols; - - /// - /// A filter which allows characters in the 'CJK Unified Ideographs' Unicode range. - /// - /// - /// This range spans the code points U+4E00 .. U+9FFF. - /// See http://www.unicode.org/charts/PDF/U4E00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKUnifiedIdeographs - { - get - { - return GetFilter(ref _cjkUnifiedIdeographs, first: '\u4E00', last: '\u9FFF'); - } - } - private static DefinedCharacterCodePointFilter _cjkUnifiedIdeographs; - - /// - /// A filter which allows characters in the 'Yi Syllables' Unicode range. - /// - /// - /// This range spans the code points U+A000 .. U+A48F. - /// See http://www.unicode.org/charts/PDF/UA000.pdf for the full set of characters in this range. - /// - public static ICodePointFilter YiSyllables - { - get - { - return GetFilter(ref _yiSyllables, first: '\uA000', last: '\uA48F'); - } - } - private static DefinedCharacterCodePointFilter _yiSyllables; - - /// - /// A filter which allows characters in the 'Yi Radicals' Unicode range. - /// - /// - /// This range spans the code points U+A490 .. U+A4CF. - /// See http://www.unicode.org/charts/PDF/UA490.pdf for the full set of characters in this range. - /// - public static ICodePointFilter YiRadicals - { - get - { - return GetFilter(ref _yiRadicals, first: '\uA490', last: '\uA4CF'); - } - } - private static DefinedCharacterCodePointFilter _yiRadicals; - - /// - /// A filter which allows characters in the 'Lisu' Unicode range. - /// - /// - /// This range spans the code points U+A4D0 .. U+A4FF. - /// See http://www.unicode.org/charts/PDF/UA4D0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Lisu - { - get - { - return GetFilter(ref _lisu, first: '\uA4D0', last: '\uA4FF'); - } - } - private static DefinedCharacterCodePointFilter _lisu; - - /// - /// A filter which allows characters in the 'Vai' Unicode range. - /// - /// - /// This range spans the code points U+A500 .. U+A63F. - /// See http://www.unicode.org/charts/PDF/UA500.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Vai - { - get - { - return GetFilter(ref _vai, first: '\uA500', last: '\uA63F'); - } - } - private static DefinedCharacterCodePointFilter _vai; - - /// - /// A filter which allows characters in the 'Cyrillic Extended-B' Unicode range. - /// - /// - /// This range spans the code points U+A640 .. U+A69F. - /// See http://www.unicode.org/charts/PDF/UA640.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CyrillicExtendedB - { - get - { - return GetFilter(ref _cyrillicExtendedB, first: '\uA640', last: '\uA69F'); - } - } - private static DefinedCharacterCodePointFilter _cyrillicExtendedB; - - /// - /// A filter which allows characters in the 'Bamum' Unicode range. - /// - /// - /// This range spans the code points U+A6A0 .. U+A6FF. - /// See http://www.unicode.org/charts/PDF/UA6A0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Bamum - { - get - { - return GetFilter(ref _bamum, first: '\uA6A0', last: '\uA6FF'); - } - } - private static DefinedCharacterCodePointFilter _bamum; - - /// - /// A filter which allows characters in the 'Modifier Tone Letters' Unicode range. - /// - /// - /// This range spans the code points U+A700 .. U+A71F. - /// See http://www.unicode.org/charts/PDF/UA700.pdf for the full set of characters in this range. - /// - public static ICodePointFilter ModifierToneLetters - { - get - { - return GetFilter(ref _modifierToneLetters, first: '\uA700', last: '\uA71F'); - } - } - private static DefinedCharacterCodePointFilter _modifierToneLetters; - - /// - /// A filter which allows characters in the 'Latin Extended-D' Unicode range. - /// - /// - /// This range spans the code points U+A720 .. U+A7FF. - /// See http://www.unicode.org/charts/PDF/UA720.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LatinExtendedD - { - get - { - return GetFilter(ref _latinExtendedD, first: '\uA720', last: '\uA7FF'); - } - } - private static DefinedCharacterCodePointFilter _latinExtendedD; - - /// - /// A filter which allows characters in the 'Syloti Nagri' Unicode range. - /// - /// - /// This range spans the code points U+A800 .. U+A82F. - /// See http://www.unicode.org/charts/PDF/UA800.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SylotiNagri - { - get - { - return GetFilter(ref _sylotiNagri, first: '\uA800', last: '\uA82F'); - } - } - private static DefinedCharacterCodePointFilter _sylotiNagri; - - /// - /// A filter which allows characters in the 'Common Indic Number Forms' Unicode range. - /// - /// - /// This range spans the code points U+A830 .. U+A83F. - /// See http://www.unicode.org/charts/PDF/UA830.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CommonIndicNumberForms - { - get - { - return GetFilter(ref _commonIndicNumberForms, first: '\uA830', last: '\uA83F'); - } - } - private static DefinedCharacterCodePointFilter _commonIndicNumberForms; - - /// - /// A filter which allows characters in the 'Phags-pa' Unicode range. - /// - /// - /// This range spans the code points U+A840 .. U+A87F. - /// See http://www.unicode.org/charts/PDF/UA840.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Phagspa - { - get - { - return GetFilter(ref _phagspa, first: '\uA840', last: '\uA87F'); - } - } - private static DefinedCharacterCodePointFilter _phagspa; - - /// - /// A filter which allows characters in the 'Saurashtra' Unicode range. - /// - /// - /// This range spans the code points U+A880 .. U+A8DF. - /// See http://www.unicode.org/charts/PDF/UA880.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Saurashtra - { - get - { - return GetFilter(ref _saurashtra, first: '\uA880', last: '\uA8DF'); - } - } - private static DefinedCharacterCodePointFilter _saurashtra; - - /// - /// A filter which allows characters in the 'Devanagari Extended' Unicode range. - /// - /// - /// This range spans the code points U+A8E0 .. U+A8FF. - /// See http://www.unicode.org/charts/PDF/UA8E0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter DevanagariExtended - { - get - { - return GetFilter(ref _devanagariExtended, first: '\uA8E0', last: '\uA8FF'); - } - } - private static DefinedCharacterCodePointFilter _devanagariExtended; - - /// - /// A filter which allows characters in the 'Kayah Li' Unicode range. - /// - /// - /// This range spans the code points U+A900 .. U+A92F. - /// See http://www.unicode.org/charts/PDF/UA900.pdf for the full set of characters in this range. - /// - public static ICodePointFilter KayahLi - { - get - { - return GetFilter(ref _kayahLi, first: '\uA900', last: '\uA92F'); - } - } - private static DefinedCharacterCodePointFilter _kayahLi; - - /// - /// A filter which allows characters in the 'Rejang' Unicode range. - /// - /// - /// This range spans the code points U+A930 .. U+A95F. - /// See http://www.unicode.org/charts/PDF/UA930.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Rejang - { - get - { - return GetFilter(ref _rejang, first: '\uA930', last: '\uA95F'); - } - } - private static DefinedCharacterCodePointFilter _rejang; - - /// - /// A filter which allows characters in the 'Hangul Jamo Extended-A' Unicode range. - /// - /// - /// This range spans the code points U+A960 .. U+A97F. - /// See http://www.unicode.org/charts/PDF/UA960.pdf for the full set of characters in this range. - /// - public static ICodePointFilter HangulJamoExtendedA - { - get - { - return GetFilter(ref _hangulJamoExtendedA, first: '\uA960', last: '\uA97F'); - } - } - private static DefinedCharacterCodePointFilter _hangulJamoExtendedA; - - /// - /// A filter which allows characters in the 'Javanese' Unicode range. - /// - /// - /// This range spans the code points U+A980 .. U+A9DF. - /// See http://www.unicode.org/charts/PDF/UA980.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Javanese - { - get - { - return GetFilter(ref _javanese, first: '\uA980', last: '\uA9DF'); - } - } - private static DefinedCharacterCodePointFilter _javanese; - - /// - /// A filter which allows characters in the 'Myanmar Extended-B' Unicode range. - /// - /// - /// This range spans the code points U+A9E0 .. U+A9FF. - /// See http://www.unicode.org/charts/PDF/UA9E0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MyanmarExtendedB - { - get - { - return GetFilter(ref _myanmarExtendedB, first: '\uA9E0', last: '\uA9FF'); - } - } - private static DefinedCharacterCodePointFilter _myanmarExtendedB; - - /// - /// A filter which allows characters in the 'Cham' Unicode range. - /// - /// - /// This range spans the code points U+AA00 .. U+AA5F. - /// See http://www.unicode.org/charts/PDF/UAA00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Cham - { - get - { - return GetFilter(ref _cham, first: '\uAA00', last: '\uAA5F'); - } - } - private static DefinedCharacterCodePointFilter _cham; - - /// - /// A filter which allows characters in the 'Myanmar Extended-A' Unicode range. - /// - /// - /// This range spans the code points U+AA60 .. U+AA7F. - /// See http://www.unicode.org/charts/PDF/UAA60.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MyanmarExtendedA - { - get - { - return GetFilter(ref _myanmarExtendedA, first: '\uAA60', last: '\uAA7F'); - } - } - private static DefinedCharacterCodePointFilter _myanmarExtendedA; - - /// - /// A filter which allows characters in the 'Tai Viet' Unicode range. - /// - /// - /// This range spans the code points U+AA80 .. U+AADF. - /// See http://www.unicode.org/charts/PDF/UAA80.pdf for the full set of characters in this range. - /// - public static ICodePointFilter TaiViet - { - get - { - return GetFilter(ref _taiViet, first: '\uAA80', last: '\uAADF'); - } - } - private static DefinedCharacterCodePointFilter _taiViet; - - /// - /// A filter which allows characters in the 'Meetei Mayek Extensions' Unicode range. - /// - /// - /// This range spans the code points U+AAE0 .. U+AAFF. - /// See http://www.unicode.org/charts/PDF/UAAE0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MeeteiMayekExtensions - { - get - { - return GetFilter(ref _meeteiMayekExtensions, first: '\uAAE0', last: '\uAAFF'); - } - } - private static DefinedCharacterCodePointFilter _meeteiMayekExtensions; - - /// - /// A filter which allows characters in the 'Ethiopic Extended-A' Unicode range. - /// - /// - /// This range spans the code points U+AB00 .. U+AB2F. - /// See http://www.unicode.org/charts/PDF/UAB00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter EthiopicExtendedA - { - get - { - return GetFilter(ref _ethiopicExtendedA, first: '\uAB00', last: '\uAB2F'); - } - } - private static DefinedCharacterCodePointFilter _ethiopicExtendedA; - - /// - /// A filter which allows characters in the 'Latin Extended-E' Unicode range. - /// - /// - /// This range spans the code points U+AB30 .. U+AB6F. - /// See http://www.unicode.org/charts/PDF/UAB30.pdf for the full set of characters in this range. - /// - public static ICodePointFilter LatinExtendedE - { - get - { - return GetFilter(ref _latinExtendedE, first: '\uAB30', last: '\uAB6F'); - } - } - private static DefinedCharacterCodePointFilter _latinExtendedE; - - /// - /// A filter which allows characters in the 'Meetei Mayek' Unicode range. - /// - /// - /// This range spans the code points U+ABC0 .. U+ABFF. - /// See http://www.unicode.org/charts/PDF/UABC0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter MeeteiMayek - { - get - { - return GetFilter(ref _meeteiMayek, first: '\uABC0', last: '\uABFF'); - } - } - private static DefinedCharacterCodePointFilter _meeteiMayek; - - /// - /// A filter which allows characters in the 'Hangul Syllables' Unicode range. - /// - /// - /// This range spans the code points U+AC00 .. U+D7AF. - /// See http://www.unicode.org/charts/PDF/UAC00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter HangulSyllables - { - get - { - return GetFilter(ref _hangulSyllables, first: '\uAC00', last: '\uD7AF'); - } - } - private static DefinedCharacterCodePointFilter _hangulSyllables; - - /// - /// A filter which allows characters in the 'Hangul Jamo Extended-B' Unicode range. - /// - /// - /// This range spans the code points U+D7B0 .. U+D7FF. - /// See http://www.unicode.org/charts/PDF/UD7B0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter HangulJamoExtendedB - { - get - { - return GetFilter(ref _hangulJamoExtendedB, first: '\uD7B0', last: '\uD7FF'); - } - } - private static DefinedCharacterCodePointFilter _hangulJamoExtendedB; - - /// - /// A filter which allows characters in the 'CJK Compatibility Ideographs' Unicode range. - /// - /// - /// This range spans the code points U+F900 .. U+FAFF. - /// See http://www.unicode.org/charts/PDF/UF900.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKCompatibilityIdeographs - { - get - { - return GetFilter(ref _cjkCompatibilityIdeographs, first: '\uF900', last: '\uFAFF'); - } - } - private static DefinedCharacterCodePointFilter _cjkCompatibilityIdeographs; - - /// - /// A filter which allows characters in the 'Alphabetic Presentation Forms' Unicode range. - /// - /// - /// This range spans the code points U+FB00 .. U+FB4F. - /// See http://www.unicode.org/charts/PDF/UFB00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter AlphabeticPresentationForms - { - get - { - return GetFilter(ref _alphabeticPresentationForms, first: '\uFB00', last: '\uFB4F'); - } - } - private static DefinedCharacterCodePointFilter _alphabeticPresentationForms; - - /// - /// A filter which allows characters in the 'Arabic Presentation Forms-A' Unicode range. - /// - /// - /// This range spans the code points U+FB50 .. U+FDFF. - /// See http://www.unicode.org/charts/PDF/UFB50.pdf for the full set of characters in this range. - /// - public static ICodePointFilter ArabicPresentationFormsA - { - get - { - return GetFilter(ref _arabicPresentationFormsA, first: '\uFB50', last: '\uFDFF'); - } - } - private static DefinedCharacterCodePointFilter _arabicPresentationFormsA; - - /// - /// A filter which allows characters in the 'Variation Selectors' Unicode range. - /// - /// - /// This range spans the code points U+FE00 .. U+FE0F. - /// See http://www.unicode.org/charts/PDF/UFE00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter VariationSelectors - { - get - { - return GetFilter(ref _variationSelectors, first: '\uFE00', last: '\uFE0F'); - } - } - private static DefinedCharacterCodePointFilter _variationSelectors; - - /// - /// A filter which allows characters in the 'Vertical Forms' Unicode range. - /// - /// - /// This range spans the code points U+FE10 .. U+FE1F. - /// See http://www.unicode.org/charts/PDF/UFE10.pdf for the full set of characters in this range. - /// - public static ICodePointFilter VerticalForms - { - get - { - return GetFilter(ref _verticalForms, first: '\uFE10', last: '\uFE1F'); - } - } - private static DefinedCharacterCodePointFilter _verticalForms; - - /// - /// A filter which allows characters in the 'Combining Half Marks' Unicode range. - /// - /// - /// This range spans the code points U+FE20 .. U+FE2F. - /// See http://www.unicode.org/charts/PDF/UFE20.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CombiningHalfMarks - { - get - { - return GetFilter(ref _combiningHalfMarks, first: '\uFE20', last: '\uFE2F'); - } - } - private static DefinedCharacterCodePointFilter _combiningHalfMarks; - - /// - /// A filter which allows characters in the 'CJK Compatibility Forms' Unicode range. - /// - /// - /// This range spans the code points U+FE30 .. U+FE4F. - /// See http://www.unicode.org/charts/PDF/UFE30.pdf for the full set of characters in this range. - /// - public static ICodePointFilter CJKCompatibilityForms - { - get - { - return GetFilter(ref _cjkCompatibilityForms, first: '\uFE30', last: '\uFE4F'); - } - } - private static DefinedCharacterCodePointFilter _cjkCompatibilityForms; - - /// - /// A filter which allows characters in the 'Small Form Variants' Unicode range. - /// - /// - /// This range spans the code points U+FE50 .. U+FE6F. - /// See http://www.unicode.org/charts/PDF/UFE50.pdf for the full set of characters in this range. - /// - public static ICodePointFilter SmallFormVariants - { - get - { - return GetFilter(ref _smallFormVariants, first: '\uFE50', last: '\uFE6F'); - } - } - private static DefinedCharacterCodePointFilter _smallFormVariants; - - /// - /// A filter which allows characters in the 'Arabic Presentation Forms-B' Unicode range. - /// - /// - /// This range spans the code points U+FE70 .. U+FEFF. - /// See http://www.unicode.org/charts/PDF/UFE70.pdf for the full set of characters in this range. - /// - public static ICodePointFilter ArabicPresentationFormsB - { - get - { - return GetFilter(ref _arabicPresentationFormsB, first: '\uFE70', last: '\uFEFF'); - } - } - private static DefinedCharacterCodePointFilter _arabicPresentationFormsB; - - /// - /// A filter which allows characters in the 'Halfwidth and Fullwidth Forms' Unicode range. - /// - /// - /// This range spans the code points U+FF00 .. U+FFEF. - /// See http://www.unicode.org/charts/PDF/UFF00.pdf for the full set of characters in this range. - /// - public static ICodePointFilter HalfwidthandFullwidthForms - { - get - { - return GetFilter(ref _halfwidthandFullwidthForms, first: '\uFF00', last: '\uFFEF'); - } - } - private static DefinedCharacterCodePointFilter _halfwidthandFullwidthForms; - - /// - /// A filter which allows characters in the 'Specials' Unicode range. - /// - /// - /// This range spans the code points U+FFF0 .. U+FFFF. - /// See http://www.unicode.org/charts/PDF/UFFF0.pdf for the full set of characters in this range. - /// - public static ICodePointFilter Specials - { - get - { - return GetFilter(ref _specials, first: '\uFFF0', last: '\uFFFF'); - } - } - private static DefinedCharacterCodePointFilter _specials; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ICodePointFilter GetFilter(ref DefinedCharacterCodePointFilter filter, char first, char last) - { - // Return an existing filter if it has already been created, otherwise - // create a new filter on-demand. - return Volatile.Read(ref filter) ?? GetFilterSlow(ref filter, first, last); - } - - private static ICodePointFilter GetFilterSlow(ref DefinedCharacterCodePointFilter filter, char first, char last) - { - // If the filter hasn't been created, create it now. - // It's ok if two threads race and one overwrites the other's 'filter' value. - DefinedCharacterCodePointFilter newFilter = new DefinedCharacterCodePointFilter(first, last); - Volatile.Write(ref filter, newFilter); - return newFilter; - } - - /// - /// A code point filter which returns only defined characters within a certain - /// range of the Unicode specification. - /// - private sealed class DefinedCharacterCodePointFilter : ICodePointFilter - { - private readonly int _count; - private readonly int _first; - - public DefinedCharacterCodePointFilter(int first, int last) - { - Debug.Assert(0 <= first); - Debug.Assert(first <= last); - Debug.Assert(last <= 0xFFFF); - - _first = first; - _count = last - first + 1; - } - - public IEnumerable GetAllowedCodePoints() - { - for (int i = 0; i < _count; i++) - { - int thisCodePoint = _first + i; - if (UnicodeHelpers.IsCharacterDefined((char)thisCodePoint)) - { - yield return thisCodePoint; - } - } - } - } - - /// - /// A filter that allows no code points. - /// - private sealed class EmptyCodePointFilter : ICodePointFilter - { - private static readonly int[] _emptyArray = new int[0]; // immutable since empty - - public IEnumerable GetAllowedCodePoints() - { - return _emptyArray; - } - } - } -} diff --git a/src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs b/src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs index 6312387609..e8ed2cdcf1 100644 --- a/src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using Microsoft.Framework.Internal; namespace Microsoft.Framework.WebEncoders { @@ -19,8 +18,13 @@ namespace Microsoft.Framework.WebEncoders /// The encoded value is also safe for inclusion inside an HTML attribute /// as long as the attribute value is surrounded by single or double quotes. /// - public static void HtmlEncode([NotNull] this IHtmlEncoder htmlEncoder, string value, [NotNull] TextWriter output) + public static void HtmlEncode(this IHtmlEncoder htmlEncoder, string value, TextWriter output) { + if (htmlEncoder == null) + { + throw new ArgumentNullException(nameof(htmlEncoder)); + } + if (!String.IsNullOrEmpty(value)) { htmlEncoder.HtmlEncode(value, 0, value.Length, output); @@ -30,8 +34,13 @@ namespace Microsoft.Framework.WebEncoders /// /// JavaScript-escapes a string and writes the result to the supplied output. /// - public static void JavaScriptStringEncode([NotNull] this IJavaScriptStringEncoder javaScriptStringEncoder, string value, [NotNull] TextWriter output) + public static void JavaScriptStringEncode(this IJavaScriptStringEncoder javaScriptStringEncoder, string value, TextWriter output) { + if (javaScriptStringEncoder == null) + { + throw new ArgumentNullException(nameof(javaScriptStringEncoder)); + } + if (!String.IsNullOrEmpty(value)) { javaScriptStringEncoder.JavaScriptStringEncode(value, 0, value.Length, output); @@ -45,8 +54,13 @@ namespace Microsoft.Framework.WebEncoders /// The encoded value is safe for use in the segment, query, or /// fragment portion of a URI. /// - public static void UrlEncode([NotNull] this IUrlEncoder urlEncoder, string value, [NotNull] TextWriter output) + public static void UrlEncode(this IUrlEncoder urlEncoder, string value, TextWriter output) { + if (urlEncoder == null) + { + throw new ArgumentNullException(nameof(urlEncoder)); + } + if (!String.IsNullOrEmpty(value)) { urlEncoder.UrlEncode(value, 0, value.Length, output); diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs b/src/Microsoft.Framework.WebEncoders/EncoderOptions.cs similarity index 65% rename from src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs rename to src/Microsoft.Framework.WebEncoders/EncoderOptions.cs index 828455651a..e2547359cf 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderOptions.cs @@ -11,12 +11,11 @@ namespace Microsoft.Framework.WebEncoders public sealed class EncoderOptions { /// - /// Specifies code point tables which do not require escaping by the encoders. + /// Specifies which code points are allowed to be represented unescaped by the encoders. /// /// - /// If this property is set to a null array, then by default only the 'Basic Latin' - /// code point filter is active. + /// If this property is null, then the encoders will use their default allow lists. /// - public ICodePointFilter[] CodePointFilters { get; set; } + public ICodePointFilter CodePointFilter { get; set; } } } diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs b/src/Microsoft.Framework.WebEncoders/EncoderServiceCollectionExtensions.cs similarity index 96% rename from src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs rename to src/Microsoft.Framework.WebEncoders/EncoderServiceCollectionExtensions.cs index 7cd52e384f..9b8a84b98e 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderServiceCollectionExtensions.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http; -using Microsoft.Framework.WebEncoders; using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Internal; +using Microsoft.Framework.WebEncoders; namespace Microsoft.Framework.DependencyInjection { diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs b/src/Microsoft.Framework.WebEncoders/EncoderServiceProviderExtensions.cs similarity index 95% rename from src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs rename to src/Microsoft.Framework.WebEncoders/EncoderServiceProviderExtensions.cs index 6437376d08..a7982bdf7a 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderServiceProviderExtensions.cs @@ -2,15 +2,15 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Http; using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Internal; namespace Microsoft.Framework.WebEncoders { /// /// Contains extension methods for fetching encoders from a service provider. /// - public static class EncoderExtensions + public static class EncoderServiceProviderExtensions { /// /// Retrieves an IHtmlEncoder from a service provider. diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs b/src/Microsoft.Framework.WebEncoders/EncoderServices.cs similarity index 73% rename from src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs rename to src/Microsoft.Framework.WebEncoders/EncoderServices.cs index 8bac20cae8..0b9d6820d3 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderServices.cs @@ -22,17 +22,17 @@ namespace Microsoft.Framework.WebEncoders // Register the default encoders // We want to call the 'Default' property getters lazily since they perform static caching - yield return describe.Singleton(CreateFactory(() => HtmlEncoder.Default, filters => new HtmlEncoder(filters))); - yield return describe.Singleton(CreateFactory(() => JavaScriptStringEncoder.Default, filters => new JavaScriptStringEncoder(filters))); - yield return describe.Singleton(CreateFactory(() => UrlEncoder.Default, filters => new UrlEncoder(filters))); + yield return describe.Singleton(CreateFactory(() => HtmlEncoder.Default, filter => new HtmlEncoder(filter))); + yield return describe.Singleton(CreateFactory(() => JavaScriptStringEncoder.Default, filter => new JavaScriptStringEncoder(filter))); + yield return describe.Singleton(CreateFactory(() => UrlEncoder.Default, filter => new UrlEncoder(filter))); } - private static Func CreateFactory(Func parameterlessCtor, Func parameterfulCtor) + private static Func CreateFactory(Func defaultFactory, Func customFilterFactory) { return serviceProvider => { - var codePointFilters = serviceProvider?.GetService>()?.Options?.CodePointFilters; - return (codePointFilters != null) ? parameterfulCtor(codePointFilters) : parameterlessCtor(); + var codePointFilter = serviceProvider?.GetService>()?.Options?.CodePointFilter; + return (codePointFilter != null) ? customFilterFactory(codePointFilter) : defaultFactory(); }; } } diff --git a/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs b/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs index 7bcf12f1e3..20a504d38d 100644 --- a/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs @@ -13,6 +13,8 @@ namespace Microsoft.Framework.WebEncoders /// can be represented unencoded. /// /// + /// Instances of this type will always encode a certain set of characters (such as < + /// and >), even if the filter provided in the constructor allows such characters. /// Once constructed, instances of this class are thread-safe for multiple callers. /// public unsafe sealed class HtmlEncoder : IHtmlEncoder @@ -32,10 +34,19 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates an encoder using a custom allow list of characters. + /// Instantiates an encoder specifying which Unicode character blocks are allowed to + /// pass through the encoder unescaped. /// - public HtmlEncoder(params ICodePointFilter[] filters) - : this(new HtmlUnicodeEncoder(filters)) + public HtmlEncoder(params UnicodeBlock[] allowedBlocks) + : this(new HtmlUnicodeEncoder(new CodePointFilter(allowedBlocks))) + { + } + + /// + /// Instantiates an encoder using a custom code point filter. + /// + public HtmlEncoder(ICodePointFilter filter) + : this(new HtmlUnicodeEncoder(CodePointFilter.Wrap(filter))) { } @@ -97,8 +108,8 @@ namespace Microsoft.Framework.WebEncoders // generate at most 10 output chars ("􏿿"), which equates to 5 output chars per input char. private const int MaxOutputCharsPerInputChar = 8; - internal HtmlUnicodeEncoder(ICodePointFilter[] filters) - : base(filters, MaxOutputCharsPerInputChar) + internal HtmlUnicodeEncoder(CodePointFilter filter) + : base(filter, MaxOutputCharsPerInputChar) { } @@ -109,7 +120,7 @@ namespace Microsoft.Framework.WebEncoders HtmlUnicodeEncoder encoder = Volatile.Read(ref _basicLatinSingleton); if (encoder == null) { - encoder = new HtmlUnicodeEncoder(new[] { CodePointFilters.BasicLatin }); + encoder = new HtmlUnicodeEncoder(new CodePointFilter()); Volatile.Write(ref _basicLatinSingleton, encoder); } return encoder; diff --git a/src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs b/src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs index 0456285b23..4a24158263 100644 --- a/src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs @@ -1,5 +1,4 @@ -using System; -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs b/src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs index 487c1ca35c..99f011ff9a 100644 --- a/src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs @@ -16,6 +16,9 @@ namespace Microsoft.Framework.WebEncoders /// JavaScript-escapes a character array and writes the result to the /// supplied output. /// + /// + /// The encoded value is appropriately encoded for inclusion inside a quoted JSON string. + /// void JavaScriptStringEncode([NotNull] char[] value, int startIndex, int charCount, [NotNull] TextWriter output); /// @@ -23,6 +26,7 @@ namespace Microsoft.Framework.WebEncoders /// /// /// The JavaScript-escaped value, or null if the input string was null. + /// The encoded value is appropriately encoded for inclusion inside a quoted JSON string. /// string JavaScriptStringEncode(string value); @@ -30,6 +34,9 @@ namespace Microsoft.Framework.WebEncoders /// JavaScript-escapes a given input string and writes the /// result to the supplied output. /// + /// + /// The encoded value is appropriately encoded for inclusion inside a quoted JSON string. + /// void JavaScriptStringEncode([NotNull] string value, int startIndex, int charCount, [NotNull] TextWriter output); } } diff --git a/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs b/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs index 0d61898614..eb6ba16dae 100644 --- a/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs @@ -13,6 +13,8 @@ namespace Microsoft.Framework.WebEncoders /// can be represented unescaped. /// /// + /// Instances of this type will always encode a certain set of characters (such as ' + /// and "), even if the filter provided in the constructor allows such characters. /// Once constructed, instances of this class are thread-safe for multiple callers. /// public sealed class JavaScriptStringEncoder : IJavaScriptStringEncoder @@ -32,10 +34,19 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates an encoder using a custom allow list of characters. + /// Instantiates an encoder specifying which Unicode character blocks are allowed to + /// pass through the encoder unescaped. /// - public JavaScriptStringEncoder(params ICodePointFilter[] filters) - : this(new JavaScriptStringUnicodeEncoder(filters)) + public JavaScriptStringEncoder(params UnicodeBlock[] allowedBlocks) + : this(new JavaScriptStringUnicodeEncoder(new CodePointFilter(allowedBlocks))) + { + } + + /// + /// Instantiates an encoder using a custom code point filter. + /// + public JavaScriptStringEncoder(ICodePointFilter filter) + : this(new JavaScriptStringUnicodeEncoder(CodePointFilter.Wrap(filter))) { } @@ -97,8 +108,8 @@ namespace Microsoft.Framework.WebEncoders // surrogate pairs in the output. private const int MaxOutputCharsPerInputChar = 6; - internal JavaScriptStringUnicodeEncoder(ICodePointFilter[] filters) - : base(filters, MaxOutputCharsPerInputChar) + internal JavaScriptStringUnicodeEncoder(CodePointFilter filter) + : base(filter, MaxOutputCharsPerInputChar) { // The only interesting characters above and beyond what the base encoder // already covers are the solidus and reverse solidus. @@ -113,7 +124,7 @@ namespace Microsoft.Framework.WebEncoders JavaScriptStringUnicodeEncoder encoder = Volatile.Read(ref _basicLatinSingleton); if (encoder == null) { - encoder = new JavaScriptStringUnicodeEncoder(new[] { CodePointFilters.BasicLatin }); + encoder = new JavaScriptStringUnicodeEncoder(new CodePointFilter()); Volatile.Write(ref _basicLatinSingleton, encoder); } return encoder; diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs b/src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs new file mode 100644 index 0000000000..26f84d86a0 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.Framework.WebEncoders +{ + /// + /// Represents a range of Unicode code points. + /// + /// + /// Currently only the Basic Multilingual Plane is supported. + /// + public sealed class UnicodeBlock + { + /// + /// Creates a new representation of a Unicode block given the first code point + /// in the block and the number of code points in the block. + /// + public UnicodeBlock(int firstCodePoint, int blockSize) + { + // Parameter checking: the first code point must be U+nnn0, the block size must + // be a multiple of 16 bytes, and we can't span planes. + // See http://unicode.org/faq/blocks_ranges.html for more info. + if (firstCodePoint < 0 || firstCodePoint > 0xFFFF || ((firstCodePoint & 0xF) != 0)) + { + throw new ArgumentOutOfRangeException(nameof(firstCodePoint)); + } + if (blockSize < 0 || (blockSize % 16 != 0) || ((long)firstCodePoint + (long)blockSize > 0x10000)) + { + throw new ArgumentOutOfRangeException(nameof(blockSize)); + } + + FirstCodePoint = firstCodePoint; + BlockSize = blockSize; + } + + /// + /// The number of code points in this block. + /// + public int BlockSize { get; } + + /// + /// The first code point in this block. + /// + public int FirstCodePoint { get; } + + public static UnicodeBlock FromCharacterRange(char firstChar, char lastChar) + { + // Parameter checking: the first code point must be U+nnn0 and the last + // code point must be U+nnnF. We already can't span planes since 'char' + // allows only Basic Multilingual Plane characters. + // See http://unicode.org/faq/blocks_ranges.html for more info. + if ((firstChar & 0xF) != 0) + { + throw new ArgumentOutOfRangeException(nameof(firstChar)); + } + if (lastChar < firstChar || (lastChar & 0xF) != 0xF) + { + throw new ArgumentOutOfRangeException(nameof(lastChar)); + } + + return new UnicodeBlock(firstChar, 1 + (int)(lastChar - firstChar)); + } + } +} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs b/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs new file mode 100644 index 0000000000..2217e2db93 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Microsoft.Framework.WebEncoders +{ + /// + /// Contains predefined Unicode code point filters. + /// + public static partial class UnicodeBlocks + { + /// + /// Represents an empty Unicode block. + /// + /// + /// This block contains no code points. + /// + public static UnicodeBlock None + { + get + { + return Volatile.Read(ref _none) ?? CreateEmptyBlock(ref _none); + } + } + private static UnicodeBlock _none; + + /// + /// Represents a block containing all characters in the Unicode Basic Multilingual Plane (U+0000..U+FFFF). + /// + public static UnicodeBlock All + { + get + { + return Volatile.Read(ref _all) ?? CreateBlock(ref _all, '\u0000', '\uFFFF'); + } + } + private static UnicodeBlock _all; + + [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method + private static UnicodeBlock CreateBlock(ref UnicodeBlock block, char first, char last) + { + // If the block hasn't been created, create it now. + // It's ok if two threads race and one overwrites the other's 'block' value. + Debug.Assert(last > first, "Code points were specified out of order."); + var newBlock = UnicodeBlock.FromCharacterRange(first, last); + Volatile.Write(ref block, newBlock); + return newBlock; + } + + [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method + private static UnicodeBlock CreateEmptyBlock(ref UnicodeBlock block) + { + // If the block hasn't been created, create it now. + // It's ok if two threads race and one overwrites the other's 'block' value. + var newBlock = new UnicodeBlock(0, 0); + Volatile.Write(ref block, newBlock); + return newBlock; + } + } +} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs b/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs new file mode 100644 index 0000000000..d3404759c5 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs @@ -0,0 +1,2336 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Threading; + +namespace Microsoft.Framework.WebEncoders +{ + public static partial class UnicodeBlocks + { + /// + /// Represents the 'Basic Latin' Unicode block (U+0000..U+007F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0000.pdf for the full set of characters in this block. + /// + public static UnicodeBlock BasicLatin + { + get + { + return Volatile.Read(ref _basicLatin) ?? CreateBlock(ref _basicLatin, first: '\u0000', last: '\u007F'); + } + } + private static UnicodeBlock _basicLatin; + + /// + /// Represents the 'Latin-1 Supplement' Unicode block (U+0080..U+00FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0080.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Latin1Supplement + { + get + { + return Volatile.Read(ref _latin1Supplement) ?? CreateBlock(ref _latin1Supplement, first: '\u0080', last: '\u00FF'); + } + } + private static UnicodeBlock _latin1Supplement; + + /// + /// Represents the 'Latin Extended-A' Unicode block (U+0100..U+017F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0100.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LatinExtendedA + { + get + { + return Volatile.Read(ref _latinExtendedA) ?? CreateBlock(ref _latinExtendedA, first: '\u0100', last: '\u017F'); + } + } + private static UnicodeBlock _latinExtendedA; + + /// + /// Represents the 'Latin Extended-B' Unicode block (U+0180..U+024F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0180.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LatinExtendedB + { + get + { + return Volatile.Read(ref _latinExtendedB) ?? CreateBlock(ref _latinExtendedB, first: '\u0180', last: '\u024F'); + } + } + private static UnicodeBlock _latinExtendedB; + + /// + /// Represents the 'IPA Extensions' Unicode block (U+0250..U+02AF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0250.pdf for the full set of characters in this block. + /// + public static UnicodeBlock IPAExtensions + { + get + { + return Volatile.Read(ref _ipaExtensions) ?? CreateBlock(ref _ipaExtensions, first: '\u0250', last: '\u02AF'); + } + } + private static UnicodeBlock _ipaExtensions; + + /// + /// Represents the 'Spacing Modifier Letters' Unicode block (U+02B0..U+02FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U02B0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SpacingModifierLetters + { + get + { + return Volatile.Read(ref _spacingModifierLetters) ?? CreateBlock(ref _spacingModifierLetters, first: '\u02B0', last: '\u02FF'); + } + } + private static UnicodeBlock _spacingModifierLetters; + + /// + /// Represents the 'Combining Diacritical Marks' Unicode block (U+0300..U+036F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0300.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CombiningDiacriticalMarks + { + get + { + return Volatile.Read(ref _combiningDiacriticalMarks) ?? CreateBlock(ref _combiningDiacriticalMarks, first: '\u0300', last: '\u036F'); + } + } + private static UnicodeBlock _combiningDiacriticalMarks; + + /// + /// Represents the 'Greek and Coptic' Unicode block (U+0370..U+03FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0370.pdf for the full set of characters in this block. + /// + public static UnicodeBlock GreekandCoptic + { + get + { + return Volatile.Read(ref _greekandCoptic) ?? CreateBlock(ref _greekandCoptic, first: '\u0370', last: '\u03FF'); + } + } + private static UnicodeBlock _greekandCoptic; + + /// + /// Represents the 'Cyrillic' Unicode block (U+0400..U+04FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0400.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Cyrillic + { + get + { + return Volatile.Read(ref _cyrillic) ?? CreateBlock(ref _cyrillic, first: '\u0400', last: '\u04FF'); + } + } + private static UnicodeBlock _cyrillic; + + /// + /// Represents the 'Cyrillic Supplement' Unicode block (U+0500..U+052F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0500.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CyrillicSupplement + { + get + { + return Volatile.Read(ref _cyrillicSupplement) ?? CreateBlock(ref _cyrillicSupplement, first: '\u0500', last: '\u052F'); + } + } + private static UnicodeBlock _cyrillicSupplement; + + /// + /// Represents the 'Armenian' Unicode block (U+0530..U+058F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0530.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Armenian + { + get + { + return Volatile.Read(ref _armenian) ?? CreateBlock(ref _armenian, first: '\u0530', last: '\u058F'); + } + } + private static UnicodeBlock _armenian; + + /// + /// Represents the 'Hebrew' Unicode block (U+0590..U+05FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0590.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Hebrew + { + get + { + return Volatile.Read(ref _hebrew) ?? CreateBlock(ref _hebrew, first: '\u0590', last: '\u05FF'); + } + } + private static UnicodeBlock _hebrew; + + /// + /// Represents the 'Arabic' Unicode block (U+0600..U+06FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0600.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Arabic + { + get + { + return Volatile.Read(ref _arabic) ?? CreateBlock(ref _arabic, first: '\u0600', last: '\u06FF'); + } + } + private static UnicodeBlock _arabic; + + /// + /// Represents the 'Syriac' Unicode block (U+0700..U+074F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0700.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Syriac + { + get + { + return Volatile.Read(ref _syriac) ?? CreateBlock(ref _syriac, first: '\u0700', last: '\u074F'); + } + } + private static UnicodeBlock _syriac; + + /// + /// Represents the 'Arabic Supplement' Unicode block (U+0750..U+077F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0750.pdf for the full set of characters in this block. + /// + public static UnicodeBlock ArabicSupplement + { + get + { + return Volatile.Read(ref _arabicSupplement) ?? CreateBlock(ref _arabicSupplement, first: '\u0750', last: '\u077F'); + } + } + private static UnicodeBlock _arabicSupplement; + + /// + /// Represents the 'Thaana' Unicode block (U+0780..U+07BF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0780.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Thaana + { + get + { + return Volatile.Read(ref _thaana) ?? CreateBlock(ref _thaana, first: '\u0780', last: '\u07BF'); + } + } + private static UnicodeBlock _thaana; + + /// + /// Represents the 'NKo' Unicode block (U+07C0..U+07FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U07C0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock NKo + { + get + { + return Volatile.Read(ref _nKo) ?? CreateBlock(ref _nKo, first: '\u07C0', last: '\u07FF'); + } + } + private static UnicodeBlock _nKo; + + /// + /// Represents the 'Samaritan' Unicode block (U+0800..U+083F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0800.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Samaritan + { + get + { + return Volatile.Read(ref _samaritan) ?? CreateBlock(ref _samaritan, first: '\u0800', last: '\u083F'); + } + } + private static UnicodeBlock _samaritan; + + /// + /// Represents the 'Mandaic' Unicode block (U+0840..U+085F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0840.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Mandaic + { + get + { + return Volatile.Read(ref _mandaic) ?? CreateBlock(ref _mandaic, first: '\u0840', last: '\u085F'); + } + } + private static UnicodeBlock _mandaic; + + /// + /// Represents the 'Arabic Extended-A' Unicode block (U+08A0..U+08FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U08A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock ArabicExtendedA + { + get + { + return Volatile.Read(ref _arabicExtendedA) ?? CreateBlock(ref _arabicExtendedA, first: '\u08A0', last: '\u08FF'); + } + } + private static UnicodeBlock _arabicExtendedA; + + /// + /// Represents the 'Devanagari' Unicode block (U+0900..U+097F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0900.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Devanagari + { + get + { + return Volatile.Read(ref _devanagari) ?? CreateBlock(ref _devanagari, first: '\u0900', last: '\u097F'); + } + } + private static UnicodeBlock _devanagari; + + /// + /// Represents the 'Bengali' Unicode block (U+0980..U+09FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0980.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Bengali + { + get + { + return Volatile.Read(ref _bengali) ?? CreateBlock(ref _bengali, first: '\u0980', last: '\u09FF'); + } + } + private static UnicodeBlock _bengali; + + /// + /// Represents the 'Gurmukhi' Unicode block (U+0A00..U+0A7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0A00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Gurmukhi + { + get + { + return Volatile.Read(ref _gurmukhi) ?? CreateBlock(ref _gurmukhi, first: '\u0A00', last: '\u0A7F'); + } + } + private static UnicodeBlock _gurmukhi; + + /// + /// Represents the 'Gujarati' Unicode block (U+0A80..U+0AFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0A80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Gujarati + { + get + { + return Volatile.Read(ref _gujarati) ?? CreateBlock(ref _gujarati, first: '\u0A80', last: '\u0AFF'); + } + } + private static UnicodeBlock _gujarati; + + /// + /// Represents the 'Oriya' Unicode block (U+0B00..U+0B7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0B00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Oriya + { + get + { + return Volatile.Read(ref _oriya) ?? CreateBlock(ref _oriya, first: '\u0B00', last: '\u0B7F'); + } + } + private static UnicodeBlock _oriya; + + /// + /// Represents the 'Tamil' Unicode block (U+0B80..U+0BFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0B80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Tamil + { + get + { + return Volatile.Read(ref _tamil) ?? CreateBlock(ref _tamil, first: '\u0B80', last: '\u0BFF'); + } + } + private static UnicodeBlock _tamil; + + /// + /// Represents the 'Telugu' Unicode block (U+0C00..U+0C7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0C00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Telugu + { + get + { + return Volatile.Read(ref _telugu) ?? CreateBlock(ref _telugu, first: '\u0C00', last: '\u0C7F'); + } + } + private static UnicodeBlock _telugu; + + /// + /// Represents the 'Kannada' Unicode block (U+0C80..U+0CFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0C80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Kannada + { + get + { + return Volatile.Read(ref _kannada) ?? CreateBlock(ref _kannada, first: '\u0C80', last: '\u0CFF'); + } + } + private static UnicodeBlock _kannada; + + /// + /// Represents the 'Malayalam' Unicode block (U+0D00..U+0D7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0D00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Malayalam + { + get + { + return Volatile.Read(ref _malayalam) ?? CreateBlock(ref _malayalam, first: '\u0D00', last: '\u0D7F'); + } + } + private static UnicodeBlock _malayalam; + + /// + /// Represents the 'Sinhala' Unicode block (U+0D80..U+0DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0D80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Sinhala + { + get + { + return Volatile.Read(ref _sinhala) ?? CreateBlock(ref _sinhala, first: '\u0D80', last: '\u0DFF'); + } + } + private static UnicodeBlock _sinhala; + + /// + /// Represents the 'Thai' Unicode block (U+0E00..U+0E7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0E00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Thai + { + get + { + return Volatile.Read(ref _thai) ?? CreateBlock(ref _thai, first: '\u0E00', last: '\u0E7F'); + } + } + private static UnicodeBlock _thai; + + /// + /// Represents the 'Lao' Unicode block (U+0E80..U+0EFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0E80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Lao + { + get + { + return Volatile.Read(ref _lao) ?? CreateBlock(ref _lao, first: '\u0E80', last: '\u0EFF'); + } + } + private static UnicodeBlock _lao; + + /// + /// Represents the 'Tibetan' Unicode block (U+0F00..U+0FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0F00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Tibetan + { + get + { + return Volatile.Read(ref _tibetan) ?? CreateBlock(ref _tibetan, first: '\u0F00', last: '\u0FFF'); + } + } + private static UnicodeBlock _tibetan; + + /// + /// Represents the 'Myanmar' Unicode block (U+1000..U+109F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1000.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Myanmar + { + get + { + return Volatile.Read(ref _myanmar) ?? CreateBlock(ref _myanmar, first: '\u1000', last: '\u109F'); + } + } + private static UnicodeBlock _myanmar; + + /// + /// Represents the 'Georgian' Unicode block (U+10A0..U+10FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U10A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Georgian + { + get + { + return Volatile.Read(ref _georgian) ?? CreateBlock(ref _georgian, first: '\u10A0', last: '\u10FF'); + } + } + private static UnicodeBlock _georgian; + + /// + /// Represents the 'Hangul Jamo' Unicode block (U+1100..U+11FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1100.pdf for the full set of characters in this block. + /// + public static UnicodeBlock HangulJamo + { + get + { + return Volatile.Read(ref _hangulJamo) ?? CreateBlock(ref _hangulJamo, first: '\u1100', last: '\u11FF'); + } + } + private static UnicodeBlock _hangulJamo; + + /// + /// Represents the 'Ethiopic' Unicode block (U+1200..U+137F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1200.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Ethiopic + { + get + { + return Volatile.Read(ref _ethiopic) ?? CreateBlock(ref _ethiopic, first: '\u1200', last: '\u137F'); + } + } + private static UnicodeBlock _ethiopic; + + /// + /// Represents the 'Ethiopic Supplement' Unicode block (U+1380..U+139F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1380.pdf for the full set of characters in this block. + /// + public static UnicodeBlock EthiopicSupplement + { + get + { + return Volatile.Read(ref _ethiopicSupplement) ?? CreateBlock(ref _ethiopicSupplement, first: '\u1380', last: '\u139F'); + } + } + private static UnicodeBlock _ethiopicSupplement; + + /// + /// Represents the 'Cherokee' Unicode block (U+13A0..U+13FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U13A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Cherokee + { + get + { + return Volatile.Read(ref _cherokee) ?? CreateBlock(ref _cherokee, first: '\u13A0', last: '\u13FF'); + } + } + private static UnicodeBlock _cherokee; + + /// + /// Represents the 'Unified Canadian Aboriginal Syllabics' Unicode block (U+1400..U+167F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1400.pdf for the full set of characters in this block. + /// + public static UnicodeBlock UnifiedCanadianAboriginalSyllabics + { + get + { + return Volatile.Read(ref _unifiedCanadianAboriginalSyllabics) ?? CreateBlock(ref _unifiedCanadianAboriginalSyllabics, first: '\u1400', last: '\u167F'); + } + } + private static UnicodeBlock _unifiedCanadianAboriginalSyllabics; + + /// + /// Represents the 'Ogham' Unicode block (U+1680..U+169F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1680.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Ogham + { + get + { + return Volatile.Read(ref _ogham) ?? CreateBlock(ref _ogham, first: '\u1680', last: '\u169F'); + } + } + private static UnicodeBlock _ogham; + + /// + /// Represents the 'Runic' Unicode block (U+16A0..U+16FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U16A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Runic + { + get + { + return Volatile.Read(ref _runic) ?? CreateBlock(ref _runic, first: '\u16A0', last: '\u16FF'); + } + } + private static UnicodeBlock _runic; + + /// + /// Represents the 'Tagalog' Unicode block (U+1700..U+171F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1700.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Tagalog + { + get + { + return Volatile.Read(ref _tagalog) ?? CreateBlock(ref _tagalog, first: '\u1700', last: '\u171F'); + } + } + private static UnicodeBlock _tagalog; + + /// + /// Represents the 'Hanunoo' Unicode block (U+1720..U+173F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1720.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Hanunoo + { + get + { + return Volatile.Read(ref _hanunoo) ?? CreateBlock(ref _hanunoo, first: '\u1720', last: '\u173F'); + } + } + private static UnicodeBlock _hanunoo; + + /// + /// Represents the 'Buhid' Unicode block (U+1740..U+175F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1740.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Buhid + { + get + { + return Volatile.Read(ref _buhid) ?? CreateBlock(ref _buhid, first: '\u1740', last: '\u175F'); + } + } + private static UnicodeBlock _buhid; + + /// + /// Represents the 'Tagbanwa' Unicode block (U+1760..U+177F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1760.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Tagbanwa + { + get + { + return Volatile.Read(ref _tagbanwa) ?? CreateBlock(ref _tagbanwa, first: '\u1760', last: '\u177F'); + } + } + private static UnicodeBlock _tagbanwa; + + /// + /// Represents the 'Khmer' Unicode block (U+1780..U+17FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1780.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Khmer + { + get + { + return Volatile.Read(ref _khmer) ?? CreateBlock(ref _khmer, first: '\u1780', last: '\u17FF'); + } + } + private static UnicodeBlock _khmer; + + /// + /// Represents the 'Mongolian' Unicode block (U+1800..U+18AF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1800.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Mongolian + { + get + { + return Volatile.Read(ref _mongolian) ?? CreateBlock(ref _mongolian, first: '\u1800', last: '\u18AF'); + } + } + private static UnicodeBlock _mongolian; + + /// + /// Represents the 'Unified Canadian Aboriginal Syllabics Extended' Unicode block (U+18B0..U+18FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U18B0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock UnifiedCanadianAboriginalSyllabicsExtended + { + get + { + return Volatile.Read(ref _unifiedCanadianAboriginalSyllabicsExtended) ?? CreateBlock(ref _unifiedCanadianAboriginalSyllabicsExtended, first: '\u18B0', last: '\u18FF'); + } + } + private static UnicodeBlock _unifiedCanadianAboriginalSyllabicsExtended; + + /// + /// Represents the 'Limbu' Unicode block (U+1900..U+194F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1900.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Limbu + { + get + { + return Volatile.Read(ref _limbu) ?? CreateBlock(ref _limbu, first: '\u1900', last: '\u194F'); + } + } + private static UnicodeBlock _limbu; + + /// + /// Represents the 'Tai Le' Unicode block (U+1950..U+197F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1950.pdf for the full set of characters in this block. + /// + public static UnicodeBlock TaiLe + { + get + { + return Volatile.Read(ref _taiLe) ?? CreateBlock(ref _taiLe, first: '\u1950', last: '\u197F'); + } + } + private static UnicodeBlock _taiLe; + + /// + /// Represents the 'New Tai Lue' Unicode block (U+1980..U+19DF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1980.pdf for the full set of characters in this block. + /// + public static UnicodeBlock NewTaiLue + { + get + { + return Volatile.Read(ref _newTaiLue) ?? CreateBlock(ref _newTaiLue, first: '\u1980', last: '\u19DF'); + } + } + private static UnicodeBlock _newTaiLue; + + /// + /// Represents the 'Khmer Symbols' Unicode block (U+19E0..U+19FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U19E0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock KhmerSymbols + { + get + { + return Volatile.Read(ref _khmerSymbols) ?? CreateBlock(ref _khmerSymbols, first: '\u19E0', last: '\u19FF'); + } + } + private static UnicodeBlock _khmerSymbols; + + /// + /// Represents the 'Buginese' Unicode block (U+1A00..U+1A1F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1A00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Buginese + { + get + { + return Volatile.Read(ref _buginese) ?? CreateBlock(ref _buginese, first: '\u1A00', last: '\u1A1F'); + } + } + private static UnicodeBlock _buginese; + + /// + /// Represents the 'Tai Tham' Unicode block (U+1A20..U+1AAF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1A20.pdf for the full set of characters in this block. + /// + public static UnicodeBlock TaiTham + { + get + { + return Volatile.Read(ref _taiTham) ?? CreateBlock(ref _taiTham, first: '\u1A20', last: '\u1AAF'); + } + } + private static UnicodeBlock _taiTham; + + /// + /// Represents the 'Combining Diacritical Marks Extended' Unicode block (U+1AB0..U+1AFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1AB0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CombiningDiacriticalMarksExtended + { + get + { + return Volatile.Read(ref _combiningDiacriticalMarksExtended) ?? CreateBlock(ref _combiningDiacriticalMarksExtended, first: '\u1AB0', last: '\u1AFF'); + } + } + private static UnicodeBlock _combiningDiacriticalMarksExtended; + + /// + /// Represents the 'Balinese' Unicode block (U+1B00..U+1B7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1B00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Balinese + { + get + { + return Volatile.Read(ref _balinese) ?? CreateBlock(ref _balinese, first: '\u1B00', last: '\u1B7F'); + } + } + private static UnicodeBlock _balinese; + + /// + /// Represents the 'Sundanese' Unicode block (U+1B80..U+1BBF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1B80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Sundanese + { + get + { + return Volatile.Read(ref _sundanese) ?? CreateBlock(ref _sundanese, first: '\u1B80', last: '\u1BBF'); + } + } + private static UnicodeBlock _sundanese; + + /// + /// Represents the 'Batak' Unicode block (U+1BC0..U+1BFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1BC0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Batak + { + get + { + return Volatile.Read(ref _batak) ?? CreateBlock(ref _batak, first: '\u1BC0', last: '\u1BFF'); + } + } + private static UnicodeBlock _batak; + + /// + /// Represents the 'Lepcha' Unicode block (U+1C00..U+1C4F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1C00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Lepcha + { + get + { + return Volatile.Read(ref _lepcha) ?? CreateBlock(ref _lepcha, first: '\u1C00', last: '\u1C4F'); + } + } + private static UnicodeBlock _lepcha; + + /// + /// Represents the 'Ol Chiki' Unicode block (U+1C50..U+1C7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1C50.pdf for the full set of characters in this block. + /// + public static UnicodeBlock OlChiki + { + get + { + return Volatile.Read(ref _olChiki) ?? CreateBlock(ref _olChiki, first: '\u1C50', last: '\u1C7F'); + } + } + private static UnicodeBlock _olChiki; + + /// + /// Represents the 'Sundanese Supplement' Unicode block (U+1CC0..U+1CCF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1CC0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SundaneseSupplement + { + get + { + return Volatile.Read(ref _sundaneseSupplement) ?? CreateBlock(ref _sundaneseSupplement, first: '\u1CC0', last: '\u1CCF'); + } + } + private static UnicodeBlock _sundaneseSupplement; + + /// + /// Represents the 'Vedic Extensions' Unicode block (U+1CD0..U+1CFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1CD0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock VedicExtensions + { + get + { + return Volatile.Read(ref _vedicExtensions) ?? CreateBlock(ref _vedicExtensions, first: '\u1CD0', last: '\u1CFF'); + } + } + private static UnicodeBlock _vedicExtensions; + + /// + /// Represents the 'Phonetic Extensions' Unicode block (U+1D00..U+1D7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1D00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock PhoneticExtensions + { + get + { + return Volatile.Read(ref _phoneticExtensions) ?? CreateBlock(ref _phoneticExtensions, first: '\u1D00', last: '\u1D7F'); + } + } + private static UnicodeBlock _phoneticExtensions; + + /// + /// Represents the 'Phonetic Extensions Supplement' Unicode block (U+1D80..U+1DBF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1D80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock PhoneticExtensionsSupplement + { + get + { + return Volatile.Read(ref _phoneticExtensionsSupplement) ?? CreateBlock(ref _phoneticExtensionsSupplement, first: '\u1D80', last: '\u1DBF'); + } + } + private static UnicodeBlock _phoneticExtensionsSupplement; + + /// + /// Represents the 'Combining Diacritical Marks Supplement' Unicode block (U+1DC0..U+1DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1DC0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CombiningDiacriticalMarksSupplement + { + get + { + return Volatile.Read(ref _combiningDiacriticalMarksSupplement) ?? CreateBlock(ref _combiningDiacriticalMarksSupplement, first: '\u1DC0', last: '\u1DFF'); + } + } + private static UnicodeBlock _combiningDiacriticalMarksSupplement; + + /// + /// Represents the 'Latin Extended Additional' Unicode block (U+1E00..U+1EFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1E00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LatinExtendedAdditional + { + get + { + return Volatile.Read(ref _latinExtendedAdditional) ?? CreateBlock(ref _latinExtendedAdditional, first: '\u1E00', last: '\u1EFF'); + } + } + private static UnicodeBlock _latinExtendedAdditional; + + /// + /// Represents the 'Greek Extended' Unicode block (U+1F00..U+1FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1F00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock GreekExtended + { + get + { + return Volatile.Read(ref _greekExtended) ?? CreateBlock(ref _greekExtended, first: '\u1F00', last: '\u1FFF'); + } + } + private static UnicodeBlock _greekExtended; + + /// + /// Represents the 'General Punctuation' Unicode block (U+2000..U+206F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2000.pdf for the full set of characters in this block. + /// + public static UnicodeBlock GeneralPunctuation + { + get + { + return Volatile.Read(ref _generalPunctuation) ?? CreateBlock(ref _generalPunctuation, first: '\u2000', last: '\u206F'); + } + } + private static UnicodeBlock _generalPunctuation; + + /// + /// Represents the 'Superscripts and Subscripts' Unicode block (U+2070..U+209F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2070.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SuperscriptsandSubscripts + { + get + { + return Volatile.Read(ref _superscriptsandSubscripts) ?? CreateBlock(ref _superscriptsandSubscripts, first: '\u2070', last: '\u209F'); + } + } + private static UnicodeBlock _superscriptsandSubscripts; + + /// + /// Represents the 'Currency Symbols' Unicode block (U+20A0..U+20CF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U20A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CurrencySymbols + { + get + { + return Volatile.Read(ref _currencySymbols) ?? CreateBlock(ref _currencySymbols, first: '\u20A0', last: '\u20CF'); + } + } + private static UnicodeBlock _currencySymbols; + + /// + /// Represents the 'Combining Diacritical Marks for Symbols' Unicode block (U+20D0..U+20FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U20D0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CombiningDiacriticalMarksforSymbols + { + get + { + return Volatile.Read(ref _combiningDiacriticalMarksforSymbols) ?? CreateBlock(ref _combiningDiacriticalMarksforSymbols, first: '\u20D0', last: '\u20FF'); + } + } + private static UnicodeBlock _combiningDiacriticalMarksforSymbols; + + /// + /// Represents the 'Letterlike Symbols' Unicode block (U+2100..U+214F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2100.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LetterlikeSymbols + { + get + { + return Volatile.Read(ref _letterlikeSymbols) ?? CreateBlock(ref _letterlikeSymbols, first: '\u2100', last: '\u214F'); + } + } + private static UnicodeBlock _letterlikeSymbols; + + /// + /// Represents the 'Number Forms' Unicode block (U+2150..U+218F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2150.pdf for the full set of characters in this block. + /// + public static UnicodeBlock NumberForms + { + get + { + return Volatile.Read(ref _numberForms) ?? CreateBlock(ref _numberForms, first: '\u2150', last: '\u218F'); + } + } + private static UnicodeBlock _numberForms; + + /// + /// Represents the 'Arrows' Unicode block (U+2190..U+21FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2190.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Arrows + { + get + { + return Volatile.Read(ref _arrows) ?? CreateBlock(ref _arrows, first: '\u2190', last: '\u21FF'); + } + } + private static UnicodeBlock _arrows; + + /// + /// Represents the 'Mathematical Operators' Unicode block (U+2200..U+22FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2200.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MathematicalOperators + { + get + { + return Volatile.Read(ref _mathematicalOperators) ?? CreateBlock(ref _mathematicalOperators, first: '\u2200', last: '\u22FF'); + } + } + private static UnicodeBlock _mathematicalOperators; + + /// + /// Represents the 'Miscellaneous Technical' Unicode block (U+2300..U+23FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2300.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MiscellaneousTechnical + { + get + { + return Volatile.Read(ref _miscellaneousTechnical) ?? CreateBlock(ref _miscellaneousTechnical, first: '\u2300', last: '\u23FF'); + } + } + private static UnicodeBlock _miscellaneousTechnical; + + /// + /// Represents the 'Control Pictures' Unicode block (U+2400..U+243F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2400.pdf for the full set of characters in this block. + /// + public static UnicodeBlock ControlPictures + { + get + { + return Volatile.Read(ref _controlPictures) ?? CreateBlock(ref _controlPictures, first: '\u2400', last: '\u243F'); + } + } + private static UnicodeBlock _controlPictures; + + /// + /// Represents the 'Optical Character Recognition' Unicode block (U+2440..U+245F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2440.pdf for the full set of characters in this block. + /// + public static UnicodeBlock OpticalCharacterRecognition + { + get + { + return Volatile.Read(ref _opticalCharacterRecognition) ?? CreateBlock(ref _opticalCharacterRecognition, first: '\u2440', last: '\u245F'); + } + } + private static UnicodeBlock _opticalCharacterRecognition; + + /// + /// Represents the 'Enclosed Alphanumerics' Unicode block (U+2460..U+24FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2460.pdf for the full set of characters in this block. + /// + public static UnicodeBlock EnclosedAlphanumerics + { + get + { + return Volatile.Read(ref _enclosedAlphanumerics) ?? CreateBlock(ref _enclosedAlphanumerics, first: '\u2460', last: '\u24FF'); + } + } + private static UnicodeBlock _enclosedAlphanumerics; + + /// + /// Represents the 'Box Drawing' Unicode block (U+2500..U+257F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2500.pdf for the full set of characters in this block. + /// + public static UnicodeBlock BoxDrawing + { + get + { + return Volatile.Read(ref _boxDrawing) ?? CreateBlock(ref _boxDrawing, first: '\u2500', last: '\u257F'); + } + } + private static UnicodeBlock _boxDrawing; + + /// + /// Represents the 'Block Elements' Unicode block (U+2580..U+259F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2580.pdf for the full set of characters in this block. + /// + public static UnicodeBlock BlockElements + { + get + { + return Volatile.Read(ref _blockElements) ?? CreateBlock(ref _blockElements, first: '\u2580', last: '\u259F'); + } + } + private static UnicodeBlock _blockElements; + + /// + /// Represents the 'Geometric Shapes' Unicode block (U+25A0..U+25FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U25A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock GeometricShapes + { + get + { + return Volatile.Read(ref _geometricShapes) ?? CreateBlock(ref _geometricShapes, first: '\u25A0', last: '\u25FF'); + } + } + private static UnicodeBlock _geometricShapes; + + /// + /// Represents the 'Miscellaneous Symbols' Unicode block (U+2600..U+26FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2600.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MiscellaneousSymbols + { + get + { + return Volatile.Read(ref _miscellaneousSymbols) ?? CreateBlock(ref _miscellaneousSymbols, first: '\u2600', last: '\u26FF'); + } + } + private static UnicodeBlock _miscellaneousSymbols; + + /// + /// Represents the 'Dingbats' Unicode block (U+2700..U+27BF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2700.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Dingbats + { + get + { + return Volatile.Read(ref _dingbats) ?? CreateBlock(ref _dingbats, first: '\u2700', last: '\u27BF'); + } + } + private static UnicodeBlock _dingbats; + + /// + /// Represents the 'Miscellaneous Mathematical Symbols-A' Unicode block (U+27C0..U+27EF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U27C0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MiscellaneousMathematicalSymbolsA + { + get + { + return Volatile.Read(ref _miscellaneousMathematicalSymbolsA) ?? CreateBlock(ref _miscellaneousMathematicalSymbolsA, first: '\u27C0', last: '\u27EF'); + } + } + private static UnicodeBlock _miscellaneousMathematicalSymbolsA; + + /// + /// Represents the 'Supplemental Arrows-A' Unicode block (U+27F0..U+27FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U27F0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SupplementalArrowsA + { + get + { + return Volatile.Read(ref _supplementalArrowsA) ?? CreateBlock(ref _supplementalArrowsA, first: '\u27F0', last: '\u27FF'); + } + } + private static UnicodeBlock _supplementalArrowsA; + + /// + /// Represents the 'Braille Patterns' Unicode block (U+2800..U+28FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2800.pdf for the full set of characters in this block. + /// + public static UnicodeBlock BraillePatterns + { + get + { + return Volatile.Read(ref _braillePatterns) ?? CreateBlock(ref _braillePatterns, first: '\u2800', last: '\u28FF'); + } + } + private static UnicodeBlock _braillePatterns; + + /// + /// Represents the 'Supplemental Arrows-B' Unicode block (U+2900..U+297F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2900.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SupplementalArrowsB + { + get + { + return Volatile.Read(ref _supplementalArrowsB) ?? CreateBlock(ref _supplementalArrowsB, first: '\u2900', last: '\u297F'); + } + } + private static UnicodeBlock _supplementalArrowsB; + + /// + /// Represents the 'Miscellaneous Mathematical Symbols-B' Unicode block (U+2980..U+29FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2980.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MiscellaneousMathematicalSymbolsB + { + get + { + return Volatile.Read(ref _miscellaneousMathematicalSymbolsB) ?? CreateBlock(ref _miscellaneousMathematicalSymbolsB, first: '\u2980', last: '\u29FF'); + } + } + private static UnicodeBlock _miscellaneousMathematicalSymbolsB; + + /// + /// Represents the 'Supplemental Mathematical Operators' Unicode block (U+2A00..U+2AFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2A00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SupplementalMathematicalOperators + { + get + { + return Volatile.Read(ref _supplementalMathematicalOperators) ?? CreateBlock(ref _supplementalMathematicalOperators, first: '\u2A00', last: '\u2AFF'); + } + } + private static UnicodeBlock _supplementalMathematicalOperators; + + /// + /// Represents the 'Miscellaneous Symbols and Arrows' Unicode block (U+2B00..U+2BFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2B00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MiscellaneousSymbolsandArrows + { + get + { + return Volatile.Read(ref _miscellaneousSymbolsandArrows) ?? CreateBlock(ref _miscellaneousSymbolsandArrows, first: '\u2B00', last: '\u2BFF'); + } + } + private static UnicodeBlock _miscellaneousSymbolsandArrows; + + /// + /// Represents the 'Glagolitic' Unicode block (U+2C00..U+2C5F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2C00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Glagolitic + { + get + { + return Volatile.Read(ref _glagolitic) ?? CreateBlock(ref _glagolitic, first: '\u2C00', last: '\u2C5F'); + } + } + private static UnicodeBlock _glagolitic; + + /// + /// Represents the 'Latin Extended-C' Unicode block (U+2C60..U+2C7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2C60.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LatinExtendedC + { + get + { + return Volatile.Read(ref _latinExtendedC) ?? CreateBlock(ref _latinExtendedC, first: '\u2C60', last: '\u2C7F'); + } + } + private static UnicodeBlock _latinExtendedC; + + /// + /// Represents the 'Coptic' Unicode block (U+2C80..U+2CFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2C80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Coptic + { + get + { + return Volatile.Read(ref _coptic) ?? CreateBlock(ref _coptic, first: '\u2C80', last: '\u2CFF'); + } + } + private static UnicodeBlock _coptic; + + /// + /// Represents the 'Georgian Supplement' Unicode block (U+2D00..U+2D2F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2D00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock GeorgianSupplement + { + get + { + return Volatile.Read(ref _georgianSupplement) ?? CreateBlock(ref _georgianSupplement, first: '\u2D00', last: '\u2D2F'); + } + } + private static UnicodeBlock _georgianSupplement; + + /// + /// Represents the 'Tifinagh' Unicode block (U+2D30..U+2D7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2D30.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Tifinagh + { + get + { + return Volatile.Read(ref _tifinagh) ?? CreateBlock(ref _tifinagh, first: '\u2D30', last: '\u2D7F'); + } + } + private static UnicodeBlock _tifinagh; + + /// + /// Represents the 'Ethiopic Extended' Unicode block (U+2D80..U+2DDF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2D80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock EthiopicExtended + { + get + { + return Volatile.Read(ref _ethiopicExtended) ?? CreateBlock(ref _ethiopicExtended, first: '\u2D80', last: '\u2DDF'); + } + } + private static UnicodeBlock _ethiopicExtended; + + /// + /// Represents the 'Cyrillic Extended-A' Unicode block (U+2DE0..U+2DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2DE0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CyrillicExtendedA + { + get + { + return Volatile.Read(ref _cyrillicExtendedA) ?? CreateBlock(ref _cyrillicExtendedA, first: '\u2DE0', last: '\u2DFF'); + } + } + private static UnicodeBlock _cyrillicExtendedA; + + /// + /// Represents the 'Supplemental Punctuation' Unicode block (U+2E00..U+2E7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2E00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SupplementalPunctuation + { + get + { + return Volatile.Read(ref _supplementalPunctuation) ?? CreateBlock(ref _supplementalPunctuation, first: '\u2E00', last: '\u2E7F'); + } + } + private static UnicodeBlock _supplementalPunctuation; + + /// + /// Represents the 'CJK Radicals Supplement' Unicode block (U+2E80..U+2EFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2E80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKRadicalsSupplement + { + get + { + return Volatile.Read(ref _cjkRadicalsSupplement) ?? CreateBlock(ref _cjkRadicalsSupplement, first: '\u2E80', last: '\u2EFF'); + } + } + private static UnicodeBlock _cjkRadicalsSupplement; + + /// + /// Represents the 'Kangxi Radicals' Unicode block (U+2F00..U+2FDF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2F00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock KangxiRadicals + { + get + { + return Volatile.Read(ref _kangxiRadicals) ?? CreateBlock(ref _kangxiRadicals, first: '\u2F00', last: '\u2FDF'); + } + } + private static UnicodeBlock _kangxiRadicals; + + /// + /// Represents the 'Ideographic Description Characters' Unicode block (U+2FF0..U+2FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2FF0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock IdeographicDescriptionCharacters + { + get + { + return Volatile.Read(ref _ideographicDescriptionCharacters) ?? CreateBlock(ref _ideographicDescriptionCharacters, first: '\u2FF0', last: '\u2FFF'); + } + } + private static UnicodeBlock _ideographicDescriptionCharacters; + + /// + /// Represents the 'CJK Symbols and Punctuation' Unicode block (U+3000..U+303F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3000.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKSymbolsandPunctuation + { + get + { + return Volatile.Read(ref _cjkSymbolsandPunctuation) ?? CreateBlock(ref _cjkSymbolsandPunctuation, first: '\u3000', last: '\u303F'); + } + } + private static UnicodeBlock _cjkSymbolsandPunctuation; + + /// + /// Represents the 'Hiragana' Unicode block (U+3040..U+309F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3040.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Hiragana + { + get + { + return Volatile.Read(ref _hiragana) ?? CreateBlock(ref _hiragana, first: '\u3040', last: '\u309F'); + } + } + private static UnicodeBlock _hiragana; + + /// + /// Represents the 'Katakana' Unicode block (U+30A0..U+30FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U30A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Katakana + { + get + { + return Volatile.Read(ref _katakana) ?? CreateBlock(ref _katakana, first: '\u30A0', last: '\u30FF'); + } + } + private static UnicodeBlock _katakana; + + /// + /// Represents the 'Bopomofo' Unicode block (U+3100..U+312F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3100.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Bopomofo + { + get + { + return Volatile.Read(ref _bopomofo) ?? CreateBlock(ref _bopomofo, first: '\u3100', last: '\u312F'); + } + } + private static UnicodeBlock _bopomofo; + + /// + /// Represents the 'Hangul Compatibility Jamo' Unicode block (U+3130..U+318F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3130.pdf for the full set of characters in this block. + /// + public static UnicodeBlock HangulCompatibilityJamo + { + get + { + return Volatile.Read(ref _hangulCompatibilityJamo) ?? CreateBlock(ref _hangulCompatibilityJamo, first: '\u3130', last: '\u318F'); + } + } + private static UnicodeBlock _hangulCompatibilityJamo; + + /// + /// Represents the 'Kanbun' Unicode block (U+3190..U+319F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3190.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Kanbun + { + get + { + return Volatile.Read(ref _kanbun) ?? CreateBlock(ref _kanbun, first: '\u3190', last: '\u319F'); + } + } + private static UnicodeBlock _kanbun; + + /// + /// Represents the 'Bopomofo Extended' Unicode block (U+31A0..U+31BF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U31A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock BopomofoExtended + { + get + { + return Volatile.Read(ref _bopomofoExtended) ?? CreateBlock(ref _bopomofoExtended, first: '\u31A0', last: '\u31BF'); + } + } + private static UnicodeBlock _bopomofoExtended; + + /// + /// Represents the 'CJK Strokes' Unicode block (U+31C0..U+31EF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U31C0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKStrokes + { + get + { + return Volatile.Read(ref _cjkStrokes) ?? CreateBlock(ref _cjkStrokes, first: '\u31C0', last: '\u31EF'); + } + } + private static UnicodeBlock _cjkStrokes; + + /// + /// Represents the 'Katakana Phonetic Extensions' Unicode block (U+31F0..U+31FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U31F0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock KatakanaPhoneticExtensions + { + get + { + return Volatile.Read(ref _katakanaPhoneticExtensions) ?? CreateBlock(ref _katakanaPhoneticExtensions, first: '\u31F0', last: '\u31FF'); + } + } + private static UnicodeBlock _katakanaPhoneticExtensions; + + /// + /// Represents the 'Enclosed CJK Letters and Months' Unicode block (U+3200..U+32FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3200.pdf for the full set of characters in this block. + /// + public static UnicodeBlock EnclosedCJKLettersandMonths + { + get + { + return Volatile.Read(ref _enclosedCJKLettersandMonths) ?? CreateBlock(ref _enclosedCJKLettersandMonths, first: '\u3200', last: '\u32FF'); + } + } + private static UnicodeBlock _enclosedCJKLettersandMonths; + + /// + /// Represents the 'CJK Compatibility' Unicode block (U+3300..U+33FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3300.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKCompatibility + { + get + { + return Volatile.Read(ref _cjkCompatibility) ?? CreateBlock(ref _cjkCompatibility, first: '\u3300', last: '\u33FF'); + } + } + private static UnicodeBlock _cjkCompatibility; + + /// + /// Represents the 'CJK Unified Ideographs Extension A' Unicode block (U+3400..U+4DBF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3400.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKUnifiedIdeographsExtensionA + { + get + { + return Volatile.Read(ref _cjkUnifiedIdeographsExtensionA) ?? CreateBlock(ref _cjkUnifiedIdeographsExtensionA, first: '\u3400', last: '\u4DBF'); + } + } + private static UnicodeBlock _cjkUnifiedIdeographsExtensionA; + + /// + /// Represents the 'Yijing Hexagram Symbols' Unicode block (U+4DC0..U+4DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U4DC0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock YijingHexagramSymbols + { + get + { + return Volatile.Read(ref _yijingHexagramSymbols) ?? CreateBlock(ref _yijingHexagramSymbols, first: '\u4DC0', last: '\u4DFF'); + } + } + private static UnicodeBlock _yijingHexagramSymbols; + + /// + /// Represents the 'CJK Unified Ideographs' Unicode block (U+4E00..U+9FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U4E00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKUnifiedIdeographs + { + get + { + return Volatile.Read(ref _cjkUnifiedIdeographs) ?? CreateBlock(ref _cjkUnifiedIdeographs, first: '\u4E00', last: '\u9FFF'); + } + } + private static UnicodeBlock _cjkUnifiedIdeographs; + + /// + /// Represents the 'Yi Syllables' Unicode block (U+A000..U+A48F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA000.pdf for the full set of characters in this block. + /// + public static UnicodeBlock YiSyllables + { + get + { + return Volatile.Read(ref _yiSyllables) ?? CreateBlock(ref _yiSyllables, first: '\uA000', last: '\uA48F'); + } + } + private static UnicodeBlock _yiSyllables; + + /// + /// Represents the 'Yi Radicals' Unicode block (U+A490..U+A4CF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA490.pdf for the full set of characters in this block. + /// + public static UnicodeBlock YiRadicals + { + get + { + return Volatile.Read(ref _yiRadicals) ?? CreateBlock(ref _yiRadicals, first: '\uA490', last: '\uA4CF'); + } + } + private static UnicodeBlock _yiRadicals; + + /// + /// Represents the 'Lisu' Unicode block (U+A4D0..U+A4FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA4D0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Lisu + { + get + { + return Volatile.Read(ref _lisu) ?? CreateBlock(ref _lisu, first: '\uA4D0', last: '\uA4FF'); + } + } + private static UnicodeBlock _lisu; + + /// + /// Represents the 'Vai' Unicode block (U+A500..U+A63F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA500.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Vai + { + get + { + return Volatile.Read(ref _vai) ?? CreateBlock(ref _vai, first: '\uA500', last: '\uA63F'); + } + } + private static UnicodeBlock _vai; + + /// + /// Represents the 'Cyrillic Extended-B' Unicode block (U+A640..U+A69F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA640.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CyrillicExtendedB + { + get + { + return Volatile.Read(ref _cyrillicExtendedB) ?? CreateBlock(ref _cyrillicExtendedB, first: '\uA640', last: '\uA69F'); + } + } + private static UnicodeBlock _cyrillicExtendedB; + + /// + /// Represents the 'Bamum' Unicode block (U+A6A0..U+A6FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA6A0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Bamum + { + get + { + return Volatile.Read(ref _bamum) ?? CreateBlock(ref _bamum, first: '\uA6A0', last: '\uA6FF'); + } + } + private static UnicodeBlock _bamum; + + /// + /// Represents the 'Modifier Tone Letters' Unicode block (U+A700..U+A71F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA700.pdf for the full set of characters in this block. + /// + public static UnicodeBlock ModifierToneLetters + { + get + { + return Volatile.Read(ref _modifierToneLetters) ?? CreateBlock(ref _modifierToneLetters, first: '\uA700', last: '\uA71F'); + } + } + private static UnicodeBlock _modifierToneLetters; + + /// + /// Represents the 'Latin Extended-D' Unicode block (U+A720..U+A7FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA720.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LatinExtendedD + { + get + { + return Volatile.Read(ref _latinExtendedD) ?? CreateBlock(ref _latinExtendedD, first: '\uA720', last: '\uA7FF'); + } + } + private static UnicodeBlock _latinExtendedD; + + /// + /// Represents the 'Syloti Nagri' Unicode block (U+A800..U+A82F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA800.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SylotiNagri + { + get + { + return Volatile.Read(ref _sylotiNagri) ?? CreateBlock(ref _sylotiNagri, first: '\uA800', last: '\uA82F'); + } + } + private static UnicodeBlock _sylotiNagri; + + /// + /// Represents the 'Common Indic Number Forms' Unicode block (U+A830..U+A83F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA830.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CommonIndicNumberForms + { + get + { + return Volatile.Read(ref _commonIndicNumberForms) ?? CreateBlock(ref _commonIndicNumberForms, first: '\uA830', last: '\uA83F'); + } + } + private static UnicodeBlock _commonIndicNumberForms; + + /// + /// Represents the 'Phags-pa' Unicode block (U+A840..U+A87F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA840.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Phagspa + { + get + { + return Volatile.Read(ref _phagspa) ?? CreateBlock(ref _phagspa, first: '\uA840', last: '\uA87F'); + } + } + private static UnicodeBlock _phagspa; + + /// + /// Represents the 'Saurashtra' Unicode block (U+A880..U+A8DF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA880.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Saurashtra + { + get + { + return Volatile.Read(ref _saurashtra) ?? CreateBlock(ref _saurashtra, first: '\uA880', last: '\uA8DF'); + } + } + private static UnicodeBlock _saurashtra; + + /// + /// Represents the 'Devanagari Extended' Unicode block (U+A8E0..U+A8FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA8E0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock DevanagariExtended + { + get + { + return Volatile.Read(ref _devanagariExtended) ?? CreateBlock(ref _devanagariExtended, first: '\uA8E0', last: '\uA8FF'); + } + } + private static UnicodeBlock _devanagariExtended; + + /// + /// Represents the 'Kayah Li' Unicode block (U+A900..U+A92F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA900.pdf for the full set of characters in this block. + /// + public static UnicodeBlock KayahLi + { + get + { + return Volatile.Read(ref _kayahLi) ?? CreateBlock(ref _kayahLi, first: '\uA900', last: '\uA92F'); + } + } + private static UnicodeBlock _kayahLi; + + /// + /// Represents the 'Rejang' Unicode block (U+A930..U+A95F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA930.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Rejang + { + get + { + return Volatile.Read(ref _rejang) ?? CreateBlock(ref _rejang, first: '\uA930', last: '\uA95F'); + } + } + private static UnicodeBlock _rejang; + + /// + /// Represents the 'Hangul Jamo Extended-A' Unicode block (U+A960..U+A97F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA960.pdf for the full set of characters in this block. + /// + public static UnicodeBlock HangulJamoExtendedA + { + get + { + return Volatile.Read(ref _hangulJamoExtendedA) ?? CreateBlock(ref _hangulJamoExtendedA, first: '\uA960', last: '\uA97F'); + } + } + private static UnicodeBlock _hangulJamoExtendedA; + + /// + /// Represents the 'Javanese' Unicode block (U+A980..U+A9DF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA980.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Javanese + { + get + { + return Volatile.Read(ref _javanese) ?? CreateBlock(ref _javanese, first: '\uA980', last: '\uA9DF'); + } + } + private static UnicodeBlock _javanese; + + /// + /// Represents the 'Myanmar Extended-B' Unicode block (U+A9E0..U+A9FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA9E0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MyanmarExtendedB + { + get + { + return Volatile.Read(ref _myanmarExtendedB) ?? CreateBlock(ref _myanmarExtendedB, first: '\uA9E0', last: '\uA9FF'); + } + } + private static UnicodeBlock _myanmarExtendedB; + + /// + /// Represents the 'Cham' Unicode block (U+AA00..U+AA5F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAA00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Cham + { + get + { + return Volatile.Read(ref _cham) ?? CreateBlock(ref _cham, first: '\uAA00', last: '\uAA5F'); + } + } + private static UnicodeBlock _cham; + + /// + /// Represents the 'Myanmar Extended-A' Unicode block (U+AA60..U+AA7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAA60.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MyanmarExtendedA + { + get + { + return Volatile.Read(ref _myanmarExtendedA) ?? CreateBlock(ref _myanmarExtendedA, first: '\uAA60', last: '\uAA7F'); + } + } + private static UnicodeBlock _myanmarExtendedA; + + /// + /// Represents the 'Tai Viet' Unicode block (U+AA80..U+AADF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAA80.pdf for the full set of characters in this block. + /// + public static UnicodeBlock TaiViet + { + get + { + return Volatile.Read(ref _taiViet) ?? CreateBlock(ref _taiViet, first: '\uAA80', last: '\uAADF'); + } + } + private static UnicodeBlock _taiViet; + + /// + /// Represents the 'Meetei Mayek Extensions' Unicode block (U+AAE0..U+AAFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAAE0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MeeteiMayekExtensions + { + get + { + return Volatile.Read(ref _meeteiMayekExtensions) ?? CreateBlock(ref _meeteiMayekExtensions, first: '\uAAE0', last: '\uAAFF'); + } + } + private static UnicodeBlock _meeteiMayekExtensions; + + /// + /// Represents the 'Ethiopic Extended-A' Unicode block (U+AB00..U+AB2F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAB00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock EthiopicExtendedA + { + get + { + return Volatile.Read(ref _ethiopicExtendedA) ?? CreateBlock(ref _ethiopicExtendedA, first: '\uAB00', last: '\uAB2F'); + } + } + private static UnicodeBlock _ethiopicExtendedA; + + /// + /// Represents the 'Latin Extended-E' Unicode block (U+AB30..U+AB6F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAB30.pdf for the full set of characters in this block. + /// + public static UnicodeBlock LatinExtendedE + { + get + { + return Volatile.Read(ref _latinExtendedE) ?? CreateBlock(ref _latinExtendedE, first: '\uAB30', last: '\uAB6F'); + } + } + private static UnicodeBlock _latinExtendedE; + + /// + /// Represents the 'Meetei Mayek' Unicode block (U+ABC0..U+ABFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UABC0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock MeeteiMayek + { + get + { + return Volatile.Read(ref _meeteiMayek) ?? CreateBlock(ref _meeteiMayek, first: '\uABC0', last: '\uABFF'); + } + } + private static UnicodeBlock _meeteiMayek; + + /// + /// Represents the 'Hangul Syllables' Unicode block (U+AC00..U+D7AF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAC00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock HangulSyllables + { + get + { + return Volatile.Read(ref _hangulSyllables) ?? CreateBlock(ref _hangulSyllables, first: '\uAC00', last: '\uD7AF'); + } + } + private static UnicodeBlock _hangulSyllables; + + /// + /// Represents the 'Hangul Jamo Extended-B' Unicode block (U+D7B0..U+D7FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UD7B0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock HangulJamoExtendedB + { + get + { + return Volatile.Read(ref _hangulJamoExtendedB) ?? CreateBlock(ref _hangulJamoExtendedB, first: '\uD7B0', last: '\uD7FF'); + } + } + private static UnicodeBlock _hangulJamoExtendedB; + + /// + /// Represents the 'CJK Compatibility Ideographs' Unicode block (U+F900..U+FAFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UF900.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKCompatibilityIdeographs + { + get + { + return Volatile.Read(ref _cjkCompatibilityIdeographs) ?? CreateBlock(ref _cjkCompatibilityIdeographs, first: '\uF900', last: '\uFAFF'); + } + } + private static UnicodeBlock _cjkCompatibilityIdeographs; + + /// + /// Represents the 'Alphabetic Presentation Forms' Unicode block (U+FB00..U+FB4F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFB00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock AlphabeticPresentationForms + { + get + { + return Volatile.Read(ref _alphabeticPresentationForms) ?? CreateBlock(ref _alphabeticPresentationForms, first: '\uFB00', last: '\uFB4F'); + } + } + private static UnicodeBlock _alphabeticPresentationForms; + + /// + /// Represents the 'Arabic Presentation Forms-A' Unicode block (U+FB50..U+FDFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFB50.pdf for the full set of characters in this block. + /// + public static UnicodeBlock ArabicPresentationFormsA + { + get + { + return Volatile.Read(ref _arabicPresentationFormsA) ?? CreateBlock(ref _arabicPresentationFormsA, first: '\uFB50', last: '\uFDFF'); + } + } + private static UnicodeBlock _arabicPresentationFormsA; + + /// + /// Represents the 'Variation Selectors' Unicode block (U+FE00..U+FE0F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock VariationSelectors + { + get + { + return Volatile.Read(ref _variationSelectors) ?? CreateBlock(ref _variationSelectors, first: '\uFE00', last: '\uFE0F'); + } + } + private static UnicodeBlock _variationSelectors; + + /// + /// Represents the 'Vertical Forms' Unicode block (U+FE10..U+FE1F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE10.pdf for the full set of characters in this block. + /// + public static UnicodeBlock VerticalForms + { + get + { + return Volatile.Read(ref _verticalForms) ?? CreateBlock(ref _verticalForms, first: '\uFE10', last: '\uFE1F'); + } + } + private static UnicodeBlock _verticalForms; + + /// + /// Represents the 'Combining Half Marks' Unicode block (U+FE20..U+FE2F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE20.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CombiningHalfMarks + { + get + { + return Volatile.Read(ref _combiningHalfMarks) ?? CreateBlock(ref _combiningHalfMarks, first: '\uFE20', last: '\uFE2F'); + } + } + private static UnicodeBlock _combiningHalfMarks; + + /// + /// Represents the 'CJK Compatibility Forms' Unicode block (U+FE30..U+FE4F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE30.pdf for the full set of characters in this block. + /// + public static UnicodeBlock CJKCompatibilityForms + { + get + { + return Volatile.Read(ref _cjkCompatibilityForms) ?? CreateBlock(ref _cjkCompatibilityForms, first: '\uFE30', last: '\uFE4F'); + } + } + private static UnicodeBlock _cjkCompatibilityForms; + + /// + /// Represents the 'Small Form Variants' Unicode block (U+FE50..U+FE6F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE50.pdf for the full set of characters in this block. + /// + public static UnicodeBlock SmallFormVariants + { + get + { + return Volatile.Read(ref _smallFormVariants) ?? CreateBlock(ref _smallFormVariants, first: '\uFE50', last: '\uFE6F'); + } + } + private static UnicodeBlock _smallFormVariants; + + /// + /// Represents the 'Arabic Presentation Forms-B' Unicode block (U+FE70..U+FEFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE70.pdf for the full set of characters in this block. + /// + public static UnicodeBlock ArabicPresentationFormsB + { + get + { + return Volatile.Read(ref _arabicPresentationFormsB) ?? CreateBlock(ref _arabicPresentationFormsB, first: '\uFE70', last: '\uFEFF'); + } + } + private static UnicodeBlock _arabicPresentationFormsB; + + /// + /// Represents the 'Halfwidth and Fullwidth Forms' Unicode block (U+FF00..U+FFEF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFF00.pdf for the full set of characters in this block. + /// + public static UnicodeBlock HalfwidthandFullwidthForms + { + get + { + return Volatile.Read(ref _halfwidthandFullwidthForms) ?? CreateBlock(ref _halfwidthandFullwidthForms, first: '\uFF00', last: '\uFFEF'); + } + } + private static UnicodeBlock _halfwidthandFullwidthForms; + + /// + /// Represents the 'Specials' Unicode block (U+FFF0..U+FFFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFFF0.pdf for the full set of characters in this block. + /// + public static UnicodeBlock Specials + { + get + { + return Volatile.Read(ref _specials) ?? CreateBlock(ref _specials, first: '\uFFF0', last: '\uFFFF'); + } + } + private static UnicodeBlock _specials; + } +} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs b/src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs index 45ba58e02b..6a382b8a4d 100644 --- a/src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs +++ b/src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs @@ -6,14 +6,13 @@ using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Text; -using Microsoft.Framework.Internal; namespace Microsoft.Framework.WebEncoders { internal unsafe abstract class UnicodeEncoderBase { // A bitmap of characters which are allowed to be returned unescaped. - private readonly uint[] _allowedCharsBitmap = new uint[0x10000 / 32]; + private AllowedCharsBitmap _allowedCharsBitmap; // The worst-case number of output chars generated for any input char. private readonly int _maxOutputCharsPerInputChar; @@ -21,25 +20,10 @@ namespace Microsoft.Framework.WebEncoders /// /// Instantiates an encoder using a custom allow list of characters. /// - protected UnicodeEncoderBase(ICodePointFilter[] filters, int maxOutputCharsPerInputChar) + protected UnicodeEncoderBase(CodePointFilter filter, int maxOutputCharsPerInputChar) { _maxOutputCharsPerInputChar = maxOutputCharsPerInputChar; - - if (filters != null) - { - // Punch a hole for each allowed code point across all filters (this is an OR). - // We don't allow supplementary (astral) characters for now. - foreach (var filter in filters) - { - foreach (var codePoint in filter.GetAllowedCodePoints()) - { - if (!UnicodeHelpers.IsSupplementaryCodePoint(codePoint)) - { - AllowCharacter((char)codePoint); - } - } - } - } + _allowedCharsBitmap = filter.GetAllowedCharsBitmap(); // Forbid characters that are special in HTML. // Even though this is a common encoder used by everybody (including URL @@ -55,38 +39,29 @@ namespace Microsoft.Framework.WebEncoders // Forbid codepoints which aren't mapped to characters or which are otherwise always disallowed // (includes categories Cc, Cs, Co, Cn, Zs [except U+0020 SPACE], Zl, Zp) - uint[] definedCharactersBitmap = UnicodeHelpers.GetDefinedCharacterBitmap(); - Debug.Assert(definedCharactersBitmap.Length == _allowedCharsBitmap.Length); - for (int i = 0; i < _allowedCharsBitmap.Length; i++) - { - _allowedCharsBitmap[i] &= definedCharactersBitmap[i]; - } - } - - // Marks a character as allowed (can be returned unencoded) - private void AllowCharacter(char c) - { - uint codePoint = (uint)c; - int index = (int)(codePoint >> 5); - int offset = (int)(codePoint & 0x1FU); - _allowedCharsBitmap[index] |= 0x1U << offset; + _allowedCharsBitmap.ForbidUndefinedCharacters(); } // Marks a character as forbidden (must be returned encoded) protected void ForbidCharacter(char c) { - uint codePoint = (uint)c; - int index = (int)(codePoint >> 5); - int offset = (int)(codePoint & 0x1FU); - _allowedCharsBitmap[index] &= ~(0x1U << offset); + _allowedCharsBitmap.ForbidCharacter(c); } - + /// /// Entry point to the encoder. /// - public void Encode([NotNull] char[] value, int startIndex, int charCount, [NotNull] TextWriter output) + public void Encode(char[] value, int startIndex, int charCount, TextWriter output) { // Input checking + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + if (output == null) + { + throw new ArgumentNullException(nameof(output)); + } ValidateInputs(startIndex, charCount, actualInputLength: value.Length); if (charCount != 0) @@ -137,9 +112,17 @@ namespace Microsoft.Framework.WebEncoders /// /// Entry point to the encoder. /// - public void Encode([NotNull] string value, int startIndex, int charCount, [NotNull] TextWriter output) + public void Encode(string value, int startIndex, int charCount, TextWriter output) { // Input checking + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + if (output == null) + { + throw new ArgumentNullException(nameof(output)); + } ValidateInputs(startIndex, charCount, actualInputLength: value.Length); if (charCount != 0) @@ -249,10 +232,7 @@ namespace Microsoft.Framework.WebEncoders [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool IsCharacterAllowed(char c) { - uint codePoint = (uint)c; - int index = (int)(codePoint >> 5); - int offset = (int)(codePoint & 0x1FU); - return ((_allowedCharsBitmap[index] >> offset) & 0x1U) != 0; + return _allowedCharsBitmap.IsCharacterAllowed(c); } private static void ValidateInputs(int startIndex, int charCount, int actualInputLength) diff --git a/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs b/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs index 8df2b5bce5..d3c66a26b3 100644 --- a/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs @@ -13,6 +13,8 @@ namespace Microsoft.Framework.WebEncoders /// can be represented unescaped. /// /// + /// Instances of this type will always encode a certain set of characters (such as + + /// and ?), even if the filter provided in the constructor allows such characters. /// Once constructed, instances of this class are thread-safe for multiple callers. /// public sealed class UrlEncoder : IUrlEncoder @@ -32,10 +34,19 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates an encoder using a custom allow list of characters. + /// Instantiates an encoder specifying which Unicode character blocks are allowed to + /// pass through the encoder unescaped. /// - public UrlEncoder(params ICodePointFilter[] filters) - : this(new UrlUnicodeEncoder(filters)) + public UrlEncoder(params UnicodeBlock[] allowedBlocks) + : this(new UrlUnicodeEncoder(new CodePointFilter(allowedBlocks))) + { + } + + /// + /// Instantiates an encoder using a custom code point filter. + /// + public UrlEncoder(ICodePointFilter filter) + : this(new UrlUnicodeEncoder(CodePointFilter.Wrap(filter))) { } @@ -98,8 +109,8 @@ namespace Microsoft.Framework.WebEncoders // chars to produce 12 output chars "%XX%YY%ZZ%WW", which is 6 output chars per input char. private const int MaxOutputCharsPerInputChar = 9; - internal UrlUnicodeEncoder(ICodePointFilter[] filters) - : base(filters, MaxOutputCharsPerInputChar) + internal UrlUnicodeEncoder(CodePointFilter filter) + : base(filter, MaxOutputCharsPerInputChar) { // Per RFC 3987, Sec. 2.2, we want encodings that are safe for // 'isegment', 'iquery', and 'ifragment'. The only thing these @@ -152,7 +163,7 @@ namespace Microsoft.Framework.WebEncoders UrlUnicodeEncoder encoder = Volatile.Read(ref _basicLatinSingleton); if (encoder == null) { - encoder = new UrlUnicodeEncoder(new[] { CodePointFilters.BasicLatin }); + encoder = new UrlUnicodeEncoder(new CodePointFilter()); Volatile.Write(ref _basicLatinSingleton, encoder); } return encoder; diff --git a/src/Microsoft.Framework.WebEncoders/project.json b/src/Microsoft.Framework.WebEncoders/project.json index e61fe47605..15a2417f33 100644 --- a/src/Microsoft.Framework.WebEncoders/project.json +++ b/src/Microsoft.Framework.WebEncoders/project.json @@ -5,6 +5,9 @@ "allowUnsafe": true }, "dependencies": { + "Microsoft.Framework.ConfigurationModel": "1.0.0-*", + "Microsoft.Framework.DependencyInjection": "1.0.0-*", + "Microsoft.Framework.OptionsModel": "1.0.0-*", "Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" } }, "frameworks": {