예제 #1
0
 public int CompareTo(StringHandle that)
 {
     if ((this.type == StringHandleType.UTF8) && (that.type == StringHandleType.UTF8))
     {
         return(this.bufferReader.Compare(this.offset, this.length, that.offset, that.length));
     }
     return(string.Compare(this.GetString(), that.GetString(), StringComparison.Ordinal));
 }
 public int CompareTo(StringHandle that)
 {
     if ((this.type == StringHandleType.UTF8) && (that.type == StringHandleType.UTF8))
     {
         return this.bufferReader.Compare(this.offset, this.length, that.offset, that.length);
     }
     return string.Compare(this.GetString(), that.GetString(), StringComparison.Ordinal);
 }
예제 #3
0
 public int CompareTo(StringHandle that)
 {
     if (_type == StringHandleType.UTF8 && that._type == StringHandleType.UTF8)
     {
         return(_bufferReader.Compare(_offset, _length, that._offset, that._length));
     }
     else
     {
         return(string.Compare(this.GetString(), that.GetString(), StringComparison.Ordinal));
     }
 }
예제 #4
0
        private bool Equals2(StringHandle s2)
        {
            switch (s2.type)
            {
            case StringHandleType.Dictionary:
                return(this.Equals2(s2.key, s2.bufferReader));

            case StringHandleType.UTF8:
                return(this.Equals2(s2.offset, s2.length, s2.bufferReader));
            }
            return(this.Equals2(s2.GetString()));
        }
        private bool Equals2(StringHandle s2)
        {
            switch (s2.type)
            {
                case StringHandleType.Dictionary:
                    return this.Equals2(s2.key, s2.bufferReader);

                case StringHandleType.UTF8:
                    return this.Equals2(s2.offset, s2.length, s2.bufferReader);
            }
            return this.Equals2(s2.GetString());
        }
예제 #6
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()));
        }
예제 #8
0
        private void ReadQualifiedName(PrefixHandle prefix, StringHandle localName)
        {
            int offset;
            int offsetMax;
            byte[] buffer = BufferReader.GetBuffer(out offset, out offsetMax);

            int ch = 0;
            int anyChar = 0;
            int prefixChar = 0;
            int prefixOffset = offset;
            if (offset < offsetMax)
            {
                ch = buffer[offset];
                prefixChar = ch;
                if ((s_charType[ch] & CharType.FirstName) == 0)
                    anyChar |= 0x80;
                anyChar |= ch;
                offset++;
                while (offset < offsetMax)
                {
                    ch = buffer[offset];
                    if ((s_charType[ch] & CharType.Name) == 0)
                        break;
                    anyChar |= ch;
                    offset++;
                }
            }
            else
            {
                anyChar |= 0x80;
                ch = 0;
            }
            if (ch == ':')
            {
                int prefixLength = offset - prefixOffset;
                if (prefixLength == 1 && prefixChar >= 'a' && prefixChar <= 'z')
                    prefix.SetValue(PrefixHandle.GetAlphaPrefix(prefixChar - 'a'));
                else
                    prefix.SetValue(prefixOffset, prefixLength);

                offset++;
                int localNameOffset = offset;
                if (offset < offsetMax)
                {
                    ch = buffer[offset];
                    if ((s_charType[ch] & CharType.FirstName) == 0)
                        anyChar |= 0x80;
                    anyChar |= ch;
                    offset++;
                    while (offset < offsetMax)
                    {
                        ch = buffer[offset];
                        if ((s_charType[ch] & CharType.Name) == 0)
                            break;
                        anyChar |= ch;
                        offset++;
                    }
                }
                else
                {
                    anyChar |= 0x80;
                    ch = 0;
                }
                localName.SetValue(localNameOffset, offset - localNameOffset);
                if (anyChar >= 0x80)
                {
                    VerifyNCName(prefix.GetString());
                    VerifyNCName(localName.GetString());
                }
            }
            else
            {
                prefix.SetValue(PrefixHandleType.Empty);
                localName.SetValue(prefixOffset, offset - prefixOffset);
                if (anyChar >= 0x80)
                {
                    VerifyNCName(localName.GetString());
                }
            }
            BufferReader.Advance(offset - prefixOffset);
        }
        private void ReadQualifiedName(PrefixHandle prefix, StringHandle localName)
        {
            int num;
            int num2;

            byte[] buffer = base.BufferReader.GetBuffer(out num, out num2);
            int    index  = 0;
            int    num4   = 0;
            int    num5   = 0;
            int    offset = num;

            if (num < num2)
            {
                index = buffer[num];
                num5  = index;
                if ((charType[index] & 1) == 0)
                {
                    num4 |= 0x80;
                }
                num4 |= index;
                num++;
                while (num < num2)
                {
                    index = buffer[num];
                    if ((charType[index] & 2) == 0)
                    {
                        break;
                    }
                    num4 |= index;
                    num++;
                }
            }
            else
            {
                num4 |= 0x80;
                index = 0;
            }
            if (index != 0x3a)
            {
                prefix.SetValue(PrefixHandleType.Empty);
                localName.SetValue(offset, num - offset);
                if (num4 >= 0x80)
                {
                    this.VerifyNCName(localName.GetString());
                }
            }
            else
            {
                int length = num - offset;
                if (((length == 1) && (num5 >= 0x61)) && (num5 <= 0x7a))
                {
                    prefix.SetValue(PrefixHandle.GetAlphaPrefix(num5 - 0x61));
                }
                else
                {
                    prefix.SetValue(offset, length);
                }
                num++;
                int num8 = num;
                if (num < num2)
                {
                    index = buffer[num];
                    if ((charType[index] & 1) == 0)
                    {
                        num4 |= 0x80;
                    }
                    num4 |= index;
                    num++;
                    while (num < num2)
                    {
                        index = buffer[num];
                        if ((charType[index] & 2) == 0)
                        {
                            break;
                        }
                        num4 |= index;
                        num++;
                    }
                }
                else
                {
                    num4 |= 0x80;
                    index = 0;
                }
                localName.SetValue(num8, num - num8);
                if (num4 >= 0x80)
                {
                    this.VerifyNCName(prefix.GetString());
                    this.VerifyNCName(localName.GetString());
                }
            }
            base.BufferReader.Advance(num - offset);
        }
