Пример #1
0
 //    Description:
 //        Returns the next character of interest in the stream. All
 //        whitespace and commented lines are ignored.
 //
 char asChar(ref StreamReaderExt clipFile)
 {
     advance(ref clipFile);
     return clipFile.ReadChar();
 }
Пример #2
0
 //    Description:
 //        Returns the next string of characters in an stream. The string
 //        ends when whitespace or a semi-colon is encountered. If the
 //        includeWS argument is true, the string will not end if a white
 //        space character is encountered.
 //
 //        If a double quote is detected '"', then very thing up to the next
 //        double quote will be returned.
 //
 //        This method returns a pointer to a static variable, so its contents
 //        should be used immediately.
 //    
 public string asWord(ref StreamReaderExt clipFile, bool includeWS = false)
 {
     string str = "";
     advance(ref clipFile);
     char c = clipFile.ReadChar();
     if (c == kDoubleQuoteChar)
     {
         c = clipFile.ReadChar();
         str += c;
         while (!clipFile.EndOfStream && c != kDoubleQuoteChar)
         {
             c = clipFile.ReadChar();
             str += c;
         }
     }
     else
     {
         //	Get the case of the '{' or '}' character
         //
         if (c == kBraceLeftChar || c == kBraceRightChar)
             str+=c;
         else
         {
             while (!clipFile.EndOfStream && c != kSemiColonChar)
             {
                 if (!includeWS && (c == kSpaceChar || c == kTabChar))
                     break;
                 str += c;
                 c = clipFile.ReadChar();
             }
         }
     }
     return str;
 }
Пример #3
0
        //    Description:
        //        The method skips past all of the whitespace and commented lines
        //        in the stream. It will also ignore semi-colons.
        //
        public void advance(ref StreamReaderExt clipFile)
        {
            while (!clipFile.EndOfStream)
            {
                try
                {
                    char next = (char)clipFile.Peek();
                    if (char.IsWhiteSpace(next))
                    {
                        clipFile.ReadChar();
                        continue;
                    }
                    if (next == kSemiColonChar)
                    {
                        clipFile.ReadChar();
                        continue;
                    }
                    if (next == kSlashChar || next == kHashChar)
                    {
                        clipFile.ReadLine();
                        continue;
                    }
                    break;
                }
                catch (System.Exception )
                {
                    return;
                }

            }
        }
Пример #4
0
		char asChar (ref StreamReaderExt clipFile)
		//	Description:
		//		Returns the next character of interest in the stream. All 
		//		whitespace and commented lines are ignored.
		//
		{
			advance(ref clipFile);
			return clipFile.ReadChar();
		}
Пример #5
0
		public string asWord(ref StreamReaderExt clipFile, bool includeWS = false)
		//	Description:
		//		Returns the next string of characters in an stream. The string
		//		ends when whitespace or a semi-colon is encountered. If the 
		//		includeWS argument is true, the string will not end if a white
		//		space character is encountered.
		//
		//		If a double quote is detected '"', then very thing up to the next 
		//		double quote will be returned.
		//
		//		This method returns a pointer to a static variable, so its contents
		//		should be used immediately.
		//	
		{
			string str = "";
			advance(ref clipFile);
			char c = clipFile.ReadChar();
			if (c == kDoubleQuoteChar)
			{
				c = clipFile.ReadChar();
				str += c;
				while (!clipFile.EndOfStream && c != kDoubleQuoteChar)
				{
					c = clipFile.ReadChar();
					str += c;
				}
			}
			else
			{
				//	Get the case of the '{' or '}' character
				//
				if (c == kBraceLeftChar || c == kBraceRightChar)
					str+=c;
				else
				{
					while (!clipFile.EndOfStream && c != kSemiColonChar)
					{
						if (!includeWS && (c == kSpaceChar || c == kTabChar))
							break;
						str += c;
						c = clipFile.ReadChar();
					}
				}
			}
			return str;
		}
Пример #6
0
		public void advance(ref StreamReaderExt clipFile)
		//	Description:
		//		The method skips past all of the whitespace and commented lines
		//		in the stream. It will also ignore semi-colons.
		//
		{
			while (!clipFile.EndOfStream)
			{
				try
				{
					char next = (char)clipFile.Peek();
					if (char.IsWhiteSpace(next))
					{
						clipFile.ReadChar();
						continue;
					}
					if (next == kSemiColonChar)
					{
						clipFile.ReadChar();
						continue;
					}
					if (next == kSlashChar || next == kHashChar)
					{
						clipFile.ReadLine();
						continue;
					}
					break;
				}
				catch (System.Exception )
				{
					return;
				}
				
			}
		}