ostream_class->close_async = g_memory_output_stream_close_async;
ostream_class->close_finish = g_memory_output_stream_close_finish;
+ /**
+ * GMemoryOutputStream:data:
+ *
+ * Pointer to buffer where data will be written.
+ *
+ * Since: 2.24
+ **/
g_object_class_install_property (gobject_class,
PROP_DATA,
g_param_spec_pointer ("data",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GMemoryOutputStream:size:
+ *
+ * Current size of the data buffer.
+ *
+ * Since: 2.24
+ **/
g_object_class_install_property (gobject_class,
PROP_SIZE,
g_param_spec_ulong ("size",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GMemoryOutputStream:data-size:
+ *
+ * Size of data written to the buffer.
+ *
+ * Since: 2.24
+ **/
g_object_class_install_property (gobject_class,
PROP_DATA_SIZE,
g_param_spec_ulong ("data-size",
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GMemoryOutputStream:realloc-function:
+ *
+ * Function with realloc semantics called to enlarge the buffer.
+ *
+ * Since: 2.24
+ **/
g_object_class_install_property (gobject_class,
PROP_REALLOC_FUNCTION,
g_param_spec_pointer ("realloc-function",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GMemoryOutputStream:destroy-function:
+ *
+ * Function called with the buffer as argument when the stream is destroyed.
+ *
+ * Since: 2.24
+ **/
g_object_class_install_property (gobject_class,
PROP_DESTROY_FUNCTION,
g_param_spec_pointer ("destroy-function",
* g_memory_output_stream_new:
* @data: pointer to a chunk of memory to use, or %NULL
* @size: the size of @data
- * @realloc_function: a function with realloc() semantics to be called when
- * @data needs to be grown, or %NULL
+ * @realloc_function: a function with realloc() semantics (like g_realloc())
+ * to be called when @data needs to be grown, or %NULL
* @destroy_function: a function to be called on @data when the stream is
* finalized, or %NULL
*
* If @realloc_fn is non-%NULL, it will be used for resizing the internal
* storage when necessary. To construct a fixed-size output stream,
* pass %NULL as @realloc_fn.
+ *
* |[
* /* a stream that can grow */
* stream = g_memory_output_stream_new (NULL, 0, realloc, free);
*
+ * /* another stream that can grow */
+ * stream2 = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
+ *
* /* a fixed-size stream */
* data = malloc (200);
- * stream2 = g_memory_output_stream_new (data, 200, NULL, free);
+ * stream3 = g_memory_output_stream_new (data, 200, NULL, free);
* ]|
*
* Return value: A newly created #GMemoryOutputStream object.