예제 #10
0
 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());
 }
예제 #11
0
 public int CompareTo(StringHandle that)
 {
     if (_type == StringHandleType.UTF8 && that._type == StringHandleType.UTF8)
         return _bufferReader.Compare(_offset, _length, that._offset, that._length);
     else
         return string.Compare(this.GetString(), that.GetString(), StringComparison.Ordinal);
 }
예제 #12
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());
 }
 private void ReadQualifiedName(PrefixHandle prefix, StringHandle localName)
 {
     int num;
     int num2;
     byte[] buffer = base.BufferReader.GetBuffer(out num, out num2);
     int index = 0;
     int num4 = 0;
     int num5 = 0;
     int offset = num;
     if (num < num2)
     {
         index = buffer[num];
         num5 = index;
         if ((charType[index] & 1) == 0)
         {
             num4 |= 0x80;
         }
         num4 |= index;
         num++;
         while (num < num2)
         {
             index = buffer[num];
             if ((charType[index] & 2) == 0)
             {
                 break;
             }
             num4 |= index;
             num++;
         }
     }
     else
     {
         num4 |= 0x80;
         index = 0;
     }
     if (index != 0x3a)
     {
         prefix.SetValue(PrefixHandleType.Empty);
         localName.SetValue(offset, num - offset);
         if (num4 >= 0x80)
         {
             this.VerifyNCName(localName.GetString());
         }
     }
     else
     {
         int length = num - offset;
         if (((length == 1) && (num5 >= 0x61)) && (num5 <= 0x7a))
         {
             prefix.SetValue(PrefixHandle.GetAlphaPrefix(num5 - 0x61));
         }
         else
         {
             prefix.SetValue(offset, length);
         }
         num++;
         int num8 = num;
         if (num < num2)
         {
             index = buffer[num];
             if ((charType[index] & 1) == 0)
             {
                 num4 |= 0x80;
             }
             num4 |= index;
             num++;
             while (num < num2)
             {
                 index = buffer[num];
                 if ((charType[index] & 2) == 0)
                 {
                     break;
                 }
                 num4 |= index;
                 num++;
             }
         }
         else
         {
             num4 |= 0x80;
             index = 0;
         }
         localName.SetValue(num8, num - num8);
         if (num4 >= 0x80)
         {
             this.VerifyNCName(prefix.GetString());
             this.VerifyNCName(localName.GetString());
         }
     }
     base.BufferReader.Advance(num - offset);
 }