libgimpconfig/gimpconfig-deserialize.c libgimpconfig/gimpconfig-error.c

2005-01-29  Sven Neumann  <sven@gimp.org>

	* libgimpconfig/gimpconfig-deserialize.c
	* libgimpconfig/gimpconfig-error.c
	* libgimpconfig/gimpconfig-iface.c
	* libgimpconfig/gimpconfig-path.c
	* libgimpconfig/gimpconfig-serialize.c
	* libgimpconfig/gimpconfig-utils.c
	* libgimpconfig/gimpconfigwriter.c
	* libgimpconfig/gimpscanner.c: use libgimp header,
	added "Since: GIMP 2.4" to the gtk-doc comments.
This commit is contained in:
Sven Neumann 2005-01-29 12:54:48 +00:00 committed by Sven Neumann
parent be6f9d259e
commit b4a68e9569
9 changed files with 301 additions and 22 deletions

View file

@ -1,3 +1,15 @@
2005-01-29 Sven Neumann <sven@gimp.org>
* libgimpconfig/gimpconfig-deserialize.c
* libgimpconfig/gimpconfig-error.c
* libgimpconfig/gimpconfig-iface.c
* libgimpconfig/gimpconfig-path.c
* libgimpconfig/gimpconfig-serialize.c
* libgimpconfig/gimpconfig-utils.c
* libgimpconfig/gimpconfigwriter.c
* libgimpconfig/gimpscanner.c: use libgimp header,
added "Since: GIMP 2.4" to the gtk-doc comments.
2005-01-29 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpenumwidgets.[ch]: use libgimp header,

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Object properties deserialization routines
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
@ -106,7 +106,9 @@ scanner_string_utf8_valid (GScanner *scanner,
*
* This function uses the @scanner to configure the properties of @config.
*
* Return value:
* Return value: %TRUE on success, %FALSE otherwise.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_deserialize_properties (GimpConfig *config,
@ -189,6 +191,22 @@ gimp_config_deserialize_properties (GimpConfig *config,
return gimp_config_deserialize_return (scanner, token, nest_level);
}
/**
* gimp_config_deserialize_property:
* @config: a #GimpConfig.
* @scanner: a #GScanner.
* @nest_level:
*
* This function deserializes a single property of @config. You
* shouldn't need to call this function directly. If possible, use
* gimp_config_deserialize_properties() instead.
*
* Return value: %G_TOKEN_RIGHT_PAREN on success, otherwise the
* expected #GTokenType or %G_TOKEN_NONE if the expected token was
* found but couldn't be parsed.
*
* Since: GIMP 2.4
**/
GTokenType
gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Config file serialization and deserialization interface
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
@ -26,6 +26,15 @@
#include "gimpconfig-error.h"
/**
* gimp_config_error_quark:
*
* This function is never called directly. Use GIMP_CONFIG_ERROR() instead.
*
* Return value: the #GQuark that defines the GimpConfig error domain.
*
* Since: GIMP 2.4
**/
GQuark
gimp_config_error_quark (void)
{

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Config file serialization and deserialization interface
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
@ -251,6 +251,8 @@ gimp_config_iface_reset (GimpConfig *config)
* calls the serialize function of the @config's #GimpConfigInterface.
*
* Return value: %TRUE if serialization succeeded, %FALSE otherwise.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_serialize_to_file (GimpConfig *config,
@ -275,6 +277,19 @@ gimp_config_serialize_to_file (GimpConfig *config,
return gimp_config_writer_finish (writer, footer, error);
}
/**
* gimp_config_serialize_to_fd:
* @config: a #GObject that implements the #GimpConfigInterface.
* @fd: a file descriptor, opened for writing
* @data: user data passed to the serialize implementation.
*
* Serializes the object properties of @config to the given file
* descriptor.
*
* Return value: %TRUE if serialization succeeded, %FALSE otherwise.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_serialize_to_fd (GimpConfig *config,
gint fd,
@ -302,6 +317,8 @@ gimp_config_serialize_to_fd (GimpConfig *config,
* Serializes the object properties of @config to a string.
*
* Return value: a newly allocated %NUL-terminated string.
*
* Since: GIMP 2.4
**/
gchar *
gimp_config_serialize_to_string (GimpConfig *config,
@ -335,6 +352,8 @@ gimp_config_serialize_to_string (GimpConfig *config,
* deserialize function of the @config's #GimpConfigInterface.
*
* Return value: %TRUE if deserialization succeeded, %FALSE otherwise.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_deserialize_file (GimpConfig *config,
@ -377,6 +396,8 @@ gimp_config_deserialize_file (GimpConfig *config,
* function of the @config's #GimpConfigInterface.
*
* Returns: %TRUE if deserialization succeeded, %FALSE otherwise.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_deserialize_string (GimpConfig *config,
@ -405,6 +426,16 @@ gimp_config_deserialize_string (GimpConfig *config,
return success;
}
/**
* gimp_config_deserialize_return:
* @scanner:
* @expected_token:
* @nest_level:
*
* Returns:
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_deserialize_return (GScanner *scanner,
GTokenType expected_token,
@ -452,6 +483,8 @@ gimp_config_deserialize_return (GScanner *scanner,
* properties.
*
* Return value: the duplicated #GimpConfig object
*
* Since: GIMP 2.4
**/
gpointer
gimp_config_duplicate (GimpConfig *config)
@ -472,6 +505,8 @@ gimp_config_duplicate (GimpConfig *config)
* properties.
*
* Return value: %TRUE if the two objects are equal.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_is_equal_to (GimpConfig *a,
@ -492,6 +527,8 @@ gimp_config_is_equal_to (GimpConfig *a,
* Resets the object to its default state. The default implementation of the
* #GimpConfigInterface only works for objects that are completely defined by
* their properties.
*
* Since: GIMP 2.4
**/
void
gimp_config_reset (GimpConfig *config)

View file

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* String substitution utilities for config files
* gimpconfig-path.c
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
@ -181,7 +181,14 @@ static gchar * gimp_config_path_expand_only (const gchar *path,
GError **error);
static inline gchar * gimp_config_path_extract_token (const gchar **str);
/**
* gimp_config_build_data_path:
* @name:
*
* Returns:
*
* Since: GIMP 2.4
**/
gchar *
gimp_config_build_data_path (const gchar *name)
{
@ -191,12 +198,14 @@ gimp_config_build_data_path (const gchar *name)
NULL);
}
gchar *
gimp_config_build_writable_path (const gchar *name)
{
return g_strconcat ("${gimp_dir}", G_DIR_SEPARATOR_S, name, NULL);
}
/**
* gimp_config_build_plug_in_path:
* @name:
*
* Returns:
*
* Since: GIMP 2.4
**/
gchar *
gimp_config_build_plug_in_path (const gchar *name)
{
@ -206,6 +215,20 @@ gimp_config_build_plug_in_path (const gchar *name)
NULL);
}
/**
* gimp_config_build_writable_path:
* @name:
*
* Returns:
*
* Since: GIMP 2.4
**/
gchar *
gimp_config_build_writable_path (const gchar *name)
{
return g_strconcat ("${gimp_dir}", G_DIR_SEPARATOR_S, name, NULL);
}
/**
* gimp_config_path_expand:
@ -222,6 +245,8 @@ gimp_config_build_plug_in_path (const gchar *name)
* filesystem encoding.
*
* Return value: a newly allocated %NUL-terminated string
*
* Since: GIMP 2.4
**/
gchar *
gimp_config_path_expand (const gchar *path,

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Object properties serialization routines
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
@ -44,9 +44,11 @@
* This function writes all object properties to the @writer.
*
* Returns: %TRUE if serialization succeeded, %FALSE otherwise
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_serialize_properties (GimpConfig *config,
gimp_config_serialize_properties (GimpConfig *config,
GimpConfigWriter *writer)
{
GObjectClass *klass;
@ -88,6 +90,8 @@ gimp_config_serialize_properties (GimpConfig *config,
* their default values to the @writer.
*
* Returns: %TRUE if serialization succeeded, %FALSE otherwise
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_serialize_changed_properties (GimpConfig *config,
@ -132,6 +136,17 @@ gimp_config_serialize_changed_properties (GimpConfig *config,
return TRUE;
}
/**
* gimp_config_serialize_properties:
* @config: a #GimpConfig.
* @writer: a #GimpConfigWriter.
*
* This function serializes a single object property to the @writer.
*
* Returns: %TRUE if serialization succeeded, %FALSE otherwise
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec,
@ -283,6 +298,8 @@ gimp_config_serialize_property (GimpConfig *config,
* This utility function appends a string representation of #GValue to @str.
*
* Return value: %TRUE if serialization succeeded, %FALSE otherwise.
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_serialize_value (const GValue *value,

View file

@ -1,4 +1,4 @@
/* The GIMP -- an image manipulation program
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Utitility functions for GimpConfig.
@ -151,6 +151,8 @@ gimp_config_diff_other (GimpConfig *a,
* compared.
*
* Return value: a GList of differing GParamSpecs.
*
* Since: GIMP 2.4
**/
GList *
gimp_config_diff (GimpConfig *a,
@ -187,6 +189,8 @@ gimp_config_diff (GimpConfig *a,
* value_type are synchronized
*
* Return value: %TRUE if @dest was modified, %FALSE otherwise
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_sync (GimpConfig *src,
@ -241,6 +245,8 @@ gimp_config_sync (GimpConfig *src,
* Resets all writable properties of @object to the default values as
* defined in their #GParamSpec. Properties marked as "construct-only"
* are not touched.
*
* Since: GIMP 2.4
**/
void
gimp_config_reset_properties (GimpConfig *config)
@ -321,6 +327,8 @@ gimp_config_reset_properties (GimpConfig *config)
* algorithm is different from the one used by g_strescape() since it
* leaves non-ASCII characters intact and thus preserves UTF-8
* strings. Only control characters and quotes are being escaped.
*
* Since: GIMP 2.4
**/
void
gimp_config_string_append_escaped (GString *string,

View file

@ -106,6 +106,8 @@ gimp_config_writer_newline (GimpConfigWriter *writer)
* @filename when the writer is closed.
*
* Return value: a new #GimpConfigWriter or %NULL in case of an error
*
* Since: GIMP 2.4
**/
GimpConfigWriter *
gimp_config_writer_new_file (const gchar *filename,
@ -164,6 +166,14 @@ gimp_config_writer_new_file (const gchar *filename,
return writer;
}
/**
* gimp_config_writer_new_fd:
* @fd:
*
* Return value: a new #GimpConfigWriter or %NULL in case of an error
*
* Since: GIMP 2.4
**/
GimpConfigWriter *
gimp_config_writer_new_fd (gint fd)
{
@ -179,6 +189,14 @@ gimp_config_writer_new_fd (gint fd)
return writer;
}
/**
* gimp_config_writer_new_string:
* @string:
*
* Return value: a new #GimpConfigWriter or %NULL in case of an error
*
* Since: GIMP 2.4
**/
GimpConfigWriter *
gimp_config_writer_new_string (GString *string)
{
@ -204,6 +222,8 @@ gimp_config_writer_new_string (GString *string)
*
* Since comments have to start at the beginning of a line, this
* funtion will insert a newline if necessary.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_comment_mode (GimpConfigWriter *writer,
@ -239,6 +259,8 @@ gimp_config_writer_comment_mode (GimpConfigWriter *writer,
* This function writes the opening parenthese followed by @name.
* It also increases the indentation level and sets a mark that
* can be used by gimp_config_writer_revert().
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_open (GimpConfigWriter *writer,
@ -269,6 +291,8 @@ gimp_config_writer_open (GimpConfigWriter *writer,
*
* Appends a space followed by @string to the @writer. Note that string
* must not contain any special characters that might need to be escaped.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_print (GimpConfigWriter *writer,
@ -298,6 +322,8 @@ gimp_config_writer_print (GimpConfigWriter *writer,
* @Varargs: list of arguments according to @format
*
* A printf-like function for #GimpConfigWriter.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_printf (GimpConfigWriter *writer,
@ -330,6 +356,8 @@ gimp_config_writer_printf (GimpConfigWriter *writer,
*
* Writes a string value to @writer. The @string is quoted and special
* characters are escaped.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_string (GimpConfigWriter *writer,
@ -351,6 +379,8 @@ gimp_config_writer_string (GimpConfigWriter *writer,
*
* Writes an identifier to @writer. The @string is *not* quoted and special
* characters are *not* escaped.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_identifier (GimpConfigWriter *writer,
@ -365,6 +395,15 @@ gimp_config_writer_identifier (GimpConfigWriter *writer,
g_string_append_printf (writer->buffer, " %s", identifier);
}
/**
* gimp_config_writer_data:
* @writer: a #GimpConfigWriter
* @length:
* @data:
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_data (GimpConfigWriter *writer,
gint length,
@ -399,6 +438,8 @@ gimp_config_writer_data (GimpConfigWriter *writer,
* Reverts all changes to @writer that were done since the last call
* to gimp_config_writer_open(). This can only work if you didn't call
* gimp_config_writer_close() yet.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_revert (GimpConfigWriter *writer)
@ -422,6 +463,8 @@ gimp_config_writer_revert (GimpConfigWriter *writer)
* @writer: a #GimpConfigWriter
*
* Closes an element opened with gimp_config_writer_open().
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_close (GimpConfigWriter *writer)
@ -457,6 +500,8 @@ gimp_config_writer_close (GimpConfigWriter *writer)
*
* Return value: %TRUE if everything could be successfully written,
* %FALSE otherwise
*
* Since: GIMP 2.4
**/
gboolean
gimp_config_writer_finish (GimpConfigWriter *writer,
@ -531,6 +576,8 @@ gimp_config_writer_linefeed (GimpConfigWriter *writer)
* Appends the @comment to @str and inserts linebreaks and hash-marks to
* format it as a comment. Note that this function does not handle non-ASCII
* characters.
*
* Since: GIMP 2.4
**/
void
gimp_config_writer_comment (GimpConfigWriter *writer,

View file

@ -68,6 +68,15 @@ static void gimp_scanner_message (GScanner *scanner,
/* public functions */
/**
* gimp_scanner_new_file:
* @filename:
* @error:
*
* Return value:
*
* Since: GIMP 2.4
**/
GScanner *
gimp_scanner_new_file (const gchar *filename,
GError **error)
@ -104,6 +113,16 @@ gimp_scanner_new_file (const gchar *filename,
return scanner;
}
/**
* gimp_scanner_new_string:
* @text:
* @text_len:
* @error:
*
* Return value:
*
* Since: GIMP 2.4
**/
GScanner *
gimp_scanner_new_string (const gchar *text,
gint text_len,
@ -153,6 +172,12 @@ gimp_scanner_new (const gchar *name,
return scanner;
}
/**
* gimp_scanner_destroy:
* @scanner:
*
* Since: GIMP 2.4
**/
void
gimp_scanner_destroy (GScanner *scanner)
{
@ -175,7 +200,15 @@ gimp_scanner_destroy (GScanner *scanner)
g_scanner_destroy (scanner);
}
/**
* gimp_scanner_parse_token:
* @scanner:
* @token:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_token (GScanner *scanner,
GTokenType token)
@ -188,6 +221,15 @@ gimp_scanner_parse_token (GScanner *scanner,
return TRUE;
}
/**
* gimp_scanner_parse_identifier:
* @scanner:
* @identifier:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_identifier (GScanner *scanner,
const gchar *identifier)
@ -203,6 +245,15 @@ gimp_scanner_parse_identifier (GScanner *scanner,
return TRUE;
}
/**
* gimp_scanner_parse_string:
* @scanner:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_string (GScanner *scanner,
gchar **dest)
@ -230,6 +281,15 @@ gimp_scanner_parse_string (GScanner *scanner,
return TRUE;
}
/**
* gimp_scanner_parse_string_no_validate:
* @scanner:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_string_no_validate (GScanner *scanner,
gchar **dest)
@ -247,6 +307,16 @@ gimp_scanner_parse_string_no_validate (GScanner *scanner,
return TRUE;
}
/**
* gimp_scanner_parse_data:
* @scanner:
* @length:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_data (GScanner *scanner,
gint length,
@ -265,6 +335,15 @@ gimp_scanner_parse_data (GScanner *scanner,
return TRUE;
}
/**
* gimp_scanner_parse_int:
* @scanner:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_int (GScanner *scanner,
gint *dest)
@ -290,6 +369,15 @@ gimp_scanner_parse_int (GScanner *scanner,
return TRUE;
}
/**
* gimp_scanner_parse_float:
* @scanner:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_float (GScanner *scanner,
gdouble *dest)
@ -312,6 +400,15 @@ enum
COLOR_HSVA
};
/**
* gimp_scanner_parse_color:
* @scanner:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_color (GScanner *scanner,
GimpRGB *dest)
@ -425,6 +522,15 @@ gimp_scanner_parse_color (GScanner *scanner,
return (token == G_TOKEN_NONE);
}
/**
* gimp_scanner_parse_matrix2:
* @scanner:
* @dest:
*
* Return value:
*
* Since: GIMP 2.4
**/
gboolean
gimp_scanner_parse_matrix2 (GScanner *scanner,
GimpMatrix2 *dest)