![]() |
JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
A simple parser for certain CSS subsets. More...
#include <jkqtpcsstools.h>
Classes | |
| struct | GeneralError |
| struct | NumberWithUnit |
encodes a number with its unit, e.g. 100% or 45deg or ... More... | |
| struct | RawErrorTag_t |
| struct | Token |
| struct | UnconvertobleError |
| Exception when a string cannot be converted properly. More... | |
| struct | UnexpectedTermError |
| Exception for unexpected Term. More... | |
| struct | UnexpectedTokenError |
| Exception for unexpected Token. More... | |
| struct | WrongNumberOfArgumentError |
| Exception for wrong number of function arguments. More... | |
Static Public Member Functions | |
| static QColor | readColor (const QString &prog) |
parses the given expression, which should represent a color (incl. color-functions like rgb() ) | |
| static QGradient | readGradient (const QString &prog) |
| parses the given expression, which should represent a QGradient | |
| static NumberWithUnit | readNumberWithUnit (const QString &prog) |
| parses the given expression | |
Protected Member Functions | |
| JKQTPCSSParser (const QString &text) | |
| class constructor | |
Parser | |
| JKQTPExpected< JKQTPCSSParser::NumberWithUnit, JKQTPCSSParser::GeneralError > | parseNumberWithUnit (bool get) |
| parses a number with unit | |
| JKQTPExpected< QColor, JKQTPCSSParser::GeneralError > | parseColor (bool get) |
| parses a color definition <color> | |
| JKQTPExpected< QGradient, JKQTPCSSParser::GeneralError > | parseGradient (bool get) |
| parses a color definition <gradient> | |
Static Protected Attributes | |
Error Handling | |
| static RawErrorTag_t | RawErrorTag |
Tokenizer | |
| Token | CurrentToken |
| the current token while parsing a string | |
| QString | text |
| this stream is used to read in the program. An object is created and assigned (and destroyed) by the parse()-function | |
| int | pos |
| current reading position in text | |
| Token | peekNextToken (int *endPos=nullptr) |
| Tokenizer: look at the next token from the input, but don't set it as CurrentToken and don't move the read pointer pos. | |
| Token | getToken () |
| Tokenizer: extract the next token from the input. | |
| bool | textAtEnd () const |
| indicates whether pos points to the end of text | |
| bool | getCh (QChar &ch) |
| bool | peekCh (QChar &ch) |
| void | putBackCh () |
A simple parser for certain CSS subsets.
<lingradient> -> linear-gradient( <angle>? , <gradientstops> )
<angle> -> <numberwithunit>
| to (left|right|bottom|top) (left|right|bottom|top)?
<numberwithunit> -> <number> [A-Za-z%]*
<gradientstops> -> <gradientstop> | <gradientstop> , <gradientstops>
<gradientstop> -> <color> (<number>%)?
<color> -> NAME
| #<hexnumber>
| (rgb | rgba | hsl | hsv | gray | grey | red | green | blue) ( (<numberwithunit> [,/]? ){1-4} )
<number> -> floating-point-number, i.e. "[+-]?\d+\.?\d*"
<hexnumber> -> RGB | RRGGBB | RGBA | RRGGBBAA
| struct JKQTPCSSParser::RawErrorTag_t |
|
protected |
class constructor
|
inlineprotected |
|
protected |
Tokenizer: extract the next token from the input.
|
protected |
parses a color definition <color>
|
protected |
parses a color definition <gradient>
|
protected |
parses a number with unit
|
inlineprotected |
|
protected |
Tokenizer: look at the next token from the input, but don't set it as CurrentToken and don't move the read pointer pos.
|
inlineprotected |
|
static |
parses the given expression, which should represent a color (incl. color-functions like rgb() )
|
static |
parses the given expression, which should represent a QGradient
|
static |
parses the given expression
|
inlineprotected |
indicates whether pos points to the end of text
|
protected |
the current token while parsing a string
|
protected |
current reading position in text
|
staticprotected |
|
protected |
this stream is used to read in the program. An object is created and assigned (and destroyed) by the parse()-function