Beispiel #1
0
gboolean
cr_stylesheet_unref (CRStyleSheet * a_this)
{
        g_return_val_if_fail (a_this, FALSE);

        if (a_this->ref_count)
                a_this->ref_count--;

        if (!a_this->ref_count) {
                cr_stylesheet_destroy (a_this);
                return TRUE;
        }

        return FALSE;
}
Beispiel #2
0
static void
destroy_context (ParsingContext * a_ctxt)
{
        g_return_if_fail (a_ctxt);

        if (a_ctxt->stylesheet) {
                cr_stylesheet_destroy (a_ctxt->stylesheet);
                a_ctxt->stylesheet = NULL;
        }
        if (a_ctxt->cur_stmt) {
                cr_statement_destroy (a_ctxt->cur_stmt);
                a_ctxt->cur_stmt = NULL;
        }
        g_free (a_ctxt);
}
/**
 *The test of the cr_input_read_byte() method.
 *Reads the each byte of a_file_uri using the
 *cr_input_read_byte() method. Each byte is send to
 *stdout.
 *@param a_file_uri the file to read.
 *@return CR_OK upon successfull completion of the
 *function, an error code otherwise.
 */
static enum CRStatus
test_cr_parser_parse (guchar * a_file_uri)
{
        enum CRStatus status = CR_OK;
        CROMParser *parser = NULL;
        CRStyleSheet *stylesheet = NULL;

        g_return_val_if_fail (a_file_uri, CR_BAD_PARAM_ERROR);

        parser = cr_om_parser_new (NULL);
        status = cr_om_parser_parse_file (parser, a_file_uri, CR_ASCII,
                                          &stylesheet);
        if (status == CR_OK && stylesheet) {
                cr_stylesheet_dump (stylesheet, stdout);
                cr_stylesheet_destroy (stylesheet);
        }
        cr_om_parser_destroy (parser);

        return status;
}
/**
 *The test of the cr_input_read_byte() method.
 *Reads the each byte of a_file_uri using the
 *cr_input_read_byte() method. Each byte is send to
 *stdout.
 *@param a_file_uri the file to read.
 *@return CR_OK upon successfull completion of the
 *function, an error code otherwise.
 */
static enum CRStatus
test_cr_parser_parse (void)
{
        enum CRStatus status = CR_OK;
        CROMParser *parser = NULL;
        CRStyleSheet *stylesheet = NULL;

        parser = cr_om_parser_new (NULL);
        status = cr_om_parser_parse_buf (parser, (guchar *) gv_cssbuf,
                                         strlen (gv_cssbuf),
                                         CR_ASCII, &stylesheet);

        if (status == CR_OK && stylesheet) {
                cr_stylesheet_dump (stylesheet, stdout);
                cr_stylesheet_destroy (stylesheet);
        }
        cr_om_parser_destroy (parser);

        return status;
}