![]() |
![]() |
![]() |
CTPL Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <ctpl/ctpl.h> CtplOutputStream; CtplOutputStream * ctpl_output_stream_new (GOutputStream *stream
); CtplOutputStream * ctpl_output_stream_ref (CtplOutputStream *stream
); void ctpl_output_stream_unref (CtplOutputStream *stream
); GOutputStream * ctpl_output_stream_get_stream (CtplOutputStream *stream
); 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
);
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()
.
The errors that the functions in this module can throw comes from the
G_IO_ERROR
or CTPL_IO_ERROR
domains unless otherwise mentioned.
typedef struct _CtplOutputStream CtplOutputStream;
An opaque object representing an output data stream.
CtplOutputStream * ctpl_output_stream_new (GOutputStream *stream
);
Creates a new CtplOutputStream for a given GOutputStream. This function adds a reference to the GOutputStream.
|
A GOutputStream |
Returns : |
A new CtplOutputStream. |
Since 0.2
CtplOutputStream * ctpl_output_stream_ref (CtplOutputStream *stream
);
Adds a reference to a CtplOutputStream.
|
A CtplOutputStream |
Returns : |
The stream |
Since 0.2
void ctpl_output_stream_unref (CtplOutputStream *stream
);
Removes a reference from a CtplOutputStream. When its reference count reaches 0, the stream is destroyed.
|
A CtplOutputStream |
Since 0.2
GOutputStream * ctpl_output_stream_get_stream (CtplOutputStream *stream
);
Gets the underlying GOutputStream associated with a CtplOutputStream.
|
A CtplOutputStream |
Returns : |
The underlying GOutputStream of stream . [transfer none]
|
Since 0.3
gboolean ctpl_output_stream_write (CtplOutputStream *stream
,const gchar *data
,gssize length
,GError **error
);
Writes a buffer to a CtplOutputStream.
|
A CtplOutputStream |
|
The data to write |
|
Length of the data in bytes, or -1 if it is a 0-terminated string |
|
Return location for errors, or NULL to ignore them
|
Returns : |
TRUE on success, FALSE otherwise.
|
Since 0.2
gboolean ctpl_output_stream_put_c (CtplOutputStream *stream
,gchar c
,GError **error
);
Writes a character to a CtplOutputStream.
|
A CtplOutputStream |
|
The character to write |
|
Return location for errors, or NULL to ignore them
|
Returns : |
TRUE on success, FALSE otherwise.
|
Since 0.2