| Libbonobo Reference Manual |
|---|
BonoboStreamMem — In-memory implementation of Bonobo::Stream interface.
struct BonoboStreamMem; struct BonoboStreamMemPrivate; #define BONOBO_STREAM_MEM_TYPE typedef BonoboStreamMemClass; BonoboStreamMem* bonobo_stream_mem_construct (BonoboStreamMem *stream_mem, const char *buffer,size_t size,gboolean read_only,gboolean resizable); BonoboObject* bonobo_stream_mem_create (const char *buffer,size_t size,gboolean read_only,gboolean resizable); const char* bonobo_stream_mem_get_buffer (BonoboStreamMem *stream_mem);size_t bonobo_stream_mem_get_size (BonoboStreamMem *stream_mem);
The BonoboStreamMem is an implementation of the IDL:Bonobo/Stream:1.0 interface. This implementation allows an in-memory buffer to be exposed as a IDL:Bonobo/Stream:1.0 to clients.
Example 1. Sample BonoboStreamMem usage
BonoboStream *make_bonobo_stream_on_string (char *string)
{
return bonobo_stream_mem_create (string, strlen (string), TRUE, FALSE);
}
struct BonoboStreamMem {
BonoboObject parent;
char *buffer;
size_t size;
long pos;
gboolean read_only;
gboolean resizable;
char *content_type;
char *name;
BonoboStreamMemPrivate *priv;
};
#define BONOBO_STREAM_MEM_TYPE BONOBO_TYPE_STREAM_MEM /* deprecated, you should use BONOBO_TYPE_STREAM_MEM */
typedef struct {
BonoboObjectClass parent_class;
POA_Bonobo_Stream__epv epv;
char *(*get_buffer) (BonoboStreamMem *stream_mem);
size_t (*get_size) (BonoboStreamMem *stream_mem);
} BonoboStreamMemClass;
BonoboStreamMem* bonobo_stream_mem_construct (BonoboStreamMem *stream_mem, const char *buffer,size_t size,gboolean read_only,gboolean resizable);
| stream_mem : | |
| buffer : | |
| size : | |
| read_only : | |
| resizable : | |
| Returns : |
BonoboObject* bonobo_stream_mem_create (const char *buffer,size_t size,gboolean read_only,gboolean resizable);
Creates a new BonoboStreamMem object.
If buffer is non-NULL, size bytes are copied from it into a new buffer. If buffer is NULL, a new buffer of size size is created and filled with zero bytes.
When data is read out of or (if read_only is FALSE) written into
the returned BonoboStream object, the
| buffer : | The data for which a BonoboStreamMem object is to be created. |
| size : | The size in bytes of buffer. |
| read_only : | Specifies whether or not the returned BonoboStreamMem
object should allow |
| resizable : | Whether or not the buffer should be resized as needed. |
| Returns : | the constructed BonoboStream object |
const char* bonobo_stream_mem_get_buffer (BonoboStreamMem *stream_mem);
Returns the buffer associated with a BonoboStreamMem. If the stream is set to automatically resize itself, this buffer is only guaranteed to stay valid until the next write operation on the stream.
| stream_mem : | a BonoboStreamMem |
| Returns : | a buffer containing the data written to the stream (or the data the stream was initialized with if nothing has been written). |
size_t bonobo_stream_mem_get_size (BonoboStreamMem *stream_mem);
Returns the size of the data associated with a BonoboStreamMem see bonobo_stream_mem_get_buffer
| stream_mem : | a BonoboStreamMem |
| Returns : | the size. |
| BonoboStream | An abstract class to implement IDL:Bonobo/Streams. |
| IDL:Bonobo/Stream:1.0 | The CORBA interface implemented . |
| << bonobo-storage-memory | bonobo-storage >> |