Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

cr-term.c File Reference

Definition of the #CRTem class. More...

#include <stdio.h>
#include <string.h>
#include "cr-term.h"
#include "cr-num.h"
#include "cr-parser.h"

Go to the source code of this file.

Functions

CRTermcr_term_new (void)
 Instanciate a CRTerm.

CRTermcr_term_parse_expression_from_buf (const guchar *a_buf, enum CREncoding a_encoding)
 Parses an expresion as defined by the css2 spec and builds the expression as a list of terms.

enum CRStatus cr_term_set_number (CRTerm *a_this, CRNum *a_num)
enum CRStatus cr_term_set_function (CRTerm *a_this, GString *a_func_name, CRTerm *a_func_param)
enum CRStatus cr_term_set_string (CRTerm *a_this, GString *a_str)
enum CRStatus cr_term_set_ident (CRTerm *a_this, GString *a_str)
enum CRStatus cr_term_set_uri (CRTerm *a_this, GString *a_str)
enum CRStatus cr_term_set_rgb (CRTerm *a_this, CRRgb *a_rgb)
enum CRStatus cr_term_set_hash (CRTerm *a_this, GString *a_str)
CRTermcr_term_append_term (CRTerm *a_this, CRTerm *a_new_term)
 Appends a new term to the current list of CRTerm.

CRTermcr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term)
 Prepends a term to the list of terms represented by a_this.

guchar * cr_term_to_string (CRTerm *a_this)
 Serializes the expression represented by the chained instances of #CRterm.

void cr_term_dump (CRTerm *a_this, FILE *a_fp)
 Dumps the expression (a list of terms connected by operators) to a file.

void cr_term_ref (CRTerm *a_this)
 Increments the reference counter of the current instance of CRTerm.*.

gboolean cr_term_unref (CRTerm *a_this)
 Decrements the ref count of the current instance of CRTerm.

void cr_term_destroy (CRTerm *a_this)
 The destructor of the the CRTerm class.


Detailed Description

Definition of the #CRTem class.

Definition in file cr-term.c.


Function Documentation

CRTerm* cr_term_append_term CRTerm a_this,
CRTerm a_new_term
 

Appends a new term to the current list of CRTerm.

Parameters:
a_this the "this pointer" of the current instance of CRTerm .
a_new_term the term to append.
Returns:
the list of terms with the a_new_term appended to it.

Definition at line 257 of file cr-term.c.

References _CRTerm::next, and _CRTerm::prev.

Referenced by cr_parser_parse_declaration(), and cr_parser_parse_expr().

void cr_term_destroy CRTerm a_this  ) 
 

The destructor of the the CRTerm class.

Parameters:
a_this the "this pointer" of the current instance of CRTerm.

Definition at line 602 of file cr-term.c.

References _CRTerm::next.

Referenced by cr_declaration_destroy(), cr_declaration_parse_from_buf(), cr_parser_parse_declaration(), cr_parser_parse_expr(), cr_parser_parse_font_face(), cr_parser_parse_page(), cr_term_parse_expression_from_buf(), and cr_term_unref().

void cr_term_dump CRTerm a_this,
FILE *  a_fp
 

Dumps the expression (a list of terms connected by operators) to a file.

TODO: finish the dump. The dump of some type of terms have not yet been implemented.

Parameters:
a_this the current instance of CRTerm.
a_fp the destination file pointer.

Definition at line 540 of file cr-term.c.

References cr_term_to_string().

CRTerm* cr_term_new void   ) 
 

Instanciate a CRTerm.

Returns:
the newly build instance of CRTerm.

Definition at line 94 of file cr-term.c.

References cr_utils_trace_info.

CRTerm* cr_term_parse_expression_from_buf const guchar *  a_buf,
enum CREncoding  a_encoding
 

Parses an expresion as defined by the css2 spec and builds the expression as a list of terms.

