Ejemplo n.º 1
0
        /// <summary>
        /// Allows all characters specified by <paramref name="range"/> through the filter.
        /// </summary>
        public virtual void AllowRange(UnicodeRange range)
        {
            if (range is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.range);
            }

            int firstCodePoint = range.FirstCodePoint;
            int rangeSize      = range.Length;

            for (int i = 0; i < rangeSize; i++)
            {
                int codePoint = firstCodePoint + i;
                UnicodeDebug.AssertIsBmpCodePoint((uint)codePoint); // UnicodeRange only supports BMP
                _allowedCodePointsBitmap.AllowChar((char)codePoint);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Disallows all characters specified by <paramref name="range"/> through the filter.
        /// </summary>
        public virtual void ForbidRange(UnicodeRange range)
        {
            if (range == null)
            {
                throw new ArgumentNullException(nameof(range));
            }

            int firstCodePoint = range.FirstCodePoint;
            int rangeSize      = range.Length;

            for (int i = 0; i < rangeSize; i++)
            {
                int codePoint = firstCodePoint + i;
                UnicodeDebug.AssertIsBmpCodePoint((uint)codePoint); // UnicodeRange only supports BMP
                _allowedCodePointsBitmap.ForbidChar((char)codePoint);
            }
        }
Ejemplo n.º 3
0
 private static void _GetIndexAndOffset(uint value, out nuint index, out int offset)
 {
     UnicodeDebug.AssertIsBmpCodePoint(value);
     index  = value >> 5;
     offset = (int)value & 0x1F;
 }