libcss
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
parse.h File Reference
#include <libwapcaplet/libwapcaplet.h>
#include <parserutils/utils/vector.h>
#include <libcss/errors.h>
#include <libcss/functypes.h>
#include <libcss/types.h>

Go to the source code of this file.

Classes

union  css_parser_optparams
 

Typedefs

typedef struct css_parser css_parser
 
typedef enum css_parser_event css_parser_event
 
typedef css_error(* css_parser_event_handler) (css_parser_event type, const parserutils_vector *tokens, void *pw)
 
typedef enum css_parser_opttype css_parser_opttype
 
typedef union css_parser_optparams css_parser_optparams
 

Enumerations

enum  css_parser_event {
  CSS_PARSER_START_STYLESHEET , CSS_PARSER_END_STYLESHEET , CSS_PARSER_START_RULESET , CSS_PARSER_END_RULESET ,
  CSS_PARSER_START_ATRULE , CSS_PARSER_END_ATRULE , CSS_PARSER_START_BLOCK , CSS_PARSER_END_BLOCK ,
  CSS_PARSER_BLOCK_CONTENT , CSS_PARSER_END_BLOCK_CONTENT , CSS_PARSER_DECLARATION
}
 
enum  css_parser_opttype { CSS_PARSER_QUIRKS , CSS_PARSER_EVENT_HANDLER }
 

Functions

css_error css__parser_create (const char *charset, css_charset_source cs_source, css_parser **parser)
 
css_error css__parser_create_for_inline_style (const char *charset, css_charset_source cs_source, css_parser **parser)
 
css_error css__parser_create_for_media_query (const char *charset, css_charset_source cs_source, css_parser **parser)
 
css_error css__parser_destroy (css_parser *parser)
 
css_error css__parser_setopt (css_parser *parser, css_parser_opttype type, css_parser_optparams *params)
 
css_error css__parser_parse_chunk (css_parser *parser, const uint8_t *data, size_t len)
 
css_error css__parser_completed (css_parser *parser)
 
const char * css__parser_read_charset (css_parser *parser, css_charset_source *source)
 
bool css__parser_quirks_permitted (css_parser *parser)
 

Typedef Documentation

◆ css_parser

typedef struct css_parser css_parser

◆ css_parser_event

Parser event types

◆ css_parser_event_handler

typedef css_error(* css_parser_event_handler) (css_parser_event type, const parserutils_vector *tokens, void *pw)

◆ css_parser_optparams

Parser option parameters

◆ css_parser_opttype

Parser option types

Enumeration Type Documentation

◆ css_parser_event

Parser event types

Enumerator
CSS_PARSER_START_STYLESHEET 
CSS_PARSER_END_STYLESHEET 
CSS_PARSER_START_RULESET 
CSS_PARSER_END_RULESET 
CSS_PARSER_START_ATRULE 
CSS_PARSER_END_ATRULE 
CSS_PARSER_START_BLOCK 
CSS_PARSER_END_BLOCK 
CSS_PARSER_BLOCK_CONTENT 
CSS_PARSER_END_BLOCK_CONTENT 
CSS_PARSER_DECLARATION 

◆ css_parser_opttype

Parser option types

Enumerator
CSS_PARSER_QUIRKS 
CSS_PARSER_EVENT_HANDLER 

Function Documentation

◆ css__parser_completed()

css_error css__parser_completed ( css_parser parser)

Inform a CSS parser that all data has been received.

Parameters
parserThe parser to inform
Returns
CSS_OK on success, appropriate error otherwise

◆ css__parser_create()

css_error css__parser_create ( const char *  charset,
css_charset_source  cs_source,
css_parser **  parser 
)

Create a CSS parser

Parameters
charsetCharset of data, if known, or NULL
cs_sourceSource of charset information, or CSS_CHARSET_DEFAULT
parserPointer to location to receive parser instance
Returns
CSS_OK on success, CSS_BADPARM on bad parameters, CSS_NOMEM on memory exhaustion

◆ css__parser_create_for_inline_style()

css_error css__parser_create_for_inline_style ( const char *  charset,
css_charset_source  cs_source,
css_parser **  parser 
)

Create a CSS parser for an inline style

Parameters
charsetCharset of data, if known, or NULL
cs_sourceSource of charset information, or CSS_CHARSET_DEFAULT
parserPointer to location to receive parser instance
Returns
CSS_OK on success, CSS_BADPARM on bad parameters, CSS_NOMEM on memory exhaustion

◆ css__parser_create_for_media_query()

css_error css__parser_create_for_media_query ( const char *  charset,
css_charset_source  cs_source,
css_parser **  parser 
)

Create a CSS parser for a media query

Parameters
charsetCharset of data, if known, or NULL
cs_sourceSource of charset information, or CSS_CHARSET_DEFAULT
parserPointer to location to receive parser instance
Returns
CSS_OK on success, CSS_BADPARM on bad parameters, CSS_NOMEM on memory exhaustion

◆ css__parser_destroy()

css_error css__parser_destroy ( css_parser parser)

Destroy a CSS parser

Parameters
parserThe parser instance to destroy
Returns
CSS_OK on success, appropriate error otherwise

◆ css__parser_parse_chunk()

css_error css__parser_parse_chunk ( css_parser parser,
const uint8_t *  data,
size_t  len 
)

Parse a chunk of data using a CSS parser

Parameters
parserThe parser to use
dataPointer to the chunk to parse
lenLength of chunk
Returns
CSS_OK on success, appropriate error otherwise

◆ css__parser_quirks_permitted()

bool css__parser_quirks_permitted ( css_parser parser)

Quirks permitted when parsing

Parameters
parserParser to query
Returns
True if quirks permitted, false otherwise

◆ css__parser_read_charset()

const char * css__parser_read_charset ( css_parser parser,
css_charset_source source 
)

Retrieve document charset information from a CSS parser

Parameters
parserThe parser instance
sourcePointer to location to receive charset source
Returns
Pointer to charset name (constant; do not free)

◆ css__parser_setopt()

css_error css__parser_setopt ( css_parser parser,
css_parser_opttype  type,
css_parser_optparams params 
)

Configure a CSS parser

Parameters
parserThe parser instance to configure
typeThe option to configure
paramsOption-specific data
Returns
CSS_OK on success, appropriate error otherwise