~ubuntu-branches/ubuntu/quantal/libbonobo/quantal-201207170711

« back to all changes in this revision

Viewing changes to doc/api/sgml/bonobo-stream-memory.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-02-18 14:40:51 UTC
  • mto: (3.1.1 etch) (1.1.25 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050218144051-fo4h9qh2gim8x3wt
Tags: upstream-2.8.1
ImportĀ upstreamĀ versionĀ 2.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<refentry id="libbonobo-bonobo-stream-memory">
2
 
<refmeta>
3
 
<refentrytitle>BonoboStreamMem</refentrytitle>
4
 
<manvolnum>3</manvolnum>
5
 
<refmiscinfo>LIBBONOBO Library</refmiscinfo>
6
 
</refmeta>
7
 
 
8
 
<refnamediv>
9
 
<refname>BonoboStreamMem</refname><refpurpose>
10
 
In-memory implementation of Bonobo::Stream interface.</refpurpose>
11
 
</refnamediv>
12
 
 
13
 
<refsynopsisdiv><title>Synopsis</title>
14
 
<synopsis>
15
 
 
16
 
 
17
 
 
18
 
struct      <link linkend="BonoboStreamMem">BonoboStreamMem</link>;
19
 
struct      <link linkend="BonoboStreamMemPrivate">BonoboStreamMemPrivate</link>;
20
 
#define     <link linkend="BONOBO-STREAM-MEM-TYPE-CAPS">BONOBO_STREAM_MEM_TYPE</link>
21
 
typedef     <link linkend="BonoboStreamMemClass">BonoboStreamMemClass</link>;
22
 
<link linkend="BonoboStreamMem">BonoboStreamMem</link>* <link linkend="bonobo-stream-mem-construct">bonobo_stream_mem_construct</link>
23
 
                                            (<link linkend="BonoboStreamMem">BonoboStreamMem</link> *stream_mem,
24
 
                                             const char *buffer,
25
 
                                             <link linkend="size-t">size_t</link> size,
26
 
                                             <link linkend="gboolean">gboolean</link> read_only,
27
 
                                             <link linkend="gboolean">gboolean</link> resizable);
28
 
<link linkend="BonoboObject">BonoboObject</link>* <link linkend="bonobo-stream-mem-create">bonobo_stream_mem_create</link>      (const char *buffer,
29
 
                                             <link linkend="size-t">size_t</link> size,
30
 
                                             <link linkend="gboolean">gboolean</link> read_only,
31
 
                                             <link linkend="gboolean">gboolean</link> resizable);
32
 
const char* <link linkend="bonobo-stream-mem-get-buffer">bonobo_stream_mem_get_buffer</link>    (<link linkend="BonoboStreamMem">BonoboStreamMem</link> *stream_mem);
33
 
<link linkend="size-t">size_t</link>      <link linkend="bonobo-stream-mem-get-size">bonobo_stream_mem_get_size</link>      (<link linkend="BonoboStreamMem">BonoboStreamMem</link> *stream_mem);
34
 
 
35
 
</synopsis>
36
 
</refsynopsisdiv>
37
 
 
38
 
 
39
 
 
40
 
 
41
 
 
42
 
<refsect1>
43
 
<title>Description</title>
44
 
<para>
45
 
   The BonoboStreamMem is an implementation of the
46
 
   IDL:Bonobo/Stream:1.0 interface.  This implementation allows an
47
 
   in-memory buffer to be exposed as a IDL:Bonobo/Stream:1.0 to
48
 
   clients.  
49
 
</para>
50
 
 
51
 
<para>
52
 
   Here is a sample way of exposing a C string as an
53
 
   IDL:Bonobo/Stream:1.0:
54
 
 
55
 
   <example>
56
 
     <title>Sample BonoboStreamMem usage</title>
57
 
 
58
 
     <programlisting>
59
 
BonoboStream *make_bonobo_stream_on_string (char *string)
60
 
{
61
 
    return bonobo_stream_mem_create (string, strlen (string), TRUE, FALSE);
62
 
}
63
 
     </programlisting>
64
 
   </example>
65
 
 
66
 
   This example will make the string argument be exposed as a CORBA
67
 
   stream.  </para>
68
 
</refsect1>
69
 
 
70
 
<refsect1>
71
 
<title>Details</title>
72
 
<refsect2>
73
 
<title><anchor id="BonoboStreamMem">struct BonoboStreamMem</title>
74
 
<programlisting>struct BonoboStreamMem {
75
 
        BonoboObject parent;
76
 
 
77
 
        char         *buffer;
78
 
        size_t        size;
79
 
        long          pos;
80
 
        gboolean      read_only;
81
 
        gboolean      resizable;
82
 
        char         *content_type;
83
 
        char         *name;
84
 
 
85
 
        BonoboStreamMemPrivate *priv;
86
 
};
87
 
</programlisting>
88
 
<para>
89
 
 
90
 
</para></refsect2>
91
 
<refsect2>
92
 
<title><anchor id="BonoboStreamMemPrivate">struct BonoboStreamMemPrivate</title>
93
 
<programlisting>struct BonoboStreamMemPrivate;</programlisting>
94
 
<para>
95
 
 
96
 
</para></refsect2>
97
 
<refsect2>
98
 
<title><anchor id="BONOBO-STREAM-MEM-TYPE-CAPS">BONOBO_STREAM_MEM_TYPE</title>
99
 
<programlisting>#define BONOBO_STREAM_MEM_TYPE        BONOBO_TYPE_STREAM_MEM /* deprecated, you should use BONOBO_TYPE_STREAM_MEM */
100
 
</programlisting>
101
 
<para>
102
 
 
103
 
</para></refsect2>
104
 
<refsect2>
105
 
<title><anchor id="BonoboStreamMemClass">BonoboStreamMemClass</title>
106
 
<programlisting>typedef struct {
107
 
        BonoboObjectClass parent_class;
108
 
 
109
 
        POA_Bonobo_Stream__epv epv;
110
 
 
111
 
        char           *(*get_buffer) (BonoboStreamMem *stream_mem);
112
 
        size_t          (*get_size)   (BonoboStreamMem *stream_mem);
113
 
} BonoboStreamMemClass;
114
 
</programlisting>
115
 
<para>
116
 
 
117
 
</para></refsect2>
118
 
<refsect2>
119
 
<title><anchor id="bonobo-stream-mem-construct">bonobo_stream_mem_construct ()</title>
120
 
<programlisting><link linkend="BonoboStreamMem">BonoboStreamMem</link>* bonobo_stream_mem_construct
121
 
                                            (<link linkend="BonoboStreamMem">BonoboStreamMem</link> *stream_mem,
122
 
                                             const char *buffer,
123
 
                                             <link linkend="size-t">size_t</link> size,
124
 
                                             <link linkend="gboolean">gboolean</link> read_only,
125
 
                                             <link linkend="gboolean">gboolean</link> resizable);</programlisting>
126
 
<para>
127
 
 
128
 
</para><informaltable pgwide="1" frame="none" role="params">
129
 
<tgroup cols="2">
130
 
<colspec colwidth="2*">
131
 
<colspec colwidth="8*">
132
 
<tbody>
133
 
<row><entry align="right"><parameter>stream_mem</parameter>&nbsp;:</entry>
134
 
<entry>
135
 
</entry></row>
136
 
<row><entry align="right"><parameter>buffer</parameter>&nbsp;:</entry>
137
 
<entry>
138
 
</entry></row>
139
 
<row><entry align="right"><parameter>size</parameter>&nbsp;:</entry>
140
 
<entry>
141
 
</entry></row>
142
 
<row><entry align="right"><parameter>read_only</parameter>&nbsp;:</entry>
143
 
<entry>
144
 
</entry></row>
145
 
<row><entry align="right"><parameter>resizable</parameter>&nbsp;:</entry>
146
 
<entry>
147
 
</entry></row>
148
 
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>
149
 
</entry></row>
150
 
</tbody></tgroup></informaltable></refsect2>
151
 
<refsect2>
152
 
<title><anchor id="bonobo-stream-mem-create">bonobo_stream_mem_create ()</title>
153
 
<programlisting><link linkend="BonoboObject">BonoboObject</link>* bonobo_stream_mem_create      (const char *buffer,
154
 
                                             <link linkend="size-t">size_t</link> size,
155
 
                                             <link linkend="gboolean">gboolean</link> read_only,
156
 
                                             <link linkend="gboolean">gboolean</link> resizable);</programlisting>
157
 
<para>
158
 
Creates a new BonoboStreamMem object.
159
 
</para>
160
 
<para>
161
 
If <parameter>buffer</parameter> is non-<literal>NULL</literal>, <parameter>size</parameter> bytes are copied from it into a new
162
 
buffer. If <parameter>buffer</parameter> is <literal>NULL</literal>, a new buffer of size <parameter>size</parameter> is created
163
 
and filled with zero bytes.
164
 
</para>
165
 
<para>
166
 
When data is read out of or (if <parameter>read_only</parameter> is FALSE) written into
167
 
the returned BonoboStream object, the <link linkend="read">read</link>() and <link linkend="write">write</link>() operations
168
 
operate on the new buffer. If <parameter>resizable</parameter> is TRUE, writing or seeking
169
 
past the end of the buffer will cause the buffer to be expanded (with
170
 
the new space zero-filled for a seek).</para>
171
 
<para>
172
 
 
173
 
</para><informaltable pgwide="1" frame="none" role="params">
174
 
<tgroup cols="2">
175
 
<colspec colwidth="2*">
176
 
<colspec colwidth="8*">
177
 
<tbody>
178
 
<row><entry align="right"><parameter>buffer</parameter>&nbsp;:</entry>
179
 
<entry> The data for which a BonoboStreamMem object is to be created.
180
 
</entry></row>
181
 
<row><entry align="right"><parameter>size</parameter>&nbsp;:</entry>
182
 
<entry> The size in bytes of <parameter>buffer</parameter>.
183
 
</entry></row>
184
 
<row><entry align="right"><parameter>read_only</parameter>&nbsp;:</entry>
185
 
<entry> Specifies whether or not the returned BonoboStreamMem
186
 
object should allow <link linkend="write">write</link>() operations.
187
 
</entry></row>
188
 
<row><entry align="right"><parameter>resizable</parameter>&nbsp;:</entry>
189
 
<entry> Whether or not the buffer should be resized as needed.
190
 
</entry></row>
191
 
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the constructed BonoboStream object
192
 
</entry></row>
193
 
</tbody></tgroup></informaltable></refsect2>
194
 
<refsect2>
195
 
<title><anchor id="bonobo-stream-mem-get-buffer">bonobo_stream_mem_get_buffer ()</title>
196
 
<programlisting>const char* bonobo_stream_mem_get_buffer    (<link linkend="BonoboStreamMem">BonoboStreamMem</link> *stream_mem);</programlisting>
197
 
<para>
198
 
Returns the buffer associated with a BonoboStreamMem. If the stream
199
 
is set to automatically resize itself, this buffer is only guaranteed
200
 
to stay valid until the next write operation on the stream.</para>
201
 
<para>
202
 
 
203
 
</para><informaltable pgwide="1" frame="none" role="params">
204
 
<tgroup cols="2">
205
 
<colspec colwidth="2*">
206
 
<colspec colwidth="8*">
207
 
<tbody>
208
 
<row><entry align="right"><parameter>stream_mem</parameter>&nbsp;:</entry>
209
 
<entry> a BonoboStreamMem
210
 
</entry></row>
211
 
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a buffer containing the data written to the stream (or
212
 
the data the stream was initialized with if nothing has been written).
213
 
</entry></row>
214
 
</tbody></tgroup></informaltable></refsect2>
215
 
<refsect2>
216
 
<title><anchor id="bonobo-stream-mem-get-size">bonobo_stream_mem_get_size ()</title>
217
 
<programlisting><link linkend="size-t">size_t</link>      bonobo_stream_mem_get_size      (<link linkend="BonoboStreamMem">BonoboStreamMem</link> *stream_mem);</programlisting>
218
 
<para>
219
 
Returns the size of the data associated with a BonoboStreamMem
220
 
see bonobo_stream_mem_get_buffer</para>
221
 
<para>
222
 
 
223
 
</para><informaltable pgwide="1" frame="none" role="params">
224
 
<tgroup cols="2">
225
 
<colspec colwidth="2*">
226
 
<colspec colwidth="8*">
227
 
<tbody>
228
 
<row><entry align="right"><parameter>stream_mem</parameter>&nbsp;:</entry>
229
 
<entry> a BonoboStreamMem
230
 
</entry></row>
231
 
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the size.
232
 
</entry></row>
233
 
</tbody></tgroup></informaltable></refsect2>
234
 
 
235
 
</refsect1>
236
 
 
237
 
 
238
 
 
239
 
<refsect1>
240
 
<title>See Also</title>
241
 
<para>
242
 
  <variablelist>
243
 
    <varlistentry>
244
 
      <term><link linkend="BonoboStream">BonoboStream</link></term>
245
 
      <listitem><para>An abstract class to implement
246
 
      IDL:Bonobo/Streams.</para></listitem>
247
 
    </varlistentry>
248
 
    <varlistentry>
249
 
      <term>IDL:Bonobo/Stream:1.0</term>
250
 
      <listitem><para>The CORBA interface implemented .</para></listitem>
251
 
    </varlistentry>
252
 
   </variablelist>
253
 
</para>
254
 
</refsect1>
255
 
 
256
 
</refentry>