Ejemplo n.º 1
0
        public byte[] GetString(out int offset, out int length)
        {
            StringHandleType type = _type;

            if (type == StringHandleType.UTF8)
            {
                offset = _offset;
                length = _length;
                return(_bufferReader.Buffer);
            }
            if (type == StringHandleType.Dictionary)
            {
                byte[] buffer = _bufferReader.GetDictionaryString(_key).ToUTF8();
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
            if (type == StringHandleType.ConstString)
            {
                byte[] buffer = XmlConverter.ToBytes(s_constStrings[_key]);
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
            else
            {
                DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8, "");
                byte[] buffer = XmlConverter.ToBytes(_bufferReader.GetEscapedString(_offset, _length));
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
        }
Ejemplo n.º 2
0
 public void SetValue(StringHandle value)
 {
     this.type = value.type;
     this.key = value.key;
     this.offset = value.offset;
     this.length = value.length;
 }
Ejemplo n.º 3
0
 public void SetValue(StringHandle value)
 {
     _type   = value._type;
     _key    = value._key;
     _offset = value._offset;
     _length = value._length;
 }
        public byte[] GetString(out int offset, out int length)
        {
            StringHandleType type = this.type;

            if (type == StringHandleType.UTF8)
            {
                offset = this.offset;
                length = this.length;
                return(bufferReader.Buffer);
            }
            if (type == StringHandleType.Dictionary)
            {
                byte[] buffer = bufferReader.GetDictionaryString(this.key).ToUTF8();
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
            if (type == StringHandleType.ConstString)
            {
                byte[] buffer = XmlConverter.ToBytes(constStrings[key]);
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
            else
            {
                Fx.Assert(type == StringHandleType.EscapedUTF8, "");
                byte[] buffer = XmlConverter.ToBytes(bufferReader.GetEscapedString(this.offset, this.length));
                offset = 0;
                length = buffer.Length;
                return(buffer);
            }
        }
Ejemplo n.º 5
0
 public void SetValue(StringHandle value)
 {
     this.type   = value.type;
     this.key    = value.key;
     this.offset = value.offset;
     this.length = value.length;
 }
Ejemplo n.º 6
0
 public void SetValue(StringHandle value)
 {
     _type = value._type;
     _key = value._key;
     _offset = value._offset;
     _length = value._length;
 }
Ejemplo n.º 7
0
 public void SetValue(StringHandle value)
 {
     type   = value.type;
     key    = value.key;
     offset = value.offset;
     length = value.length;
 }
Ejemplo n.º 8
0
        private bool Equals2(StringHandle s2)
        {
            StringHandleType type = s2._type;

            if (type == StringHandleType.Dictionary)
            {
                return(Equals2(s2._key, s2._bufferReader));
            }
            if (type == StringHandleType.UTF8)
            {
                return(Equals2(s2._offset, s2._length, s2._bufferReader));
            }
            DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(Equals2(s2.GetString()));
        }
        bool Equals2(StringHandle s2)
        {
            StringHandleType type = s2.type;

            if (type == StringHandleType.Dictionary)
            {
                return(Equals2(s2.key, s2.bufferReader));
            }
            if (type == StringHandleType.UTF8)
            {
                return(Equals2(s2.offset, s2.length, s2.bufferReader));
            }
            Fx.Assert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(Equals2(s2.GetString()));
        }
        bool Equals2(int offset2, int length2, XmlBufferReader bufferReader2)
        {
            StringHandleType type = this.type;

            if (type == StringHandleType.Dictionary)
            {
                return(bufferReader2.Equals2(offset2, length2, bufferReader.GetDictionaryString(this.key).Value));
            }
            if (type == StringHandleType.UTF8)
            {
                return(bufferReader.Equals2(this.offset, this.length, bufferReader2, offset2, length2));
            }
            Fx.Assert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(GetString() == bufferReader.GetString(offset2, length2));
        }
        bool Equals2(string s2)
        {
            StringHandleType type = this.type;

            if (type == StringHandleType.Dictionary)
            {
                return(bufferReader.GetDictionaryString(this.key).Value == s2);
            }
            if (type == StringHandleType.UTF8)
            {
                return(bufferReader.Equals2(this.offset, this.length, s2));
            }
            Fx.Assert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(GetString() == s2);
        }
        bool Equals2(XmlDictionaryString xmlString2)
        {
            StringHandleType type = this.type;

            if (type == StringHandleType.Dictionary)
            {
                return(bufferReader.Equals2(this.key, xmlString2));
            }
            if (type == StringHandleType.UTF8)
            {
                return(bufferReader.Equals2(this.offset, this.length, xmlString2.ToUTF8()));
            }
            Fx.Assert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(GetString() == xmlString2.Value);
        }
Ejemplo n.º 13
0
        private bool Equals2(XmlDictionaryString xmlString2)
        {
            StringHandleType type = _type;

            if (type == StringHandleType.Dictionary)
            {
                return(_bufferReader.Equals2(_key, xmlString2));
            }
            if (type == StringHandleType.UTF8)
            {
                return(_bufferReader.Equals2(_offset, _length, xmlString2.ToUTF8()));
            }
            DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(GetString() == xmlString2.Value);
        }
Ejemplo n.º 14
0
        private bool Equals2(string s2)
        {
            StringHandleType type = _type;

            if (type == StringHandleType.Dictionary)
            {
                return(_bufferReader.GetDictionaryString(_key).Value == s2);
            }
            if (type == StringHandleType.UTF8)
            {
                return(_bufferReader.Equals2(_offset, _length, s2));
            }
            DiagnosticUtility.DebugAssert(type == StringHandleType.ConstString, "");
            return(GetString() == s2);
        }
Ejemplo n.º 15
0
        private bool Equals2(int offset2, int length2, XmlBufferReader bufferReader2)
        {
            StringHandleType type = _type;

            if (type == StringHandleType.Dictionary)
            {
                return(bufferReader2.Equals2(offset2, length2, _bufferReader.GetDictionaryString(_key).Value));
            }
            if (type == StringHandleType.UTF8)
            {
                return(_bufferReader.Equals2(_offset, _length, bufferReader2, offset2, length2));
            }
            DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(GetString() == _bufferReader.GetString(offset2, length2));
        }
Ejemplo n.º 16
0
        public string GetString()
        {
            StringHandleType type = _type;

            if (type == StringHandleType.UTF8)
            {
                return(_bufferReader.GetString(_offset, _length));
            }
            if (type == StringHandleType.Dictionary)
            {
                return(_bufferReader.GetDictionaryString(_key).Value);
            }
            DiagnosticUtility.DebugAssert(type == StringHandleType.ConstString, "Should be ConstString");
            //If not Utf8 then the StringHandleType is ConstString
            return(s_constStrings[_key]);
        }
Ejemplo n.º 17
0
        public bool Equals([NotNullWhen(true)] StringHandle?other)
        {
            if (other is null)
            {
                return(false);
            }
            StringHandleType type = other._type;

            if (type == StringHandleType.Dictionary)
            {
                return(Equals2(other._key, other._bufferReader));
            }
            if (type == StringHandleType.UTF8)
            {
                return(Equals2(other._offset, other._length, other._bufferReader));
            }
            DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8 || type == StringHandleType.ConstString, "");
            return(Equals2(other.GetString()));
        }
        public string GetString()
        {
            StringHandleType type = this.type;

            if (type == StringHandleType.UTF8)
            {
                return(bufferReader.GetString(offset, length));
            }
            if (type == StringHandleType.Dictionary)
            {
                return(bufferReader.GetDictionaryString(key).Value);
            }
            if (type == StringHandleType.ConstString)
            {
                return(constStrings[key]);
            }
            Fx.Assert(type == StringHandleType.EscapedUTF8, "");
            return(bufferReader.GetEscapedString(offset, length));
        }
Ejemplo n.º 19
0
        public string GetString()
        {
            StringHandleType type = _type;

            if (type == StringHandleType.UTF8)
            {
                return(_bufferReader.GetString(_offset, _length));
            }
            if (type == StringHandleType.Dictionary)
            {
                return(_bufferReader.GetDictionaryString(_key).Value);
            }
            if (type == StringHandleType.ConstString)
            {
                return(s_constStrings[_key]);
            }
            // If none of the above, must be StringHandleType.EscapedUTF8
            DiagnosticUtility.DebugAssert(type == StringHandleType.EscapedUTF8, "Should be EscapedUTF8");
            return(_bufferReader.GetEscapedString(_offset, _length));
        }
Ejemplo n.º 20
0
 public void SetValue(int key)
 {
     this.type = StringHandleType.Dictionary;
     this.key = key;
 }
Ejemplo n.º 21
0
 public void SetValue(int offset, int length, bool escaped)
 {
     this.type = (escaped ? StringHandleType.EscapedUTF8 : StringHandleType.UTF8);
     this.offset = offset;
     this.length = length;
 }
Ejemplo n.º 22
0
 public void SetConstantValue(StringHandleConstStringType constStringType)
 {
     type = StringHandleType.ConstString;
     key = (int)constStringType;
 }
Ejemplo n.º 23
0
 public void SetValue(int offset, int length)
 {
     this.type = StringHandleType.UTF8;
     this.offset = offset;
     this.length = length;
 }
Ejemplo n.º 24
0
 public void SetValue(int offset, int length)
 {
     _type = StringHandleType.UTF8;
     _offset = offset;
     _length = length;
 }
Ejemplo n.º 25
0
 public void SetValue(StringHandle value)
 {
     type = value.type;
     key = value.key;
     offset = value.offset;
     length = value.length;
 }
Ejemplo n.º 26
0
 public void SetValue(int offset, int length)
 {
     this.type   = StringHandleType.UTF8;
     this.offset = offset;
     this.length = length;
 }
Ejemplo n.º 27
0
 public void SetValue(int key)
 {
     this.type = StringHandleType.Dictionary;
     this.key  = key;
 }
Ejemplo n.º 28
0
 public void SetValue(int iOffset, int iLength)
 {
     type = StringHandleType.UTF8;
     offset = iOffset;
     this.length = iLength;
 }
Ejemplo n.º 29
0
 public void SetValue(int key)
 {
     _type = StringHandleType.Dictionary;
     _key = key;
 }
Ejemplo n.º 30
0
 public void SetValue(int iOffset, int iLength)
 {
     type        = StringHandleType.UTF8;
     offset      = iOffset;
     this.length = iLength;
 }
Ejemplo n.º 31
0
 public void SetConstantValue(StringHandleConstStringType constStringType)
 {
     this.type = StringHandleType.ConstString;
     this.key  = (int)constStringType;
 }
Ejemplo n.º 32
0
 public void SetValue(int offset, int length)
 {
     _type   = StringHandleType.UTF8;
     _offset = offset;
     _length = length;
 }
Ejemplo n.º 33
0
 public void SetValue(int offset, int length, bool escaped)
 {
     _type   = (escaped ? StringHandleType.EscapedUTF8 : StringHandleType.UTF8);
     _offset = offset;
     _length = length;
 }
Ejemplo n.º 34
0
 public void SetValue(int key)
 {
     _type = StringHandleType.Dictionary;
     _key  = key;
 }
Ejemplo n.º 35
0
 public void SetValue(int offset, int length, bool escaped)
 {
     this.type   = escaped ? StringHandleType.EscapedUTF8 : StringHandleType.UTF8;
     this.offset = offset;
     this.length = length;
 }
Ejemplo n.º 36
0
 public void SetValue(int iOffset, int iLength, bool escaped)
 {
     type = escaped ? StringHandleType.EscapedUTF8 : StringHandleType.UTF8;
     this.offset = iOffset;
     this.length = iLength;
 }