File: array.html

package info (click to toggle)
boost 1.34.1-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 116,412 kB
  • ctags: 259,566
  • sloc: cpp: 642,395; xml: 56,450; python: 17,612; ansic: 14,520; sh: 2,265; yacc: 858; perl: 481; makefile: 478; lex: 94; sql: 74; csh: 6
file content (224 lines) | stat: -rw-r--r-- 9,610 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
    <TITLE>Array Devices</TITLE>
    <LINK REL="stylesheet" HREF="../../../../boost.css">
    <LINK REL="stylesheet" HREF="../theme/iostreams.css">
</HEAD>
<BODY>

<!-- Begin Banner -->

    <H1 CLASS="title">Array Devices</H1>
    <HR CLASS="banner">

<!-- End Banner -->

<DL class="page-index">
  <DT><A href="#overview">Overview</A></DT>
  <DT><A href="#implementation">Implementation</A></DT>
  <DT><A href="#headers">Headers</A></DT>
  <DT><A href="#reference">Reference</A>
    <DL>
      <DT><A href="#array_source">Class template <CODE>basic_array_source</CODE></A></DT>
      <DT><A href="#array_sink">Class template <CODE>basic_array_sink</CODE></A></DT>
      <DT><A href="#array">Class template <CODE>basic_array</CODE></A></DT>
    </DL>
  </DT>
  <DT><A href="#acknowledgments">Acknowledgments</A></DT>
</DL>

<HR>

<A NAME="overview"></A>
<H2>Overview</H2>

<P>
    The class templates <CODE>basic_array_source</CODE>, <CODE>basic_array_sink</CODE> and <CODE>basic_array</CODE> provide access to a sequence of characters in memory. The array Devices do not manage the lifetimes of the underlying character sequences.
</P>

<A NAME="implementation"></A>
<H2>Implementation</H2>

<P>
    The array Devices are implemented as <A HREF="../concepts/direct.html">Direct</A> Devices in order to provide efficient unbuffered access to the underlying character sequences.
</P>

<A NAME="headers"></A>
<H2>Headers</H2>

<DL class="page-index">
  <DT><A CLASS="header" HREF="../../../../boost/iostreams/device/array.hpp"><CODE>&lt;boost/iostreams/device/array.hpp&gt;</CODE></A></DT>
</DL>

<A NAME="reference"></A>
<H2>Reference</H2>

<A NAME="array_source"></A>
<H3>Class template <CODE>basic_array_source</CODE></H3>

<H4>Description</H4>

<P>Model of <A HREF="../concepts/source.html">Source</A> providing read-only access to a sequence of characters in memory.</P>

<H4>Synopsis</H4>

<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#array_source_params">Ch</A>&gt;
<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#array_source_params">basic_array_source</A> { 
<SPAN CLASS="keyword">public</SPAN>:
    <SPAN CLASS="keyword">typedef</SPAN> Ch          char_type;
    <SPAN CLASS="keyword">typedef</SPAN> source_tag  category;

    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">int</SPAN> N&gt; <A CLASS="documented" HREF="#array_source_constructors">basic_array_source</A>(char_type (&)[N]);
    <A CLASS="documented" HREF="#array_source_constructors">basic_array_source</A>(<SPAN CLASS="keyword">const</SPAN> char_type* begin, <SPAN CLASS="keyword">const</SPAN> char_type* end);
    <A CLASS="documented" HREF="#array_source_constructors">basic_array_source</A>(<SPAN CLASS="keyword">const</SPAN> char_type* begin, std::size_t length);
    <SPAN CLASS="omitted">...</SPAN>
};

<SPAN CLASS="keyword">typedef</SPAN> basic_array_source&lt;<SPAN CLASS="keyword">char</SPAN>&gt;     <SPAN CLASS='defined'>array_source</SPAN>;
<SPAN CLASS="keyword">typedef</SPAN> basic_array_source&lt;<SPAN CLASS="keyword">wchar_t</SPAN>&gt;  <SPAN CLASS='defined'>warray_source</SPAN>;

} } <SPAN CLASS='comment'>// End namespace boost::io</SPAN></PRE>

<A NAME="array_source_params"></A>
<H4>Template parameters</H4>

<TABLE STYLE="margin-left:2em">
<TR>
    <TD><I>Ch</I></TD><TD VALIGN="top">-</TD>
    <TD>The character type.</TD>
</TR>
</TABLE>

<A NAME="array_source_constructors"></A>
<H4><CODE>basic_array_source::basic_array_source</CODE></H4>

<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">int</SPAN> N&gt; basic_array_source(char_type (&)[N]);
basic_array_source(<SPAN CLASS="keyword">const</SPAN> char_type* begin, <SPAN CLASS="keyword">const</SPAN> char_type* end);
basic_array_source(<SPAN CLASS="keyword">const</SPAN> char_type* begin, std::size_t length);</PRE>
    
<P>Constructs a <CODE>basic_array_source</CODE> to read from the indicated character sequence.</P>

<A NAME="array_sink"></A>
<H3>Class template <CODE>basic_array_sink</CODE></H3>

<H4>Description</H4>

<P>Model of <A HREF="../concepts/sink.html">Sink</A> providing write-only access to a sequence of characters in memory.

