IsWhitespace() static public method

static public IsWhitespace ( char ch ) : bool
ch char
return bool
Exemplo n.º 1
0
        public bool IsWhitespace()
        {
            switch (this.type)
            {
            case ValueHandleType.True:
            case ValueHandleType.False:
            case ValueHandleType.Zero:
            case ValueHandleType.One:
                return(false);

            case ValueHandleType.UTF8:
                return(this.bufferReader.IsWhitespaceUTF8(this.offset, this.length));

            case ValueHandleType.EscapedUTF8:
                return(this.bufferReader.IsWhitespaceUTF8(this.offset, this.length));

            case ValueHandleType.Dictionary:
                return(this.bufferReader.IsWhitespaceKey(this.offset));

            case ValueHandleType.Char:
            {
                int num = this.GetChar();
                return((num <= 0xffff) && XmlConverter.IsWhitespace((char)num));
            }

            case ValueHandleType.Unicode:
                return(this.bufferReader.IsWhitespaceUnicode(this.offset, this.length));

            case ValueHandleType.ConstString:
                return(constStrings[this.offset].Length == 0);
            }
            return(this.length == 0);
        }
Exemplo n.º 2
0
        public bool IsWhitespace()
        {
            switch (_type)
            {
            case ValueHandleType.UTF8:
                return(_bufferReader.IsWhitespaceUTF8(_offset, _length));

            case ValueHandleType.Dictionary:
                return(_bufferReader.IsWhitespaceKey(_offset));

            case ValueHandleType.Char:
                int ch = GetChar();
                return(ch <= char.MaxValue && XmlConverter.IsWhitespace((char)ch));

            case ValueHandleType.EscapedUTF8:
                return(_bufferReader.IsWhitespaceUTF8(_offset, _length));

            case ValueHandleType.Unicode:
                return(_bufferReader.IsWhitespaceUnicode(_offset, _length));

            case ValueHandleType.True:
            case ValueHandleType.False:
            case ValueHandleType.Zero:
            case ValueHandleType.One:
                return(false);

            case ValueHandleType.ConstString:
                return(s_constStrings[_offset].Length == 0);

            default:
                return(_length == 0);
            }
        }
Exemplo n.º 3
0
        public override void WriteValue(XmlDictionaryString value)
        {
            // Don't write whitespace after the document element
            if (depth == 0 && mimeWriter.WriteState == MimeWriterState.Closed && XmlConverter.IsWhitespace(value.Value))
                return;

            WriteBase64InlineIfPresent();
            Writer.WriteValue(value);
        }
Exemplo n.º 4
0
        public override void WriteString(string text)
        {
            // Don't write whitespace after the document element
            if (depth == 0 && mimeWriter.WriteState == MimeWriterState.Closed && XmlConverter.IsWhitespace(text))
                return;

            WriteBase64InlineIfPresent();
            Writer.WriteString(text);
        }
Exemplo n.º 5
0
 public bool IsWhitespaceUTF8(int offset, int length)
 {
     byte[] buffer = _buffer;
     for (int i = 0; i < length; i++)
     {
         if (!XmlConverter.IsWhitespace((char)buffer[offset + i]))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 6
0
 public bool IsWhitespaceUnicode(int offset, int length)
 {
     for (int i = 0; i < length; i += sizeof(char))
     {
         char ch = (char)GetInt16(offset + i);
         if (!XmlConverter.IsWhitespace(ch))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 7
0
        public bool IsWhitespaceKey(int key)
        {
            string s = GetDictionaryString(key).Value;

            for (int i = 0; i < s.Length; i++)
            {
                if (!XmlConverter.IsWhitespace(s[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
        public bool IsWhitespace()
        {
            switch (this.type)
            {
            case ValueHandleType.UTF8:
                return(bufferReader.IsWhitespaceUTF8(this.offset, this.length));

            case ValueHandleType.Dictionary:
                return(bufferReader.IsWhitespaceKey(this.offset));

            case ValueHandleType.Char:
                int ch = GetChar();
                if (ch > char.MaxValue)
                {
                    return(false);
                }
                return(XmlConverter.IsWhitespace((char)ch));

            case ValueHandleType.EscapedUTF8:
                return(bufferReader.IsWhitespaceUTF8(this.offset, this.length));

            case ValueHandleType.Unicode:
                return(bufferReader.IsWhitespaceUnicode(this.offset, this.length));

            case ValueHandleType.True:
            case ValueHandleType.False:
            case ValueHandleType.Zero:
            case ValueHandleType.One:
                return(false);

            case ValueHandleType.ConstString:
                return(constStrings[offset].Length == 0);

            default:
                return(this.length == 0);
            }
        }
Exemplo n.º 9
0
 public override void WriteValue(XmlDictionaryString value)
 {
     if (((this.depth != 0) || (this.mimeWriter.WriteState != MimeWriterState.Closed)) || !XmlConverter.IsWhitespace(value.Value))
     {
         this.WriteBase64InlineIfPresent();
         this.Writer.WriteValue(value);
     }
 }
Exemplo n.º 10
0
 public override void WriteString(string text)
 {
     if (((this.depth != 0) || (this.mimeWriter.WriteState != MimeWriterState.Closed)) || !XmlConverter.IsWhitespace(text))
     {
         this.WriteBase64InlineIfPresent();
         this.Writer.WriteString(text);
     }
 }