libgsf r987 - in trunk: . doc/tmpl gsf
- From: jody svn gnome org
- To: svn-commits-list gnome org
- Subject: libgsf r987 - in trunk: . doc/tmpl gsf
- Date: Mon, 30 Jun 2008 23:38:45 +0000 (UTC)
Author: jody
Date: Mon Jun 30 23:38:44 2008
New Revision: 987
URL: http://svn.gnome.org/viewvc/libgsf?rev=987&view=rev
Log:
2008-06-30 Jody Goldberg <jody gnome org>
* gsf/gsf-infile.c (gsf_infile_child_by_aname) : new.
(gsf_infile_child_by_vaname) : new.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/doc/tmpl/infile.sgml
trunk/gsf/gsf-infile.c
trunk/gsf/gsf-infile.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Mon Jun 30 23:38:44 2008
@@ -5,6 +5,7 @@
Jody:
* Add MS OOX support to gsf-vba-dump.
+ * Extend the utility wrappers for GsfInfile.
Morten:
* Use g_base64_-routines from glib when available.
Modified: trunk/doc/tmpl/infile.sgml
==============================================================================
--- trunk/doc/tmpl/infile.sgml (original)
+++ trunk/doc/tmpl/infile.sgml Mon Jun 30 23:38:44 2008
@@ -58,7 +58,6 @@
</para>
@infile:
- name:
@Varargs:
@Returns:
Modified: trunk/gsf/gsf-infile.c
==============================================================================
--- trunk/gsf/gsf-infile.c (original)
+++ trunk/gsf/gsf-infile.c Mon Jun 30 23:38:44 2008
@@ -120,30 +120,80 @@
/**
* gsf_infile_child_by_vname :
* @infile :
- * @name : A %null terminated list of names
- * @Varargs : the rest of the names
+ * @Varargs : A %NULL terminated list of names
*
* Returns: a newly created child which must be unrefed.
**/
GsfInput *
-gsf_infile_child_by_vname (GsfInfile *infile, char const *name, ...)
+gsf_infile_child_by_vname (GsfInfile *infile, ...)
+{
+ GsfInput *res;
+ va_list names;
+
+ va_start (names, infile);
+ res = gsf_infile_child_by_vaname (infile, names);
+ va_end (names);
+
+ return res;
+}
+
+/**
+ * gsf_infile_child_by_vaname :
+ * @infile : #GsfInfile
+ * @names : A %NULL terminated array of names (e.g. from g_strsplit)
+ *
+ * New in 1.14.9.
+ *
+ * Returns: a newly created child which must be unrefed.
+ **/
+GsfInput *
+gsf_infile_child_by_vaname (GsfInfile *infile, va_list names)
{
- va_list ap;
GsfInput *child = GSF_INPUT (infile);
GsfInfile *tmp = NULL;
+ char const *name;
g_return_val_if_fail (GSF_IS_INFILE (infile), NULL);
- g_return_val_if_fail (name != NULL, NULL);
- va_start (ap, name);
- while (1) {
+ while (NULL != (name = va_arg (names, char const *))) {
child = gsf_infile_child_by_name (infile, name);
+ if (child == NULL)
+ break;
+ if (tmp != NULL)
+ g_object_unref (G_OBJECT (tmp));
+
+ g_return_val_if_fail (GSF_IS_INFILE (child), NULL);
+
+ infile = tmp = GSF_INFILE (child);
+ }
+ if (tmp != NULL)
+ g_object_unref (G_OBJECT (tmp));
+
+ return child;
+}
+
+/**
+ * gsf_infile_child_by_aname :
+ * @infile : #GsfInfile
+ * @names : A %NULL terminated array of names (e.g. from g_strsplit)
+ *
+ * New in 1.14.9.
+ *
+ * Returns: a newly created child which must be unrefed.
+ **/
+GsfInput *
+gsf_infile_child_by_aname (GsfInfile *infile, char const *names[])
+{
+ GsfInput *child = GSF_INPUT (infile);
+ GsfInfile *tmp = NULL;
+
+ g_return_val_if_fail (GSF_IS_INFILE (infile), NULL);
+ g_return_val_if_fail (names != NULL, NULL);
- name = va_arg (ap, char *);
+ for (;*names ; names++) {
+ child = gsf_infile_child_by_name (infile, *names);
if (tmp != NULL)
g_object_unref (G_OBJECT (tmp));
- if (name == NULL)
- break;
if (child == NULL)
break;
@@ -151,7 +201,6 @@
infile = tmp = GSF_INFILE (child);
}
- va_end (ap);
return child;
}
Modified: trunk/gsf/gsf-infile.h
==============================================================================
--- trunk/gsf/gsf-infile.h (original)
+++ trunk/gsf/gsf-infile.h Mon Jun 30 23:38:44 2008
@@ -34,11 +34,13 @@
GType gsf_infile_get_type (void) G_GNUC_CONST;
/* void gsf_infile_register_type (GTypeModule *module); glib dynamic types are not thread safe */
-int gsf_infile_num_children (GsfInfile *infile);
-char const *gsf_infile_name_by_index (GsfInfile *infile, int i);
-GsfInput *gsf_infile_child_by_index (GsfInfile *infile, int i);
-GsfInput *gsf_infile_child_by_name (GsfInfile *infile, char const *name);
-GsfInput *gsf_infile_child_by_vname (GsfInfile *infile, char const *name, ...);
+int gsf_infile_num_children (GsfInfile *infile);
+char const *gsf_infile_name_by_index (GsfInfile *infile, int i);
+GsfInput *gsf_infile_child_by_index (GsfInfile *infile, int i);
+GsfInput *gsf_infile_child_by_name (GsfInfile *infile, char const *name);
+GsfInput *gsf_infile_child_by_vname (GsfInfile *infile, ...);
+GsfInput *gsf_infile_child_by_aname (GsfInfile *infile, char const *name[]);
+GsfInput *gsf_infile_child_by_vaname (GsfInfile *infile, va_list names);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]