コード例 #1
0
        public static Text Create(Pointer pointer, char[] value, int offset = 0, int count = -1)
        {
            if (value == null)
            {
                return(default(Text));
            }
            if (count < 0)
            {
                count = value.Length - offset;
            }
            if (offset + count > value.Length)
            {
                throw new ArgumentOutOfRangeException("count");
            }

            if (value.Length == 0)
            {
                // automatic nil pointer
                return((Text)pointer.AllocateList(ElementSize.OneByte, 1));
            }

            int byteLen = Textizer.Encoding.GetByteCount(value, offset, count);
            var ptr     = pointer.AllocateList(ElementSize.OneByte, byteLen + 1);

            Textizer.Write(ptr, value, offset, count);
            return((Text)ptr);
        }
コード例 #2
0
 protected Pointer CreateListImpl(Pointer pointer, int count)
 {
     if (elementSize == ElementSize.InlineComposite)
     {
         return(pointer.AllocateList(dataWords, pointers, count));
     }
     else
     {
         return(pointer.AllocateList(elementSize, count));
     }
 }
コード例 #3
0
        public static Text Create(Pointer pointer, string value)
        {
            if (value == null)
            {
                return(default(Text));
            }

            if (value.Length == 0)
            {
                // automatic nil pointer
                return((Text)pointer.AllocateList(ElementSize.OneByte, 1));
            }
            int byteLen = Textizer.Encoding.GetByteCount(value);
            var ptr     = pointer.AllocateList(ElementSize.OneByte, byteLen + 1);

            ptr.WriteString(value);
            return(new Text(ptr, value));
        }
コード例 #4
0
 public override FixedSizeList <FixedSizeList <TInner> > CreateList(Pointer pointer, int count)
 {
     return((FixedSizeList <FixedSizeList <TInner> >)pointer.AllocateList(ElementSize.EightBytesPointer, count));
 }
コード例 #5
0
 public override FixedSizeList <double> CreateList(Pointer pointer, int count)
 {
     return((FixedSizeList <double>)pointer.AllocateList(ElementSize.EightBytesNonPointer, count));
 }
コード例 #6
0
 public override FixedSizeList <float> CreateList(Pointer pointer, int count)
 {
     return((FixedSizeList <float>)pointer.AllocateList(ElementSize.FourBytes, count));
 }
コード例 #7
0
 public override FixedSizeList <ushort> CreateList(Pointer pointer, int count)
 {
     return((FixedSizeList <ushort>)pointer.AllocateList(ElementSize.TwoBytes, count));
 }
コード例 #8
0
 public override FixedSizeList <sbyte> CreateList(Pointer pointer, int count)
 {
     return((FixedSizeList <sbyte>)pointer.AllocateList(ElementSize.OneByte, count));
 }
コード例 #9
0
 public override FixedSizeList <bool> CreateList(Pointer pointer, int count)
 {
     return((FixedSizeList <bool>)pointer.AllocateList(ElementSize.OneBit, count));
 }
コード例 #10
0
 public static Data Create(Pointer parent, int length)
 {
     return((Data)parent.AllocateList(ElementSize.OneByte, length));
 }
コード例 #11
0
ファイル: Data.cs プロジェクト: GSerjo/capnproto-net
 public static Data Create(Pointer parent, int length)
 {
     return (Data)parent.AllocateList(ElementSize.OneByte, length);
 }