Beispiel #1
0
        public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index)
        {
            if (index >= buffer.Length)
            {
                return(Constants.End);
            }

            uint x = buffer[index++];

            if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000)
            {
                var code = (x & 0b0011_1111_1111) + 0b0100_0000;
                if (index >= buffer.Length)
                {
                    return(Constants.End);
                }
                x = buffer[index++];
                if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000)
                {
                    return(Constants.End);
                }
                code = (code << 10) | (x & 0b0011_1111_1111);

                return(new CodePoint(code), 2);
            }
Beispiel #2
0
 public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index)
 {
     if (index >= buffer.Length)
     {
         return(Constants.End);
     }
     return(new CodePoint(buffer[index]), 1);
 }
Beispiel #3
0
 public static byte TyrGetCount(ArrayAccessor buffer, int index)
 {
     if (index >= buffer.Length)
     {
         return(Constants.InvalidCount);
     }
     return(1);
 }
Beispiel #4
0
 public static byte TyrGetCount(ArrayAccessor buffer, int index)
 {
     if (index >= buffer.Length) return Constants.InvalidCount;
     uint x = buffer[index];
     var count = (x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000 ? (byte)2 : (byte)1;
     if (index + count > buffer.Length) return Constants.InvalidCount;
     return count;
 }
Beispiel #5
0
        internal static ArrayAccessor FromPointer(SWIGTYPE_p_p_int t, int length, int count)
        {
            global::System.IntPtr cPtr = fannfixedPINVOKE.IntArrayAccessor_FromPointer(SWIGTYPE_p_p_int.getCPtr(t));
            ArrayAccessor         ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ArrayAccessor(cPtr, false);

            ret.ArrayLength = length;
            ret.ArrayCount  = count;
            return(ret);
        }
Beispiel #6
0
 public static int GetLength(ArrayAccessor buffer)
 {
     var count = 0;
     for (int i = 0; i < buffer.Length; i++)
     {
         var x = buffer[i];
         if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000)
             count++;
     }
     return count;
 }
Beispiel #7
0
 public static byte TyrGetCount(ArrayAccessor buffer, int index)
 {
     if (index >= buffer.Length) return Constants.InvalidCount;
     uint x = buffer[index];
     if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000)
     {
         if (index + 1 >= buffer.Length) return Constants.InvalidCount;
         return 2;
     }
     else
         return 1;
 }
Beispiel #8
0
        public static int GetLength(ArrayAccessor buffer)
        {
            var count = 0;

            for (int i = 0; i < buffer.Length; i++)
            {
                var x = buffer[i];
                if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000)
                {
                    count++;
                }
            }
            return(count);
        }
Beispiel #9
0
        public BindingMemberInfo(string path, Type type)
            : this(path, BindingMemberType.Array, type.GetElementType())
        {
            var indexes = BindingReflectionExtensions
                          .GetIndexerValues(path, null, typeof(int))
                          .ToArrayEx(o => (int)o);
            var arrayAccessor = new ArrayAccessor(indexes);

            _getValueAccessorSingle       = arrayAccessor.GetValue;
            _setValueAccessorSingleAction = arrayAccessor.SetValue;
            _canRead           = true;
            _canWrite          = true;
            _isSingleParameter = true;
        }
