+
+ /**
+ * 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",
+ P_("Data Buffer"),
+ P_("Pointer to buffer where data will be written."),
+ 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",
+ P_("Data Buffer Size"),
+ P_("Current size of the data buffer."),
+ 0, G_MAXULONG, 0,
+ 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",
+ P_("Data Size"),
+ P_("Size of data written to the buffer."),
+ 0, G_MAXULONG, 0,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GMemoryOutputStream:realloc-function: (skip)
+ *
+ * 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",
+ P_("Memory Reallocation Function"),
+ P_("Function with realloc semantics called to enlarge the buffer."),
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GMemoryOutputStream:destroy-function: (skip)
+ *
+ * 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",
+ P_("Destroy Notification Function"),
+ P_("Function called with the buffer as argument when the stream is destroyed."),
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+}
+
+static void
+g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface)
+{
+ iface->is_writable = g_memory_output_stream_is_writable;
+ iface->create_source = g_memory_output_stream_create_source;
+}
+
+static void
+g_memory_output_stream_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GMemoryOutputStream *stream;
+ GMemoryOutputStreamPrivate *priv;
+
+ stream = G_MEMORY_OUTPUT_STREAM (object);
+ priv = stream->priv;
+
+ switch (prop_id)
+ {
+ case PROP_DATA:
+ priv->data = g_value_get_pointer (value);
+ break;
+ case PROP_SIZE:
+ priv->len = g_value_get_ulong (value);
+ break;
+ case PROP_REALLOC_FUNCTION:
+ priv->realloc_fn = g_value_get_pointer (value);
+ break;
+ case PROP_DESTROY_FUNCTION:
+ priv->destroy = g_value_get_pointer (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+g_memory_output_stream_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GMemoryOutputStream *stream;
+ GMemoryOutputStreamPrivate *priv;
+
+ stream = G_MEMORY_OUTPUT_STREAM (object);
+ priv = stream->priv;
+
+ switch (prop_id)
+ {
+ case PROP_DATA:
+ g_value_set_pointer (value, priv->data);
+ break;
+ case PROP_SIZE:
+ g_value_set_ulong (value, priv->len);
+ break;
+ case PROP_DATA_SIZE:
+ g_value_set_ulong (value, priv->valid_len);
+ break;
+ case PROP_REALLOC_FUNCTION:
+ g_value_set_pointer (value, priv->realloc_fn);
+ break;
+ case PROP_DESTROY_FUNCTION:
+ g_value_set_pointer (value, priv->destroy);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }