/usr/share/doc/libbobcat4-dev/man/csv.3.html is in libbobcat-dev 4.04.00-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::CSV</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title">FBB::CSV</h1>
<h2 id="author">libbobcat-dev_4.04.00-x.tar.gz</h2>
<h2 id="date">2005-2016</h2>
<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
figure {text-align: center;}
img {vertical-align: center;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title"></h1>
<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::CSV(3bobcat)</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
figure {text-align: center;}
img {vertical-align: center;}
figure {text-align: center;}
img {vertical-align: center;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title">FBB::CSV(3bobcat)</h1>
<h2 id="author">libbobcat-dev_4.04.00-x.tar.gz CSV convertor</h2>
<h2 id="date">2005-2016</h2>
<p>
<h2 >NAME</h2>FBB::CSV - Converter for comma separated values
<p>
<h2 >SYNOPSIS</h2>
<strong >#include <bobcat/csv></strong><br/>
<p>
Linking option: <em >-lbobcat</em>
<p>
<h2 >DESCRIPTION</h2>
<p>
Objects of the class <strong >CSV</strong> can be used to convert series of comma separated
values to the individual separated values. These values may be converted
(individually or as a group) to standard integral types <em >int, size_t, long
long,</em> etc., to floating point types (<em >float, double, long double</em>), or they
can be accessed as <em >std::string</em> values.
<p>
<h2 >NAMESPACE</h2>
<strong >FBB</strong><br/>
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace <strong >FBB</strong>.
<p>
<h2 >INHERITS FROM</h2>
-
<p>
<h2 >TYPEDEFS AND ENUMS</h2>
<p>
The <strong >enum Mode</strong> specifies how a <strong >CSV</strong> is extracted from
<em >std::istream</em> objects:
<ul>
<li> <em >TRAILINGCOMMA</em> a series of comma-separated values ends at a final
comma, which is removed from the <em >istream</em> by the <strong >CSV</strong> extraction
operator.
<li> <em >LINE</em> after extracting a <strong >CSV</strong> object any remaining characters on
the current <em >std::istream</em> line are ignored (i.e., the extraction
operator reads full lines of input).
</ul>
These enumeration values may be combined using the <em >bit-or</em> operator.
<p>
The <strong >enum InsertType</strong> specifies how a <strong >CSV</strong> is inserted into
<em >std::ostream</em> objects:
<ul>
<li> <em >LENGTH</em> indicates that all specifications (i.e., the <em >length</em> of the
type-specifications, see the member <em >length</em> below), are inserted
into the <em >std::ostream</em> as a series of comma-separated values.
<li> <em >SIZE</em> indicates that all (not ignored) comma-separated fields (i.e.,
the <em >size</em> of the fields vector, see the member <em >size</em>
below), are inserted into the <em >std::ostream</em> as a series of
comma-separated values.
<li> <em >COUNT</em> indicates that all valid (i.e., the <em >count</em> of the
valid fields, see the member <em >count</em> below), are inserted
into the <em >std::ostream</em> as a series of comma-separated values.
</ul>
<p>
The class <em >CSV</em> defines the nested classes <em >const_iterator</em> and
<em >const_reverse_iterator</em> which are <em >InputIterators</em>, which can be used
to iterate over the sequence of comma-separated values.
<p>
<h2 >CONSTRUCTORS</h2>
<ul>
<li> <strong >CSV(std::string const &specification, Mode mode = LINE, InsertType =
LENGTH)</strong>:<br/>
The specification in <em >specification</em> defines the subsequent fields
of the comma-separated value. Specifications are
<blockquote >
<ul>
<li> <em >S</em>: the field is left as-is, and can be retrieved as a
<em >std::string</em>.
<li> <em >I</em>: the field represents an <em >int</em> value;
<li> <em >D</em>: the field represents a <em >double</em> value;
<li> <em >X</em> or <em >-</em>: the field is ignored and is not stored inside the
<strong >CSV</strong> object. E.g., with the specification <em >SXS</em> two
fields will actually be stored inside the <strong >CSV</strong> object:
field 0 contains the first field extracted from the input
stream, field 1 contains the third field extracted from the
input stream.
</ul>
</blockquote>
Specifications may be separated by space or tab characters, which are
ignored. The number of specification characters determines the number
of fields that are stored in a <strong >CSV</strong> object. The final field may or
may not be followed by a comma.
<p>
Each specification may also be followed by a positive integral value,
indicating that the input at that point contains that number of
comma-separated fields of the specified type.
<p>
By default the <strong >CSV</strong> extraction operator extracts complete lines
from the stream from which a <strong >CSV</strong> object is extracted.
<p>
When inserting a <strong >CSV</strong> object into a <em >std::ostream</em> object all
fields that are specified by `<em >specification</em>' will be
inserted. Ignored fields will be inserted as single blanks.
</ul>
The default, copy, and move constructors are available.
<p>
<h2 >OVERLOADED OPERATORS</h2>
<ul>
<li> <strong >std::string const &operator[](size_t index) const</strong>:<br/>
The contents of the indicated field is returned as a
<em >std::string</em>.
<p>
<li> <strong >std::istream &operator>>(std::istream &out, CSV const &csv)</strong>:<br/>
The data fields stored within <em >csv</em> are inserted into <em >out</em> as a
series of comma-separated values. The fields are inserted according to
the latest <em >InsertType</em> specification:
<blockquote >
<ul>
<li> For <em >LENGTH</em> all fields are inserted according to their
original type specification, where <em >'X'</em> and <em >'-'</em> fields are
inserted as fields of single blank spaces;
<li> For <em >SIZE</em> all fields that are stored inside <em >csv</em> are
inserted `as-is';
<li> For <em >COUNT</em> all valid fields are inserted.
</ul></blockquote>
If <em >csv</em>'s <em >Mode</em> specification contains <em >TRAILINGCOMMA</em> then a
comma is expected and extracted beyond the last field; if it contains
<em >LINE</em> then any information that is found on the line beyond the
last field (including its terminating comma, if applicable) is ignored
(including the <em >'\n'</em> line terminator).
<p>
<li> <strong >std::ostream &operator<<(std::ostream &out, CSV const &csv)</strong>:<br/>
The data fields stored within <em >csv</em> are inserted into <em >out</em> as a
series of comma-separated values. The fields are inserted according to
the latest <em >InsertType</em> specification:
<blockquote >
<ul>
<li> For <em >LENGTH</em> all fields are inserted according to their
original type specification, where <em >'X'</em> and <em >'-'</em> fields are
inserted as fields of single blank spaces;
<li> For <em >SIZE</em> all fields that are stored inside <em >csv</em> are
inserted `as-is';
<li> For <em >COUNT</em> all valid fields are inserted.
</ul></blockquote>
If <em >csv</em>'s <em >Mode</em> specification contains <em >TRAILINGCOMMA</em> then a
comma is inserted beyond the last field.
</ul>
<p>
The copy and move assignment operators are available.
<p>
<h2 >MEMBER FUNCTIONS</h2>
<ul>
<li> <strong >CSV &append(char spec, std::string const &value = "")</strong>:<br/>
A field <em >spec</em>, with textual representation <em >value</em> is added to the
object's current set of fiels. A specification <em >'X'</em> or
<em >'-'</em> is added to the object's set of specifications, but does not
add <em >value</em> to the currently stored set of values.
<p>
<li> <strong >std::vector<bool> const &available() const</strong>:<br/>
A vector of <em >bool</em> values indicating which of the matching data
fields are valid (i.e., could be converted to its specification as
defined at construction time or by <em >setSpec</em>) is returned.
<p>
<li> <strong >CSV::const_iterator<Type> begin<Type == std::string>() const</strong>:<br/>
This is a template member returning a <em >CSV::const_iterator</em> to the
object's first field. When dereferencing a <em >const_iterator</em> the
value it refers to is converted to the indicated <em >Type</em>. If the
conversion fails, the <em >Type</em>'s default value is returned.
<p>
<li> <strong >size_t count() const</strong>:<br/>
The number of fields that could actually be converted to their
indicated types is returned. E.g., an empty field or a supposedly
numeric field whose contents cannot be converted to the indicated
numeric value won't be counted here.
<p>
<li> <strong >std::vector<std::string> const &data() const</strong>:<br/>
The vector of fields stored inside the <strong >CSV</strong> object is returned.
<p>
<li> <strong >CSV::const_iterator<Type> end<Type == std::string>() const</strong>:<br/>
This is a template member returning a <em >CSV::const_iterator</em> pointing
just beyond the <strong >CSV</strong> object's last field.
<p>
<li> <strong >Type field<Type = std::string>(size_t idx) const</strong>:<br/>
This is a template member returning the contents of field <em >idx</em> as a
value of type <em >Type</em>. When <em >Type</em> equals <em >std::string</em> a
<em >std::string const &</em> is returned. For <em >Type</em> all integral and
floating types as well as <em >std::sting</em> are accepted. If field
<em >idx</em> cannot be converted to <em >Type</em> a <strong >std::exception</strong> is
thrown.
<p>
<li> <strong >Type get<Type = std::string>(size_t idx)</strong>:<br/>
This is a template member returning the contents of field <em >idx</em> as a
value of type <em >Type</em>. When <em >Type</em> equals <em >std::string</em> a
<em >std::string const &</em> is returned. For <em >Type</em> all integral and
floating types as well as <em >std::sting</em> are accepted. If field
<em >idx</em> cannot be converted to <em >Type</em>, the <em >Type</em>'s default value
is returned.
<p>
<li> <strong >InsertType insertType() const</strong>:<br/>
The object's current <em >InsertType</em> is returned.
<p>
<li> <strong >size_t length() const</strong>:<br/>
The number of specifications (defined at construction time or by the
<em >setSpec</em> member) is returned. This count includes the number of
<em >X</em> and <em >-</em> specifications.
<p>
<li> <strong >CSV::Mode mode() const</strong>:<br/>
The object's current <em >Mode</em> value is returned.
<p>
<li> <strong >std::string const &spec() const</strong>:<br/>
The object's current field-type specifications are returned.
<p>
<li> <strong >CSV::const_reverse_iterator<Type> rbegin<Type == std::string>() const</strong>:<br/>
This is a template member returning a <em >CSV::const_reverse_iterator</em>
to the object's last field. When dereferencing a
<em >const_reverse_iterator</em> the value it refers to is converted to the
indicated <em >Type</em>. If the conversion fails, the <em >Type</em>'s default
value is returned.
<p>
<li> <strong >CSV::const_iterator<Type> rend<Type == std::string>() const</strong>:<br/>
This is a template member returning a <em >CSV::const_reverse_iterator</em>
pointing just before the <strong >CSV</strong> object's first field.
<p>
<li> <strong >void setInsertType(InsertType insertType)</strong>:<br/>
The objects <em >InsertType</em> is changed to <em >insertType</em>. This has no
immediate effect, but is only interpreted with the insertion operator.
<p>
<li> <strong >void setMode(Mode mode)</strong>:<br/>
The object's current <em >Mode</em> value is changed to <em >mode</em>. This has no
immediate effect, but is only interpreted with the insertion and
extraction operators.
<p>
<li> <strong >void setSpec(std::string const &spec)</strong>:<br/>
The information stored inside the <strong >CSV</strong> object is erased, and a new
field-specification is defined from <em >spec</em>.
<p>
<li> <strong >size_t size() const</strong>:<br/>
The number of fields is returned (the returned value equals the value
returned by <em >length</em> not counting the <em >X</em> and <em >-</em> fields).
</ul>
<p>
<h2 >EXAMPLE</h2>
<pre >
#include <iostream>
#include <bobcat/csv>
using namespace std;
using namespace FBB;
int main()
{
CSV csv("I5 X2 S2 D3");
cin >> csv;
cout <<
"Nr. of field specs: " << csv.length() << "\n"
"Nr. of fields: " << csv.size() << "\n"
"Nr. of available fields: " << csv.count() << "\n"
"Field 2 as int via get: " << csv.get<int>(2) << "\n"
"Field 2 as int via available: " << csv.field<int>(2) << "\n"
"Field 3 via operator[]: " << csv[3] << "\n"
"Field 6 as string via get: " << csv.get<string>(6) << "\n"
"Field 6 as string via available: " << csv.field<string>(6) << "\n"
;
cout << "First element as string: " << *csv.begin() << "\n";
cout << "All elements as strings:\n";
copy(csv.begin(), csv.end(), ostream_iterator<string>(cout, " "));
cout << '\n';
cout << "All elements as ints:\n";
copy(csv.begin<int>(), csv.end<int>(), ostream_iterator<int>(cout, " "));
cout << '\n';
cout << "All elements as strings, backward:\n";
copy(csv.rbegin(), csv.rend(), ostream_iterator<string>(cout, " "));
cout << '\n';
cout << "All elements as ints, backward:\n";
copy(csv.rbegin<int>(), csv.rend<int>(), ostream_iterator<int>(cout, " "));
cout << '\n';
cout << "Insert LENGTH (default):\n" <<
csv << '\n';
csv.setInsertType(CSV::SIZE);
cout << "Insert SIZE:\n" <<
csv << '\n';
csv.setInsertType(CSV::COUNT);
cout << "Insert COUNT:\n" <<
csv << '\n';
}
</pre>
<p>
<h2 >FILES</h2>
<em >bobcat/csv</em> - defines the class interface
<p>
<h2 >SEE ALSO</h2>
<strong >bobcat</strong>(7)
<p>
<h2 >BUGS</h2>
None Reported.
<p>
<h2 >DISTRIBUTION FILES</h2>
<ul>
<li> <em >bobcat_4.04.00-x.dsc</em>: detached signature;
<li> <em >bobcat_4.04.00-x.tar.gz</em>: source archive;
<li> <em >bobcat_4.04.00-x_i386.changes</em>: change log;
<li> <em >libbobcat1_4.04.00-x_*.deb</em>: debian package holding the
libraries;
<li> <em >libbobcat1-dev_4.04.00-x_*.deb</em>: debian package holding the
libraries, headers and manual pages;
<li> <em >http://sourceforge.net/projects/bobcat</em>: public archive location;
</ul>
<p>
<h2 >BOBCAT</h2>
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
<p>
<h2 >COPYRIGHT</h2>
This is free software, distributed under the terms of the
GNU General Public License (GPL).
<p>
<h2 >AUTHOR</h2>
Frank B. Brokken (<strong >f.b.brokken@rug.nl</strong>).
<p>
|