Beispiel #10
0
        public static byte TyrGetCount(ArrayAccessor buffer, int index)
        {
            if (index >= buffer.Length)
            {
                return(Constants.InvalidCount);
            }
            uint x     = buffer[index];
            var  count = (x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000 ? (byte)2 : (byte)1;

            if (index + count > buffer.Length)
            {
                return(Constants.InvalidCount);
            }
            return(count);
        }
Beispiel #11
0
        public static CodePoint Decode(ArrayAccessor buffer, Index index)
        {
            var i = index.index;
            uint x = buffer[i];

            if (index.count == 2)
            {
                var code = (x & 0b0011_1111_1111) + 0b0100_0000;
                code = (code << 10) | ((uint)buffer[i + 1] & 0b0011_1111_1111);
                return new CodePoint(code);
            }
            else
            {
                return new CodePoint(x);
            }
        }
Beispiel #12
0
        public static byte TyrGetCount(ArrayAccessor buffer, int index)
        {
            if (index >= buffer.Length)
            {
                return(Constants.InvalidCount);
            }
            uint x = buffer[index];

            if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000)
            {
                if (index + 1 >= buffer.Length)
                {
                    return(Constants.InvalidCount);
                }
                return(2);
            }
Beispiel #13
0
        public static CodePoint Decode(ArrayAccessor buffer, Index index)
        {
            var  i = index.index;
            uint x = buffer[i];

            if (index.count == 2)
            {
                var code = (x & 0b0011_1111_1111) + 0b0100_0000;
                code = (code << 10) | ((uint)buffer[i + 1] & 0b0011_1111_1111);
                return(new CodePoint(code));
            }
            else
            {
                return(new CodePoint(x));
            }
        }
Beispiel #14
0
        public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index)
        {
            if (index >= buffer.Length) return Constants.End;

            uint x = buffer[index++];

            if ((x & 0b1111_1100_0000_0000) == 0b1101_1000_0000_0000)
            {
                var code = (x & 0b0011_1111_1111) + 0b0100_0000;
                if (index >= buffer.Length) return Constants.End;
                x = buffer[index++];
                if ((x & 0b1111_1100_0000_0000) != 0b1101_1100_0000_0000) return Constants.End;
                code = (code << 10) | (x & 0b0011_1111_1111);

                return (new CodePoint(code), 2);
            }
            else
            {
                return (new CodePoint(x), 1);
            }
        }
Beispiel #15
0
 public static int GetLength(ArrayAccessor buffer) => buffer.Length;
Beispiel #16
0
 public static CodePoint Decode(ArrayAccessor buffer, Index index) => new CodePoint(buffer[index.index]);
 public BindingMemberInfo(string path, Type type)
     : this(path, BindingMemberType.Array, type.GetElementType())
 {
     var indexes = BindingReflectionExtensions
         .GetIndexerValues(path, null, typeof(int))
         .ToArrayEx(o => (int)o);
     var arrayAccessor = new ArrayAccessor(indexes);
     _getValueAccessorSingle = arrayAccessor.GetValue;
     _setValueAccessorSingleAction = arrayAccessor.SetValue;
     _canRead = true;
     _canWrite = true;
     _isSingleParameter = true;
 }
Beispiel #18
0
 public static byte TyrGetCount(ArrayAccessor buffer, int index)
 {
     if (index >= buffer.Length) return Constants.InvalidCount;
     return 1;
 }
Beispiel #19
0
 public static int GetLength(ArrayAccessor buffer) => buffer.Length;
Beispiel #20
0
 public static (CodePoint cp, byte count) TryDecode(ArrayAccessor buffer, int index)
 {
     if (index >= buffer.Length) return Constants.End;
     return (new CodePoint(buffer[index]), 1);
 }
 public static T[] GetInternalArray <T>(this List <T> list) => ArrayAccessor <T> .Getter(list);
Beispiel #22
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ArrayAccessor obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #23
0
 /// <summary>
 /// Gets the internal array of a <see cref="List{T}"/>.
 /// <para>Warning: Internal array length >= List.Count. Use with cautious.</para>
 /// </summary>
 /// <typeparam name="T">The type of the elements.</typeparam>
 /// <param name="list">The respective list.</param>
 /// <returns>The internal array of the list.</returns>
 public static T[] GetInternalArray <T>(this List <T> list)
 {
     return(ArrayAccessor <T> .Getter(list));
 }
Beispiel #24
0
 public static CodePoint Decode(ArrayAccessor buffer, Index index) => new CodePoint(buffer[index.index]);