Dillo v3.1.1-91-g6d5b3ee3
Loading...
Searching...
No Matches
CssParser Class Reference

#include <cssparser.hh>

Static Public Member Functions

static void parseDeclarationBlock (const DilloUrl *baseUrl, const char *buf, int buflen, CssPropertyList *props, CssPropertyList *propsImortant)
 
static void parse (DilloHtml *html, const DilloUrl *baseUrl, CssContext *context, const char *buf, int buflen, CssOrigin origin)
 
static const char * propertyNameString (CssPropertyName name)
 

Private Types

enum  CssTokenType {
  CSS_TK_DECINT , CSS_TK_FLOAT , CSS_TK_COLOR , CSS_TK_SYMBOL ,
  CSS_TK_STRING , CSS_TK_CHAR , CSS_TK_END
}
 

Private Member Functions

 CssParser (CssContext *context, CssOrigin origin, const DilloUrl *baseUrl, const char *buf, int buflen)
 
int getChar ()
 Gets the next character from the buffer, or EOF.
 
void ungetChar ()
 Undoes the last getChar().
 
void nextToken ()
 
bool skipString (int c, const char *string)
 Skip string str if it is found in the input buffer.
 
bool tokenMatchesProperty (CssPropertyName prop, CssValueType *type)
 
bool parseValue (CssPropertyName prop, CssValueType type, CssPropertyValue *val)
 
bool parseWeight ()
 
bool parseRgbColorComponent (int32_t *cc, int *percentage)
 
bool parseRgbColor (int32_t *c)
 
void parseDeclaration (CssPropertyList *props, CssPropertyList *importantProps)
 
bool parseSimpleSelector (CssSimpleSelector *selector)
 
char * parseUrl ()
 
void parseImport (DilloHtml *html)
 
void parseMedia ()
 
CssSelectorparseSelector ()
 
void parseRuleset ()
 
void ignoreBlock ()
 
void ignoreStatement ()
 

Private Attributes

CssContextcontext
 
CssOrigin origin
 
const DilloUrlbaseUrl
 
const char * buf
 
int buflen
 
int bufptr
 
CssTokenType ttype
 
char tval [maxStrLen]
 
bool withinBlock
 
bool spaceSeparated
 

Static Private Attributes

static const int maxStrLen = 256
 

Detailed Description

Definition at line 8 of file cssparser.hh.

Member Enumeration Documentation

◆ CssTokenType

Enumerator
CSS_TK_DECINT 
CSS_TK_FLOAT 
CSS_TK_COLOR 
CSS_TK_SYMBOL 
CSS_TK_STRING 
CSS_TK_CHAR 
CSS_TK_END 

Definition at line 10 of file cssparser.hh.

Constructor & Destructor Documentation

◆ CssParser()

CssParser::CssParser ( CssContext context,
CssOrigin  origin,
const DilloUrl baseUrl,
const char *  buf,
int  buflen 
)
private

Definition at line 458 of file cssparser.cc.

References baseUrl, buf, buflen, bufptr, context, nextToken(), origin, spaceSeparated, and withinBlock.

Member Function Documentation

◆ getChar()

int CssParser::getChar ( )
private

Gets the next character from the buffer, or EOF.

Definition at line 477 of file cssparser.cc.

References buf, buflen, and bufptr.

Referenced by nextToken(), and skipString().

◆ ignoreBlock()

void CssParser::ignoreBlock ( )
private

Definition at line 1734 of file cssparser.cc.

References CSS_TK_CHAR, CSS_TK_END, nextToken(), ttype, and tval.

Referenced by ignoreStatement(), and parseMedia().

◆ ignoreStatement()

void CssParser::ignoreStatement ( )
private

Definition at line 1754 of file cssparser.cc.

References CSS_TK_CHAR, CSS_TK_END, ignoreBlock(), nextToken(), ttype, and tval.

Referenced by parse(), parseImport(), and parseMedia().

◆ nextToken()

◆ parse()

void CssParser::parse ( DilloHtml html,
const DilloUrl baseUrl,
CssContext context,
const char *  buf,
int  buflen,
CssOrigin  origin 
)
static