<H4>Synopsis</H4>

<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#array_sink_params">Ch</A>&gt;
<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#array_sink_params">basic_array_sink</A> { 
<SPAN CLASS="keyword">public</SPAN>:
    <SPAN CLASS="keyword">typedef</SPAN> Ch        char_type;
    <SPAN CLASS="keyword">typedef</SPAN> sink_tag  category;

    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">int</SPAN> N&gt; <A CLASS="documented" HREF="#array_sink_constructors">basic_array_sink</A>(char_type (&)[N]);
    <A CLASS="documented" HREF="#array_sink_constructors">basic_array_sink</A>(char_type* begin, char_type* end);
    <A CLASS="documented" HREF="#array_sink_constructors">basic_array_sink</A>(char_type* begin, std::size_t length);

    <SPAN CLASS="comment">// Additional nember functions</SPAN>
};

<SPAN CLASS="keyword">typedef</SPAN> basic_array_sink&lt;<SPAN CLASS="keyword">char</SPAN>&gt;     <SPAN CLASS='defined'>array_sink</SPAN>;
<SPAN CLASS="keyword">typedef</SPAN> basic_array_sink&lt;<SPAN CLASS="keyword">wchar_t</SPAN>&gt;  <SPAN CLASS='defined'>warray_sink</SPAN>;

} } <SPAN CLASS='comment'>// End namespace boost::io</SPAN></PRE>

<A NAME="array_sink_params"></A>
<H4>Template parameters</H4>

<TABLE STYLE="margin-left:2em">
<TR>
    <TD><I>Ch</I></TD><TD VALIGN="top">-</TD>
    <TD>The character type.</TD>
</TR>
</TABLE>

<A NAME="array_sink_constructors"></A>
<H4><CODE>basic_array_sink::basic_array_sink</CODE></H4>

<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">int</SPAN> N&gt; basic_array_sink(char_type (&)[N]);
basic_array_sink(char_type* begin, char_type* end);
basic_array_sink(char_type* begin, std::size_t length);</PRE>
    
<P>Constructs an <CODE>basic_array_sink</CODE> to write to the indicated character sequence.</P>

<A NAME="array"></A>
<H3>Class template <CODE>basic_array</CODE></H3>

<H4>Description</H4>

<P>Model of <A HREF="../concepts/seekable_device.html">SeekableDevice</A> providing read-write access to a sequence of characters in memory.

<H4>Synopsis</H4>

<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#array_params">Ch</A>&gt;
<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#array_params">basic_array</A> {
<SPAN CLASS="keyword">public</SPAN>:    
    <SPAN CLASS="keyword">typedef</SPAN> Ch                   char_type;
    <SPAN CLASS="keyword">typedef</SPAN> seekable_device_tag  category;

    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">int</SPAN> N&gt; <A CLASS="documented" HREF="#array_constructor">basic_array</A>(char_type (&)[N]);
    <A CLASS="documented" HREF="#array_constructor">basic_array</A>(char_type* begin, char_type* end);
    <A CLASS="documented" HREF="#array_constructor">basic_array</A>(char_type* begin, std::size_t length);

    <SPAN CLASS="comment">// Additional nember functions</SPAN>
};

<SPAN CLASS="keyword">typedef</SPAN> basic_array&lt;<SPAN CLASS="keyword">char</SPAN>&gt;     <SPAN CLASS='defined'>array</SPAN>;
<SPAN CLASS="keyword">typedef</SPAN> basic_array&lt;<SPAN CLASS="keyword">wchar_t</SPAN>&gt;  <SPAN CLASS='defined'>warray</SPAN>;

} } <SPAN CLASS='comment'>// End namespace boost::io</SPAN></PRE>

<A NAME="array_params"></A>
<H4>Template parameters</H4>

<TABLE STYLE="margin-left:2em">
<TR>
    <TD><I>Ch</I></TD><TD VALIGN="top">-</TD>
    <TD>The character type.</TD>
</TR>
</TABLE>

<A NAME="array_constructor"></A>
<H4><CODE>array::array</CODE></H4>

<A NAME="array_constructor"></A>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">int</SPAN> N&gt; basic_array(char_type (&)[N]);
basic_array(char_type* begin, char_type* end);
basic_array(char_type* begin, std::size_t length);</PRE>

<P>Constructs a <CODE>basic_array</CODE> to access the indicated character sequence.</P>

<A NAME="acknowledgments"></A>
<H2>Acknowledgments</H2>

<P>
The concept of Devices which provide unbuffered access to character sequences was suggested by <A HREF="../../../../people/daryle_walker.html">Daryle Walker's</A> <A HREF="http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/libs/io/doc/array_stream.html"><CODE>array_stream</CODE></A> template.
</P>

<!-- Begin Footer -->

<HR>
<P CLASS="copyright">Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
20 May, 2004
<!--webbot bot="Timestamp" endspan i-checksum="38504" -->
</P>

<P CLASS="copyright">&copy; Copyright <A HREF="http://www.kangaroologic.com" TARGET="_top">Jonathan Turkanis</A>, 2004</P>
<P CLASS="copyright"> 
    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)
</P>

<!-- End Footer -->

</BODY>