CtplOutputStream

CtplOutputStream — CTPL's data output stream

Synopsis

#include <ctpl/output-stream.h>

typedef             CtplOutputStream;
#define             ctpl_output_stream_new
#define             ctpl_output_stream_ref
#define             ctpl_output_stream_unref
gboolean            ctpl_output_stream_write            (CtplOutputStream *stream,
                                                         const gchar *data,
                                                         gssize length,
                                                         GError **error);
gboolean            ctpl_output_stream_put_c            (CtplOutputStream *stream,
                                                         gchar c,
                                                         GError **error);

Description

The data output stream used by CTPL; built on top of GOutputStream.

A CtplOutputStream is created with ctpl_output_stream_new(). It uses a GObject-like refcounting, through ctpl_output_stream_ref() and ctpl_output_stream_unref().

Details

CtplOutputStream

typedef GOutputStream           CtplOutputStream;

An opaque object representing an output data stream.


ctpl_output_stream_new

#define           ctpl_output_stream_new            g_object_ref

Creates a new CtplOutputStream for a given GOutputStream. This function adds a reference to the GOutputStream.

stream :

A GOutputStream

Returns :

A new CtplOutputStream.

Since 0.2


ctpl_output_stream_ref

#define           ctpl_output_stream_ref            g_object_ref

Adds a reference to a CtplOutputStream.

stream :

A CtplOutputStream

Returns :

The stream

Since 0.2


ctpl_output_stream_unref

#define           ctpl_output_stream_unref          g_object_unref

Removes a reference from a CtplOutputStream. When its reference count reaches 0, the stream is destroyed.

stream :

A CtplOutputStream

Since 0.2


ctpl_output_stream_write ()

gboolean            ctpl_output_stream_write            (CtplOutputStream *stream,
                                                         const gchar *data,
                                                         gssize length,
                                                         GError **error);

Writes a buffer to a CtplOutputStream.

stream :

A CtplOutputStream

data :

The data to write

length :

Length of the data in bytes, or -1 if it is a 0-terminated string

error :

Return location for errors, or NULL to ignore them

Returns :

TRUE on success, FALSE otherwise.

Since 0.2


ctpl_output_stream_put_c ()

gboolean            ctpl_output_stream_put_c            (CtplOutputStream *stream,
                                                         gchar c,
                                                         GError **error);

Writes a character to a CtplOutputStream.

stream :

A CtplOutputStream

c :

The character to write

error :

Return location for errors, or NULL to ignore them

Returns :

TRUE on success, FALSE otherwise.

Since 0.2