/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli.
* See COPYRIGHTS file for copyright information.
*/
#include <string.h>
#include "cr-declaration.h"
#include "cr-statement.h"
#include "cr-parser.h"
/**
*@CRDeclaration:
*
*The definition of the #CRDeclaration class.
*/
/**
* dump:
*@a_this: the current instance of #CRDeclaration.
*@a_fp: the destination file pointer.
*@a_indent: the number of indentation white char.
*
*Dumps (serializes) one css declaration to a file.
*/
static void
{
if (str) {
}
}
/**
* cr_declaration_new:
* @a_statement: the statement this declaration belongs to. can be NULL.
*@a_property: the property string of the declaration
*@a_value: the value expression of the declaration.
*Constructor of #CRDeclaration.
*
*Returns the newly built instance of #CRDeclaration, or NULL in
*case of error.
*
*The returned CRDeclaration takes ownership of @a_property and @a_value.
*(E.g. cr_declaration_destroy on this CRDeclaration will also free
*@a_property and @a_value.)
*/
{
if (a_statement)
|| (a_statement->type
|| (a_statement->type
== AT_PAGE_RULE_STMT)), NULL);
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
}
if (a_value) {
}
return result;
}
/**
* cr_declaration_parse_from_buf:
*@a_statement: the parent css2 statement of this
*this declaration. Must be non NULL and of type
*RULESET_STMT (must be a ruleset).
*@a_str: the string that contains the statement.
*@a_enc: the encoding of a_str.
*
*Parses a text buffer that contains
*a css declaration.
*Returns the parsed declaration, or NULL in case of error.
*/
{
if (a_statement)
NULL);
goto cleanup;
goto cleanup;
if (result) {
}
if (parser) {
}
if (property) {
}
if (value) {
}
return result;
}
/**
* cr_declaration_parse_list_from_buf:
*@a_str: the input buffer that contains the list of declaration to
*parse.
*@a_enc: the encoding of a_str
*
*Parses a ';' separated list of properties declaration.
*Returns the parsed list of declaration, NULL if parsing failed.
*/
enum CREncoding a_enc)
{
goto cleanup;
}
goto cleanup;
goto cleanup;
}
if (result) {
}
/*now, go parse the other declarations */
for (;;) {
guint32 c = 0;
if (status == CR_END_OF_INPUT_ERROR)
goto cleanup;
}
if (c == ';') {
} else {
cr_tknzr_read_char (tokenizer, &c);
continue; // try to keep reading until we reach the end or a ;
}
if (status == CR_END_OF_INPUT_ERROR) {
break;
} else {
continue; // even if one declaration is broken, it's no reason to discard others (see http://www.w3.org/TR/CSS21/syndata.html#declaration)
}
}
if (cur_decl) {
} else {
break;
}
}
if (parser) {
}
if (property) {
}
if (value) {
}
}
return result;
}
/**
* cr_declaration_append:
*@a_this: the current declaration list.
*@a_new: the declaration to append.
*
*Appends a new declaration to the current declarations list.
*Returns the declaration list with a_new appended to it, or NULL
*in case of error.
*/
{
if (!a_this)
return a_new;
return a_this;
}
/**
* cr_declaration_unlink:
*@a_decls: the declaration to unlink.
*
*Unlinks the declaration from the declaration list.
*case of a successfull completion, NULL otherwise.
*
*Returns a pointer to the unlinked declaration in
*/
{
/*
*some sanity checks first
*/
}
}
/*
*now, the real unlinking job.
*/
}
}
if (a_decl->parent_statement) {
case RULESET_STMT:
}
break;
case AT_FONT_FACE_RULE_STMT:
}
break;
case AT_PAGE_RULE_STMT:
}
default:
break;
}
}
return result;
}
/**
* cr_declaration_prepend:
* @a_this: the current declaration list.
* @a_new: the declaration to prepend.
*
* prepends a declaration to the current declaration list.
*
* Returns the list with a_new prepended or NULL in case of error.
*/
{
if (!a_this)
return a_new;
return cur;
}
/**
* cr_declaration_append2:
*@a_this: the current declaration list.
*@a_prop: the property string of the declaration to append.
*@a_value: the value of the declaration to append.
*
*Appends a declaration to the current declaration list.
*Returns the list with the new property appended to it, or NULL in
*case of an error.
*/
{
if (a_this) {
} else {
}
}
/**
* cr_declaration_dump:
*@a_this: the current instance of #CRDeclaration.
*@a_fp: the destination file.
*@a_indent: the number of indentation white char.
*@a_one_per_line: whether to put one declaration per line of not .
*
*
*Dumps a declaration list to a file.
*/
void
{
if (a_one_per_line == TRUE)
else
}
}
}
/**
* cr_declaration_dump_one:
*@a_this: the current instance of #CRDeclaration.
*@a_fp: the destination file.
*@a_indent: the number of indentation white char.
*
*Dumps the first declaration of the declaration list to a file.
*/
void
{
}
/**
* cr_declaration_to_string:
*@a_this: the current instance of #CRDeclaration.
*@a_indent: the number of indentation white char
*to put before the actual serialisation.
*
*Serializes the declaration into a string
*Returns the serialized form the declaration. The caller must
*free the string using g_free().
*/
gchar *
{
if (str) {
a_indent);
} else
goto error;
if (value_str) {
} else
goto error;
}
"!important");
}
}
}
return result;
if (stringue) {
}
if (str) {
}
return result;
}
/**
* cr_declaration_list_to_string:
*@a_this: the current instance of #CRDeclaration.
*@a_indent: the number of indentation white char
*to put before the actual serialisation.
*
*Serializes the declaration list into a string
*/
guchar *
{
if (str) {
} else
break;
}
}
return result;
}
/**
* cr_declaration_list_to_string2:
*@a_this: the current instance of #CRDeclaration.
*@a_indent: the number of indentation white char
*@a_one_decl_per_line: whether to output one doc per line or not.
*to put before the actual serialisation.
*
*Serializes the declaration list into a string
*Returns the serialized form the declararation.
*/
guchar *
{
if (str) {
if (a_one_decl_per_line == TRUE) {
"%s;\n", str);
else
} else {
"%s;", str);
else
}
} else
break;
}
}
return result;
}
/**
* cr_declaration_nr_props:
*@a_this: the current instance of #CRDeclaration.
*Return the number of properties in the declaration
*/
{
int nr = 0;
nr++;
return nr;
}
/**
* cr_declaration_get_from_list:
*@a_this: the current instance of #CRDeclaration.
*@itemnr: the index into the declaration list.
*
*Use an index to get a CRDeclaration from the declaration list.
*
*Returns #CRDeclaration at position itemnr,
*if itemnr > number of declarations - 1,
*it will return NULL.
*/
{
int nr = 0;
return cur;
return NULL;
}
/**
* cr_declaration_get_by_prop_name:
*@a_this: the current instance of #CRDeclaration.
*@a_prop: the property name to search for.
*
*Use property name to get a CRDeclaration from the declaration list.
*Returns #CRDeclaration with property name a_prop, or NULL if not found.
*/
{
(const char *) a_prop)) {
return cur;
}
}
}
return NULL;
}
/**
* cr_declaration_ref:
*@a_this: the current instance of #CRDeclaration.
*
*Increases the ref count of the current instance of #CRDeclaration.
*/
void
{
}
/**
* cr_declaration_unref:
*@a_this: the current instance of #CRDeclaration.
*
*Decrements the ref count of the current instance of #CRDeclaration.
*If the ref count reaches zero, the current instance of #CRDeclaration
*if destroyed.
*Returns TRUE if @a_this was destroyed (ref count reached zero),
*FALSE otherwise.
*/
{
}
return TRUE;
}
return FALSE;
}
/**
* cr_declaration_destroy:
*@a_this: the current instance of #CRDeclaration.
*
*Destructor of the declaration list.
*/
void
{
/*
* Go to the last element of the list.
*/
/*
* Walk backward the list and free each "next" element.
*/
}
}
}
}