◆ parseDeclaration()

◆ parseDeclarationBlock()

void CssParser::parseDeclarationBlock ( const DilloUrl baseUrl,
const char *  buf,
int  buflen,
CssPropertyList props,
CssPropertyList propsImortant 
)
static

◆ parseImport()

◆ parseMedia()

void CssParser::parseMedia ( )
private

◆ parseRgbColor()

bool CssParser::parseRgbColor ( int32_t *  c)
private

Definition at line 846 of file cssparser.cc.

References CSS_TK_CHAR, MSG_CSS, nextToken(), parseRgbColorComponent(), ttype, and tval.

Referenced by parseValue().

◆ parseRgbColorComponent()

bool CssParser::parseRgbColorComponent ( int32_t *  cc,
int *  percentage 
)
private

Definition at line 813 of file cssparser.cc.

References CSS_TK_CHAR, CSS_TK_DECINT, MSG_CSS, nextToken(), ttype, and tval.

Referenced by parseRgbColor().

◆ parseRuleset()

◆ parseSelector()

◆ parseSimpleSelector()

◆ parseUrl()

◆ parseValue()

◆ parseWeight()

bool CssParser::parseWeight ( )
private

Definition at line 1218 of file cssparser.cc.

References CSS_TK_CHAR, CSS_TK_SYMBOL, dStrAsciiCasecmp(), nextToken(), ttype, and tval.

Referenced by parseDeclaration().

◆ propertyNameString()

const char * CssParser::propertyNameString ( CssPropertyName  name)
static

Definition at line 1729 of file cssparser.cc.

References Css_property_info.

Referenced by CssProperty::print().

◆ skipString()

bool CssParser::skipString ( int  c,
const char *  str 
)
inlineprivate

Skip string str if it is found in the input buffer.

If string is found leave bufptr pointing to last matched char. If not wind back. The first char is passed as parameter c to avoid unnecessary getChar() / ungetChar() calls.

Definition at line 506 of file cssparser.cc.

References getChar(), and ungetChar().

Referenced by nextToken().

◆ tokenMatchesProperty()

◆ ungetChar()

void CssParser::ungetChar ( )
private

Undoes the last getChar().

Definition at line 495 of file cssparser.cc.

References bufptr.

Referenced by nextToken(), and skipString().

Member Data Documentation

◆ baseUrl

const DilloUrl* CssParser::baseUrl
private

Definition at line 18 of file cssparser.hh.

Referenced by CssParser(), parse(), parseDeclarationBlock(), parseImport(), and parseUrl().

◆ buf

const char* CssParser::buf
private

Definition at line 20 of file cssparser.hh.

Referenced by CssParser(), getChar(), parse(), and parseDeclarationBlock().

◆ buflen

int CssParser::buflen
private

Definition at line 21 of file cssparser.hh.

Referenced by CssParser(), getChar(), parse(), and parseDeclarationBlock().

◆ bufptr

int CssParser::bufptr
private

Definition at line 21 of file cssparser.hh.

Referenced by CssParser(), getChar(), and ungetChar().

◆ context

CssContext* CssParser::context
private

Definition at line 16 of file cssparser.hh.

Referenced by CssParser(), parse(), and parseRuleset().

◆ maxStrLen

const int CssParser::maxStrLen = 256
staticprivate

Definition at line 15 of file cssparser.hh.

Referenced by nextToken().

◆ origin

CssOrigin CssParser::origin
private

Definition at line 17 of file cssparser.hh.

Referenced by CssParser(), parse(), and parseRuleset().

◆ spaceSeparated

bool CssParser::spaceSeparated
private

Definition at line 26 of file cssparser.hh.

Referenced by CssParser(), nextToken(), parseSelector(), parseSimpleSelector(), and parseValue().

◆ ttype

◆ tval

◆ withinBlock

bool CssParser::withinBlock
private

Definition at line 25 of file cssparser.hh.

Referenced by CssParser(), nextToken(), parseDeclarationBlock(), and parseRuleset().


The documentation for this class was generated from the following files: