medit/moo/mooutils/moofilewriter.h

76 lines
3.3 KiB
C
Raw Normal View History

2008-02-20 18:45:20 -06:00
/*
* mooutils-file.h
*
2010-12-21 20:15:45 -08:00
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
2008-02-20 18:45:20 -06:00
*
* This file is part of medit. medit 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.1 of the License,
* or (at your option) any later version.
2008-02-20 18:45:20 -06:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
2008-02-20 18:45:20 -06:00
*/
2016-10-02 21:14:12 -07:00
#ifndef MOO_FILE_WRITER_H
#define MOO_FILE_WRITER_H
2008-02-20 18:45:20 -06:00
2016-10-02 21:14:12 -07:00
#include <gio/gio.h>
2008-02-20 18:45:20 -06:00
2016-10-02 21:14:12 -07:00
G_BEGIN_DECLS
2008-02-20 18:45:20 -06:00
2016-01-19 03:54:06 -08:00
2016-10-02 21:14:12 -07:00
typedef struct _MooFileReader MooFileReader;
2008-08-31 14:53:08 -05:00
MooFileReader *moo_file_reader_new (const char *filename,
2016-10-02 21:14:12 -07:00
GError **error);
2008-08-31 14:53:08 -05:00
MooFileReader *moo_text_reader_new (const char *filename,
2016-10-02 21:14:12 -07:00
GError **error);
2008-08-31 14:53:08 -05:00
gboolean moo_file_reader_read (MooFileReader *reader,
char *buf,
gsize buf_size,
gsize *size_read,
2016-10-02 21:14:12 -07:00
GError **error);
2008-08-31 14:53:08 -05:00
void moo_file_reader_close (MooFileReader *reader);
2016-10-02 21:14:12 -07:00
typedef struct _MooFileWriter MooFileWriter;
typedef enum /*< flags >*/
{
MOO_FILE_WRITER_SAVE_BACKUP = 1 << 0,
MOO_FILE_WRITER_CONFIG_MODE = 1 << 1,
MOO_FILE_WRITER_TEXT_MODE = 1 << 2
} MooFileWriterFlags;
2008-02-20 18:45:20 -06:00
MooFileWriter *moo_file_writer_new (const char *filename,
MooFileWriterFlags flags,
2016-10-02 21:14:12 -07:00
GError **error);
MooFileWriter *moo_file_writer_new_for_file (GFile *file,
2008-09-15 03:59:22 -05:00
MooFileWriterFlags flags,
2016-10-02 21:14:12 -07:00
GError **error);
MooFileWriter *moo_config_writer_new (const char *filename,
2008-02-20 18:45:20 -06:00
gboolean save_backup,
2016-10-02 21:14:12 -07:00
GError **error);
2008-02-20 18:45:20 -06:00
MooFileWriter *moo_string_writer_new (void);
gboolean moo_file_writer_write (MooFileWriter *writer,
const char *data,
2016-10-02 21:14:12 -07:00
gssize len);
gboolean moo_file_writer_printf (MooFileWriter *writer,
2008-02-20 18:45:20 -06:00
const char *fmt,
...) G_GNUC_PRINTF (2, 3);
2016-10-02 21:14:12 -07:00
gboolean moo_file_writer_printf_markup (MooFileWriter *writer,
2010-12-29 02:15:14 -08:00
const char *fmt,
...) G_GNUC_PRINTF (2, 3);
2008-02-20 18:45:20 -06:00
gboolean moo_file_writer_close (MooFileWriter *writer,
GError **error);
2016-10-02 21:14:12 -07:00
const char *moo_string_writer_get_string (MooFileWriter *writer,
gsize *len);
2016-02-02 01:12:23 -08:00
2008-02-20 18:45:20 -06:00
G_END_DECLS
2016-02-02 01:12:23 -08:00
2016-10-02 21:14:12 -07:00
#endif /* MOO_FILE_WRITER_H */