136 lines
7.3 KiB
C
136 lines
7.3 KiB
C
/* LIBPIKA - The PIKA Library
|
|
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
|
|
*
|
|
* Config file serialization and deserialization interface
|
|
* Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
|
|
*
|
|
* 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 3 of the License, 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
|
|
* Library 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, see
|
|
* <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#if !defined (__PIKA_CONFIG_H_INSIDE__) && !defined (PIKA_CONFIG_COMPILATION)
|
|
#error "Only <libpikaconfig/pikaconfig.h> can be included directly."
|
|
#endif
|
|
|
|
#ifndef __PIKA_CONFIG_IFACE_H__
|
|
#define __PIKA_CONFIG_IFACE_H__
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* For information look into the C source or the html documentation */
|
|
|
|
#define PIKA_TYPE_CONFIG (pika_config_get_type ())
|
|
G_DECLARE_INTERFACE (PikaConfig, pika_config, PIKA, CONFIG, GObject)
|
|
|
|
struct _PikaConfigInterface
|
|
{
|
|
GTypeInterface base_iface;
|
|
|
|
gboolean (* serialize) (PikaConfig *config,
|
|
PikaConfigWriter *writer,
|
|
gpointer data);
|
|
gboolean (* deserialize) (PikaConfig *config,
|
|
GScanner *scanner,
|
|
gint nest_level,
|
|
gpointer data);
|
|
PikaConfig * (* deserialize_create) (GType type,
|
|
GScanner *scanner,
|
|
gint nest_level,
|
|
gpointer data);
|
|
gboolean (* serialize_property) (PikaConfig *config,
|
|
guint property_id,
|
|
const GValue *value,
|
|
GParamSpec *pspec,
|
|
PikaConfigWriter *writer);
|
|
gboolean (* deserialize_property) (PikaConfig *config,
|
|
guint property_id,
|
|
GValue *value,
|
|
GParamSpec *pspec,
|
|
GScanner *scanner,
|
|
GTokenType *expected);
|
|
PikaConfig * (* duplicate) (PikaConfig *config);
|
|
gboolean (* equal) (PikaConfig *a,
|
|
PikaConfig *b);
|
|
void (* reset) (PikaConfig *config);
|
|
gboolean (* copy) (PikaConfig *src,
|
|
PikaConfig *dest,
|
|
GParamFlags flags);
|
|
};
|
|
|
|
|
|
gboolean pika_config_serialize_to_file (PikaConfig *config,
|
|
GFile *file,
|
|
const gchar *header,
|
|
const gchar *footer,
|
|
gpointer data,
|
|
GError **error);
|
|
gboolean pika_config_serialize_to_stream (PikaConfig *config,
|
|
GOutputStream *output,
|
|
const gchar *header,
|
|
const gchar *footer,
|
|
gpointer data,
|
|
GError **error);
|
|
gboolean pika_config_serialize_to_fd (PikaConfig *config,
|
|
gint fd,
|
|
gpointer data);
|
|
gchar * pika_config_serialize_to_string (PikaConfig *config,
|
|
gpointer data);
|
|
PikaParasite *
|
|
pika_config_serialize_to_parasite (PikaConfig *config,
|
|
const gchar *parasite_name,
|
|
guint parasite_flags,
|
|
gpointer data);
|
|
|
|
gboolean pika_config_deserialize_file (PikaConfig *config,
|
|
GFile *file,
|
|
gpointer data,
|
|
GError **error);
|
|
gboolean pika_config_deserialize_stream (PikaConfig *config,
|
|
GInputStream *input,
|
|
gpointer data,
|
|
GError **error);
|
|
gboolean pika_config_deserialize_string (PikaConfig *config,
|
|
const gchar *text,
|
|
gint text_len,
|
|
gpointer data,
|
|
GError **error);
|
|
gboolean pika_config_deserialize_parasite (PikaConfig *config,
|
|
const PikaParasite *parasite,
|
|
gpointer data,
|
|
GError **error);
|
|
|
|
gboolean pika_config_deserialize_return (GScanner *scanner,
|
|
GTokenType expected_token,
|
|
gint nest_level);
|
|
|
|
gboolean pika_config_serialize (PikaConfig *config,
|
|
PikaConfigWriter *writer,
|
|
gpointer data);
|
|
gboolean pika_config_deserialize (PikaConfig *config,
|
|
GScanner *scanner,
|
|
gint nest_level,
|
|
gpointer data);
|
|
gpointer pika_config_duplicate (PikaConfig *config);
|
|
gboolean pika_config_is_equal_to (PikaConfig *a,
|
|
PikaConfig *b);
|
|
void pika_config_reset (PikaConfig *config);
|
|
gboolean pika_config_copy (PikaConfig *src,
|
|
PikaConfig *dest,
|
|
GParamFlags flags);
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __PIKA_CONFIG_IFACE_H__ */
|