PIKApp/libpikaconfig/pikaconfigwriter.h

87 lines
4.2 KiB
C

/* LIBPIKA - The PIKA Library
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* PikaConfigWriter
* Copyright (C) 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_WRITER_H__
#define __PIKA_CONFIG_WRITER_H__
/**
* PIKA_TYPE_CONFIG_WRITER:
*
* The type ID of the "PikaConfigWriter" type which is a boxed type,
* used to write config files.
*
* Since: 3.0
*/
#define PIKA_TYPE_CONFIG_WRITER (pika_config_writer_get_type ())
GType pika_config_writer_get_type (void) G_GNUC_CONST;
PikaConfigWriter * pika_config_writer_new_from_file (GFile *file,
gboolean atomic,
const gchar *header,
GError **error);
PikaConfigWriter * pika_config_writer_new_from_stream (GOutputStream *output,
const gchar *header,
GError **error);
PikaConfigWriter * pika_config_writer_new_from_fd (gint fd);
PikaConfigWriter * pika_config_writer_new_from_string (GString *string);
PikaConfigWriter * pika_config_writer_ref (PikaConfigWriter *writer);
void pika_config_writer_unref (PikaConfigWriter *writer);
void pika_config_writer_open (PikaConfigWriter *writer,
const gchar *name);
void pika_config_writer_comment_mode (PikaConfigWriter *writer,
gboolean enable);
void pika_config_writer_print (PikaConfigWriter *writer,
const gchar *string,
gint len);
void pika_config_writer_printf (PikaConfigWriter *writer,
const gchar *format,
...) G_GNUC_PRINTF (2, 3);
void pika_config_writer_identifier (PikaConfigWriter *writer,
const gchar *identifier);
void pika_config_writer_string (PikaConfigWriter *writer,
const gchar *string);
void pika_config_writer_data (PikaConfigWriter *writer,
gint length,
const guint8 *data);
void pika_config_writer_comment (PikaConfigWriter *writer,
const gchar *comment);
void pika_config_writer_linefeed (PikaConfigWriter *writer);
void pika_config_writer_revert (PikaConfigWriter *writer);
void pika_config_writer_close (PikaConfigWriter *writer);
gboolean pika_config_writer_finish (PikaConfigWriter *writer,
const gchar *footer,
GError **error);
#endif /* __PIKA_CONFIG_WRITER_H__ */