Commit 75f761bc authored by Allison Karlitskaya's avatar Allison Karlitskaya

GVariant variable arguments, tests, cleanups

Merge GVariant variable arguments support and put it under tests.

Also, remove the hack of the test case directly '#include'ing .c files
from glib/.  Instead, create a non-installed gvariant-internal.h that
the tests can include and make the symbols in it visible on the symbol
table of the shared library.  These symbols (as they are present in no
installed header files) are not part of the API of GLib.

Increase test coverage in a few other areas.
parent 8cd5c94f
......@@ -121,6 +121,7 @@ synchronize their operation.
<xi:include href="xml/allocators.xml" />
<xi:include href="xml/gvarianttype.xml"/>
<xi:include href="xml/gvariant.xml"/>
<xi:include href="gvariant-varargs.xml"/>
</chapter>
<chapter id="tools">
......
......@@ -2798,6 +2798,12 @@ g_variant_is_container
g_variant_classify
GVariantClass
<SUBSECTION>
g_variant_get
g_variant_get_va
g_variant_new
g_variant_new_va
<SUBSECTION>
g_variant_new_boolean
g_variant_new_byte
......@@ -2844,6 +2850,7 @@ g_variant_new_dict_entry
g_variant_get_maybe
g_variant_n_children
g_variant_get_child_value
g_variant_get_child
g_variant_get_fixed_array
<SUBSECTION>
......@@ -2878,9 +2885,13 @@ g_variant_builder_new
g_variant_builder_init
g_variant_builder_clear
g_variant_builder_add_value
g_variant_builder_add
g_variant_builder_end
g_variant_builder_open
g_variant_builder_close
<SUBSECTION Private>
g_variant_type_checked_
</SECTION>
......
This diff is collapsed.
......@@ -1767,8 +1767,6 @@ g_variant_iter_free
g_variant_iter_init
g_variant_iter_n_children
g_variant_iter_new
g_variant_iter_next
g_variant_iter_loop
g_variant_iter_next_value
g_variant_builder_add_value
......@@ -1780,6 +1778,52 @@ g_variant_builder_end
g_variant_builder_new
g_variant_builder_unref
g_variant_builder_ref
g_variant_new_va
g_variant_get_va
g_variant_new
g_variant_get
g_variant_builder_add
g_variant_get_child
g_variant_iter_next
g_variant_iter_loop
#endif
#endif
#if IN_HEADER(__G_VARIANT_TYPE_INFO_H__)
#if IN_FILE(__G_VARIANT_TYPE_INFO_C__)
g_variant_type_info_get_type_string
g_variant_type_info_query
g_variant_type_info_element
g_variant_type_info_query_element
g_variant_type_info_n_members
g_variant_type_info_member_info
g_variant_type_info_get
g_variant_type_info_ref
g_variant_type_info_unref
g_variant_type_info_assert_no_infos
#endif
#endif
#if IN_HEADER(__G_VARIANT_SERIALISER_H__)
#if IN_FILE(__G_VARIANT_SERIALISER_C__)
g_variant_serialised_byteswap
g_variant_serialised_get_child
g_variant_serialised_is_normal
g_variant_serialised_n_children
g_variant_serialiser_is_object_path
g_variant_serialiser_is_signature
g_variant_serialiser_is_string
g_variant_serialiser_needed_size
g_variant_serialiser_serialise
#endif
#endif
#if IN_HEADER(__G_VARIANT_INTERNAL_H__)
#if IN_FILE(__G_VARIANT_C__)
g_variant_format_string_scan_type
g_variant_format_string_scan
#endif
#endif
......
/*
* Copyright © 2007, 2008 Ryan Lortie
* Copyright © 2009, 2010 Codethink Limited
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the licence, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Ryan Lortie <desrt@desrt.ca>
*/
/* The purpose of this header is to allow certain internal symbols of
* GVariant to be put under test cases.
*/
#ifndef __G_VARIANT_INTERNAL_H__
#define __G_VARIANT_INTERNAL_H__
#ifndef GLIB_COMPILATION
#define GLIB_COMPILATION
#endif
#include <glib/gvarianttype.h>
#include <glib/gtypes.h>
#include "gvariant-serialiser.h"
#include "gvarianttypeinfo.h"
gboolean g_variant_format_string_scan (const gchar *string,
const gchar *limit,
const gchar **endptr);
GVariantType * g_variant_format_string_scan_type (const gchar *string,
const gchar *limit,
const gchar **endptr);
#endif /* __G_VARIANT_INTERNAL_H__ */
......@@ -1654,4 +1654,8 @@ g_variant_serialiser_is_signature (gconstpointer data,
return TRUE;
}
/* Epilogue {{{1 */
#define __G_VARIANT_SERIALISER_C__
#include "galiasdef.c"
/* vim:set foldmethod=marker: */
......@@ -33,9 +33,7 @@ typedef struct
} GVariantSerialised;
/* deserialisation */
G_GNUC_INTERNAL
gsize g_variant_serialised_n_children (GVariantSerialised container);
G_GNUC_INTERNAL
GVariantSerialised g_variant_serialised_get_child (GVariantSerialised container,
gsize index);
......@@ -43,32 +41,25 @@ GVariantSerialised g_variant_serialised_get_child (GVarian
typedef void (*GVariantSerialisedFiller) (GVariantSerialised *serialised,
gpointer data);
G_GNUC_INTERNAL
gsize g_variant_serialiser_needed_size (GVariantTypeInfo *info,
GVariantSerialisedFiller gsv_filler,
const gpointer *children,
gsize n_children);
G_GNUC_INTERNAL
void g_variant_serialiser_serialise (GVariantSerialised container,
GVariantSerialisedFiller gsv_filler,
const gpointer *children,
gsize n_children);
/* misc */
G_GNUC_INTERNAL
gboolean g_variant_serialised_is_normal (GVariantSerialised value);
G_GNUC_INTERNAL
void g_variant_serialised_byteswap (GVariantSerialised value);
/* validation of strings */
G_GNUC_INTERNAL
gboolean g_variant_serialiser_is_string (gconstpointer data,
gsize size);
G_GNUC_INTERNAL
gboolean g_variant_serialiser_is_object_path (gconstpointer data,
gsize size);
G_GNUC_INTERNAL
gboolean g_variant_serialiser_is_signature (gconstpointer data,
gsize size);
......
This diff is collapsed.
......@@ -114,6 +114,10 @@ GVariant * g_variant_new_dict_entry (GVarian
GVariant * g_variant_get_maybe (GVariant *value);
gsize g_variant_n_children (GVariant *value);
void g_variant_get_child (GVariant *value,
gsize index_,
const gchar *format_string,
...);
GVariant * g_variant_get_child_value (GVariant *value,
gsize index_);
gconstpointer g_variant_get_fixed_array (GVariant *value,
......@@ -178,6 +182,20 @@ void g_variant_builder_add (GVarian
const gchar *format_string,
...);
GVariant * g_variant_new (const gchar *format_string,
...);
void g_variant_get (GVariant *value,
const gchar *format_string,
...);
GVariant * g_variant_new_va (const gchar *format_string,
const gchar **endptr,
va_list *app);
void g_variant_get_va (GVariant *value,
const gchar *format_string,
const gchar **endptr,
va_list *app);
G_END_DECLS
#endif /* __G_VARIANT_H__ */
......@@ -861,6 +861,11 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
}
}
/* used from the test cases */
#define assert_no_type_infos() \
g_assert (g_variant_type_info_table == NULL)
void
g_variant_type_info_assert_no_infos (void)
{
g_assert (g_variant_type_info_table == NULL);
}
#define __G_VARIANT_TYPE_INFO_C__
#include "galiasdef.c"
......@@ -125,35 +125,27 @@ typedef struct
#define G_VARIANT_MEMBER_ENDING_OFFSET 2
/* query */
G_GNUC_INTERNAL
const gchar * g_variant_type_info_get_type_string (GVariantTypeInfo *typeinfo);
G_GNUC_INTERNAL
void g_variant_type_info_query (GVariantTypeInfo *typeinfo,
guint *alignment,
gsize *size);
/* array */
G_GNUC_INTERNAL
GVariantTypeInfo * g_variant_type_info_element (GVariantTypeInfo *typeinfo);
G_GNUC_INTERNAL
void g_variant_type_info_query_element (GVariantTypeInfo *typeinfo,
guint *alignment,
gsize *size);
/* structure */
G_GNUC_INTERNAL
gsize g_variant_type_info_n_members (GVariantTypeInfo *typeinfo);
G_GNUC_INTERNAL
const GVariantMemberInfo * g_variant_type_info_member_info (GVariantTypeInfo *typeinfo,
gsize index);
/* new/ref/unref */
G_GNUC_INTERNAL
GVariantTypeInfo * g_variant_type_info_get (const GVariantType *type);
G_GNUC_INTERNAL
GVariantTypeInfo * g_variant_type_info_ref (GVariantTypeInfo *typeinfo);
G_GNUC_INTERNAL
void g_variant_type_info_unref (GVariantTypeInfo *typeinfo);
void g_variant_type_info_assert_no_infos (void);
#endif /* __G_VARIANT_TYPE_INFO_H__ */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment