class CCL::TextParser
Overview
#include <textparser.h> class TextParser { public: // construction TextParser (IStream& stream); // methods void addWhitespace (uchar c); void addIdentifierChar (uchar c); uchar peek () const; bool advance (); uchar read (); bool read (uchar c); int read (String& string, int length); bool readUntil (CStringPtr delimiters, String& string); bool readUntil (uchar delimiter, String& string); bool readUntil (StringRef delimiter, String& string); String& readIdentifier (String& ident); void readIdentifier (char* ident, int bufferSize); bool readPropertyPath (MutableCString& string); String& readStringLiteral (String& string, uchar quote = '"'); bool readFloat (float& value, bool withExponent = true); bool readFloat (double& value, bool withExponent = true); bool readInt (int& value); bool readInt (int64& value); void skipWhite (); bool skipLine (); bool readLine (String& line); };
Detailed Documentation
Methods
uchar read ()
read the next character
bool read (uchar c)
try to read the given character, advances on success
int read (String& string, int length)
read upto length characters
bool readUntil (CStringPtr delimiters, String& string)
read until one of the delimiters characters is found
bool readUntil (uchar delimiter, String& string)
read until delimiter is found, delimiter is overread but not copied to string
bool readUntil (StringRef delimiter, String& string)
read until delimiter is found, delimiter is overread but not copied to string
String& readIdentifier (String& ident)
starts with a letter, followed by letters & digits
void readIdentifier (char* ident, int bufferSize)
starts with a letter, followed by letters & digits
bool readPropertyPath (MutableCString& string)
read a property path, may contain letters & digits, and : . /
String& readStringLiteral (String& string, uchar quote = '"')
any text in “..” todo: escaping
bool readFloat (float& value, bool withExponent = true)
eg. “1.”, “.1”, “1.1”, withExponent: “1e-12”, 2.2E6”
bool skipLine ()
skip the rest of current line
bool readLine (String& line)
read the rest of current line