Dillo v3.1.1-46-g8a360e32
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 457 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 476 of file cssparser.cc.

References buf, buflen, and bufptr.

Referenced by nextToken(), and skipString().

◆ ignoreBlock()

void CssParser::ignoreBlock ( )
private

Definition at line 1715 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 1735 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 845 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 812 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 1199 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 1710 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 505 of file cssparser.cc.

References getChar(), and ungetChar().

Referenced by nextToken().

◆ tokenMatchesProperty()

◆ ungetChar()

void CssParser::ungetChar ( )
private

Undoes the last getChar().

Definition at line 494 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: