cr-declaration.c revision b4d15a07e08b1e7fbdc1834f7e85323a7450de19
/* -*- Mode: C; indent-tabs-mode: ni; 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"
/**
*@file
*The definition of the #CRDeclaration class.
*/
/**
*Dumps (serializes) one css declaration to a file.
*@param a_this the current instance of #CRDeclaration.
*@param a_fp the destination file pointer.
*@param a_indent the number of indentation white char.
*/
static void
{
if (str) {
}
}
/**
*Constructor of #CRDeclaration.
*@param a_property the property string of the declaration
*@param a_value the value expression of the declaration.
*@return the newly built instance of #CRDeclaration, or NULL in
*case of error.
*/
{
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;
}
/**
*Parses a text buffer that contains
*a css declaration.
*
*@param a_statement the parent css2 statement of this
*this declaration. Must be non NULL and of type
*RULESET_STMT (must be a ruleset).
*@param a_str the string that contains the statement.
*@param a_enc the encoding of a_str.
*@return 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;
}
/**
*Parses a ';' separated list of properties declaration.
*@param a_str the input buffer that contains the list of declaration to
*parse.
*@param a_enc the encoding of a_str
*@return 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 {
break;
}
if (status == CR_END_OF_INPUT_ERROR) {
}
break;
}
if (cur_decl) {
} else {
break;
}
}
if (parser) {
}
if (property) {
}
if (value) {
}
}
return result;
}
/**
*Appends a new declaration to the current declarations list.
*@param a_this the current declaration list.
*@param a_new the declaration to append.
*@return the declaration list with a_new appended to it, or NULL
*in case of error.
*/
{
if (!a_this)
return a_new;
return a_this;
}
/**
*Unlinks the declaration from the declaration list.
*@param a_decl the declaration to unlink.
*@return a pointer to the unlinked declaration in
*case of a successfull completion, NULL otherwise.
*/
{
/*
*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;
}
/**
*prepends a declaration to the current declaration list.
*@param a_this the current declaration list.
*@param a_new the declaration to prepend.
*@return the list with a_new prepended or NULL in case of error.
*/
{
if (!a_this)
return a_new;
return cur;
}
/**
*Appends a declaration to the current declaration list.
*@param a_this the current declaration list.
*@param a_prop the property string of the declaration to append.
*@param a_value the value of the declaration to append.
*@return the list with the new property appended to it, or NULL in
*case of an error.
*/
{
if (a_this) {
} else {
}
}
/**
*Dumps a declaration list to a file.
*@param a_this the current instance of #CRDeclaration.
*@param a_fp the destination file.
*@param a_indent the number of indentation white char.
*/
void
{
if (a_one_per_line == TRUE)
else
}
}
}
/**
*Dumps the first declaration of the declaration list to a file.
*@param a_this the current instance of #CRDeclaration.
*@param a_fp the destination file.
*@param a_indent the number of indentation white char.
*/
void
{
}
/**
*Serializes the declaration into a string
*@param a_this the current instance of #CRDeclaration.
*@param a_indent the number of indentation white char
*to put before the actual serialisation.
*/
gchar *
{
if (str) {
a_indent);
} else
goto error;
if (value_str) {
} else
goto error;
}
"!important");
}
}
}
return result;
if (stringue) {
}
if (str) {
}
return result;
}
/**
*Serializes the declaration list into a string
*@param a_this the current instance of #CRDeclaration.
*@param a_indent the number of indentation white char
*to put before the actual serialisation.
*/
guchar *
{
if (str) {
} else
break;
}
}
}
/**
*Serializes the declaration list into a string
*@param a_this the current instance of #CRDeclaration.
*@param a_indent the number of indentation white char
*to put before the actual serialisation.
*/
guchar *
{
if (str) {
if (a_one_decl_per_line == TRUE) {
"%s;\n", str);
else
str);
} else {
"%s;", str);
else
str);
}
} else
break;
}
}
}
/**
*Return the number of properties in the declaration;
*@param a_this the current instance of #CRDeclaration.
*@return number of properties in the declaration list.
*/
{
int nr = 0;
nr++;
return nr;
}
/**
*Use an index to get a CRDeclaration from the declaration list.
*@param a_this the current instance of #CRDeclaration.
*@param itemnr the index into the declaration list.
*@return CRDeclaration at position itemnr, if itemnr > number of declarations - 1,
*it will return NULL.
*/
{
int nr = 0;
return cur;
return NULL;
}
/**
*Use property name to get a CRDeclaration from the declaration list.
*@param a_this the current instance of #CRDeclaration.
*@param a_prop the property name to search for.
*@return CRDeclaration with property name a_prop, or NULL if not found.
*/
{
(char *)a_prop)) {
return cur;
}
}
}
return NULL;
}
/**
*Increases the ref count of the current instance of #CRDeclaration.
*@param a_this the current instance of #CRDeclaration.
*/
void
{
}
/**
*Decrements the ref count of the current instance of #CRDeclaration.
*If the ref count reaches zero, the current instance of #CRDeclaration
*if destroyed.
*@param a_this the current instance of #CRDeclaration.
*@return TRUE if the current instance of #CRDeclaration has been destroyed
*(ref count reached zero), FALSE otherwise.
*/
{
}
return TRUE;
}
return FALSE;
}
/**
*Destructor of the declaration list.
*@param a_this the current instance of #CRDeclaration.
*/
void
{
/*
*Go get the tail of the list.
*/
}
}
}
if (cur) {
}
}
}
/*in case the list contains only one element */
return;
}
/*walk backward the list and free each "next" element */
}
}
if (!cur)
return;
}
}