Пример #1
0
 public void SetValue(StringHandle value)
 {
     _type = value._type;
     _key = value._key;
     _offset = value._offset;
     _length = value._length;
 }
Пример #2
0
 public void SetValue(StringHandle value)
 {
     this.type = value.type;
     this.key = value.key;
     this.offset = value.offset;
     this.length = value.length;
 }
 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);
 }
        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());
        }
Пример #5
0
 private XmlAttributeNode(PrefixHandle prefix, StringHandle localName, ValueHandle value)
     : base(XmlNodeType.Attribute,
            prefix,
            localName,
            value,
            XmlNodeFlags.CanGetAttribute | XmlNodeFlags.CanMoveToElement | XmlNodeFlags.HasValue | XmlNodeFlags.AtomicValue,
            ReadState.Interactive,
            new XmlAttributeTextNode(prefix, localName, value),
            0)
 {
 }
Пример #6
0
 private XmlElementNode(PrefixHandle prefix, StringHandle localName, ValueHandle value)
     : base(XmlNodeType.Element,
            prefix,
            localName,
            value,
            XmlNodeFlags.CanGetAttribute | XmlNodeFlags.HasContent,
            ReadState.Interactive,
            null,
            -1)
 {
     _endElementNode = new XmlEndElementNode(prefix, localName, value);
 }
Пример #7
0
            protected XmlNode(XmlNodeType nodeType,
                              PrefixHandle prefix,
                              StringHandle localName,
                              ValueHandle value,
                              XmlNodeFlags nodeFlags,
                              ReadState readState,
                              XmlAttributeTextNode attributeTextNode,
                              int depthDelta)
            {
                _nodeType = nodeType;
                _prefix = prefix;
                _localName = localName;
                _value = value;
                _ns = NamespaceManager.EmptyNamespace;
                _hasValue = ((nodeFlags & XmlNodeFlags.HasValue) != 0);
                _canGetAttribute = ((nodeFlags & XmlNodeFlags.CanGetAttribute) != 0);
                _canMoveToElement = ((nodeFlags & XmlNodeFlags.CanMoveToElement) != 0);
                _isAtomicValue = ((nodeFlags & XmlNodeFlags.AtomicValue) != 0);
                _skipValue = ((nodeFlags & XmlNodeFlags.SkipValue) != 0);
                _hasContent = ((nodeFlags & XmlNodeFlags.HasContent) != 0);
                _readState = readState;
                _attributeTextNode = attributeTextNode;
                _exitScope = (nodeType == XmlNodeType.EndElement);
                _depthDelta = depthDelta;
                _isEmptyElement = false;
                _quoteChar = '"';

                _qnameType = QNameType.Normal;
            }
Пример #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);
        }
Пример #9
0
 public XmlUTF8TextReader()
 {
     _prefix = new PrefixHandle(BufferReader);
     _localName = new StringHandle(BufferReader);
 }
 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);
 }
Пример #11
0
 private void ReadName(StringHandle handle)
 {
     int length = ReadMultiByteUInt31();
     int offset = BufferReader.ReadBytes(length);
     handle.SetValue(offset, length);
 }
Пример #12
0
 public XmlAttributeTextNode(PrefixHandle prefix, StringHandle localName, ValueHandle value)
     : base(XmlNodeType.Text,
            prefix,
            localName,
            value,
            XmlNodeFlags.HasValue | XmlNodeFlags.CanGetAttribute | XmlNodeFlags.CanMoveToElement | XmlNodeFlags.AtomicValue | XmlNodeFlags.HasContent,
            ReadState.Interactive,
            null,
            1)
 {
 }
Пример #13
0
 public XmlEndElementNode(PrefixHandle prefix, StringHandle localName, ValueHandle value)
     : base(XmlNodeType.EndElement,
            prefix,
            localName,
            value,
            XmlNodeFlags.HasContent,
            ReadState.Interactive,
            null,
            -1)
 {
 }
Пример #14
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);
 }
Пример #15
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());
 }
Пример #16
0
 public Namespace(XmlBufferReader bufferReader)
 {
     this.prefix = new PrefixHandle(bufferReader);
     this.uri = new StringHandle(bufferReader);
     this.outerUri = null;
     this.uriString = null;
 }
Пример #17
0
 public bool TryGetLocalNameAsDictionaryString(out XmlDictionaryString localName)
 {
     if (qnameType == QNameType.Normal)
     {
         return this.LocalName.TryGetDictionaryString(out localName);
     }
     else
     {
         Fx.Assert(qnameType == QNameType.Xmlns, "");
         localName = null;
         return false;
     }
 }
        public XmlUTF8TextReader()
        {
            this.prefix = new PrefixHandle(BufferReader);
            this.localName = new StringHandle(BufferReader);
#if GENERATE_CHARTYPE
            CharType.Generate();
#endif
        }
Пример #19
0
 protected XmlTextNode(XmlNodeType nodeType,
                   PrefixHandle prefix,
                   StringHandle localName,
                   ValueHandle value,
                   XmlNodeFlags nodeFlags,
                   ReadState readState,
                   XmlAttributeTextNode attributeTextNode,
                   int depthDelta)
     :
     base(nodeType, prefix, localName, value, nodeFlags, readState, attributeTextNode, depthDelta)
 {
 }
 private void ReadName(StringHandle handle)
 {
     int count = this.ReadMultiByteUInt31();
     int offset = base.BufferReader.ReadBytes(count);
     handle.SetValue(offset, count);
 }
Пример #21
0
 public Namespace(XmlBufferReader bufferReader)
 {
     _prefix = new PrefixHandle(bufferReader);
     _uri = new StringHandle(bufferReader);
     _outerUri = null;
     _uriString = null;
 }
Пример #22
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());
 }
Пример #23
0
 private void ReadDictionaryName(StringHandle s)
 {
     int key = ReadDictionaryKey();
     s.SetValue(key);
 }
 public XmlUTF8TextReader()
 {
     this.prefix = new PrefixHandle(base.BufferReader);
     this.localName = new StringHandle(base.BufferReader);
 }