diff options
author | Dodji Seketeli <dodji@gnome.org> | 2004-02-14 00:32:34 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@src.gnome.org> | 2004-02-14 00:32:34 +0000 |
commit | cb6a50718eeb9ea9ad59fbbd793c44d9d4519860 (patch) | |
tree | 6be5134b1136edb56505063a5e322e054c97ca93 | |
parent | 7e0fccbf68db9dc79f502a2c5685718194404d60 (diff) | |
download | libcroco-cb6a50718eeb9ea9ad59fbbd793c44d9d4519860.tar.gz |
applied a patch from Rob BUIS<rwlbuis@xs4all.nl> that adds these api entry
2004-02-14 Dodji Seketeli <dodji@gnome.org>
* src/cr-declaration.[ch]:
(cr_declaration_nr_props),
(cr_declaration_get_from_list),
(cr_declaration_get_by_prop_name):
applied a patch from Rob BUIS<rwlbuis@xs4all.nl> that adds
these api entry points.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/cr-declaration.c | 59 | ||||
-rw-r--r-- | src/cr-declaration.h | 9 |
3 files changed, 77 insertions, 0 deletions
@@ -1,3 +1,12 @@ +2004-02-14 Dodji Seketeli <dodji@gnome.org> + + * src/cr-declaration.[ch]: + (cr_declaration_nr_props), + (cr_declaration_get_from_list), + (cr_declaration_get_by_prop_name): + applied a patch from Rob BUIS<rwlbuis@xs4all.nl> that adds + these api entry points. + 2004-02-13 Dodji Seketeli <dodji@gnome.org> * src/cr-declaration.c: diff --git a/src/cr-declaration.c b/src/cr-declaration.c index aee63a8..925e758 100644 --- a/src/cr-declaration.c +++ b/src/cr-declaration.c @@ -603,6 +603,65 @@ cr_declaration_to_string (CRDeclaration *a_this, } /** + *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 +cr_declaration_nr_props (CRDeclaration *a_this) +{ + CRDeclaration *cur = NULL ; + int nr = 0; + + g_return_if_fail (a_this) ; + + for (cur = a_this ; cur ; cur = cur->next) + 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. + */ +CRDeclaration * +cr_declaration_get_from_list (CRDeclaration *a_this, int itemnr) +{ + CRDeclaration *cur = NULL ; + int nr = 0; + + g_return_if_fail (a_this) ; + + for (cur = a_this ; cur ; cur = cur->next) + if (nr++ == itemnr) + 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. + */ +CRDeclaration * +cr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_prop) +{ + CRDeclaration *cur = NULL ; + + g_return_if_fail (a_this) ; + g_return_if_fail (a_prop) ; + + for (cur = a_this ; cur ; cur = cur->next) + if (!strcmp (cur->property->str, a_prop)) + return cur; + return NULL; +} + +/** *Increases the ref count of the current instance of #CRDeclaration. *@param a_this the current instance of #CRDeclaration. */ diff --git a/src/cr-declaration.h b/src/cr-declaration.h index c96c551..a423495 100644 --- a/src/cr-declaration.h +++ b/src/cr-declaration.h @@ -100,6 +100,15 @@ void cr_declaration_dump (CRDeclaration *a_this, FILE *a_fp, glong a_indent, gboolean a_one_per_line) ; +int +cr_declaration_nr_props (CRDeclaration *a_this) ; + +CRDeclaration * +cr_declaration_get_from_list (CRDeclaration *a_this, int itemnr) ; + +CRDeclaration * +cr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_str) ; + guchar * cr_declaration_to_string (CRDeclaration *a_this, gulong a_indent) ; |