Parameters:
a_buf the buffer to parse.
Returns:
a pointer to the first term of the expression or NULL if parsing failed.

Definition at line 116 of file cr-term.c.

References CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_expr(), cr_parser_try_to_skip_spaces_and_comments(), cr_term_destroy(), and CRStatus.

CRTerm* cr_term_prepend_term CRTerm a_this,
CRTerm a_new_term
 

Prepends a term to the list of terms represented by a_this.

Parameters:
a_this the "this pointer" of the current instance of CRTerm .
a_new_term the term to prepend.
Returns:
the head of the new list.

Definition at line 285 of file cr-term.c.

References _CRTerm::prev.

void cr_term_ref CRTerm a_this  ) 
 

Increments the reference counter of the current instance of CRTerm.*.

Parameters:
a_this the current instance of CRTerm.

Definition at line 562 of file cr-term.c.

References _CRTerm::ref_count.

Referenced by cr_declaration_new(), cr_parser_parse_font_face(), cr_parser_parse_page(), and cr_parser_parse_ruleset().

enum CRStatus cr_term_set_function CRTerm a_this,
GString *  a_func_name,
CRTerm a_func_param
 

Definition at line 169 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, _CRTerm::ext_content, TERM_FUNCTION, and _CRTerm::type.

enum CRStatus cr_term_set_hash CRTerm a_this,
GString *  a_str
 

Definition at line 236 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, TERM_HASH, and _CRTerm::type.

enum CRStatus cr_term_set_ident CRTerm a_this,
GString *  a_str
 

Definition at line 197 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, TERM_IDENT, and _CRTerm::type.

enum CRStatus cr_term_set_number CRTerm a_this,
CRNum a_num
 

Definition at line 156 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, TERM_NUMBER, and _CRTerm::type.

enum CRStatus cr_term_set_rgb CRTerm a_this,
CRRgb a_rgb
 

Definition at line 223 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, TERM_RGB, and _CRTerm::type.

enum CRStatus cr_term_set_string CRTerm a_this,
GString *  a_str
 

Definition at line 184 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, TERM_STRING, and _CRTerm::type.

enum CRStatus cr_term_set_uri CRTerm a_this,
GString *  a_str
 

Definition at line 210 of file cr-term.c.

References _CRTerm::content, CR_BAD_PARAM_ERROR, CR_OK, TERM_URI, and _CRTerm::type.

guchar* cr_term_to_string CRTerm a_this  ) 
 

Serializes the expression represented by the chained instances of #CRterm.

Parameters:
a_this the current instance of CRTerm
Returns:
the zero terminated string containing the serialized form of CRTerm. MUST BE FREED BY THE CALLER using g_free().

Definition at line 305 of file cr-term.c.

References COMMA, _CRTerm::content, cr_num_to_string(), cr_rgb_to_string(), cr_term_to_string(), DIVIDE, MINUS_UOP, _CRTerm::next, NO_OP, _CRTerm::operator, PLUS_UOP, _CRTerm::prev, TERM_FUNCTION, TERM_HASH, TERM_IDENT, TERM_NUMBER, TERM_RGB, TERM_STRING, TERM_UNICODERANGE, TERM_URI, _CRTerm::type, and _CRTerm::unary_op.

Referenced by cr_declaration_to_string(), cr_term_dump(), and cr_term_to_string().

gboolean cr_term_unref CRTerm a_this  ) 
 

Decrements the ref count of the current instance of CRTerm.

If the ref count reaches zero, the instance is destroyed.

Parameters:
a_this the current instance of CRTerm.
Returns:
TRUE if the current instance has been destroyed, FALSE otherwise.

Definition at line 578 of file cr-term.c.

References cr_term_destroy(), and _CRTerm::ref_count.

Referenced by cr_parser_parse_font_face(), cr_parser_parse_page(), and cr_parser_parse_ruleset().


Generated on Wed Oct 1 01:36:52 2003 for Libcroco by doxygen 1.3.3