/usr/share/doc/libbobcat4-dev/man/string.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 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::String</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::String</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::String(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::String(3bobcat)</h1>
<h2 id="author">libbobcat-dev_4.04.00-x.tar.gz Operations on std::string objects</h2>
<h2 id="date">2005-2016</h2>
<p>
<h2 >NAME</h2>FBB::String - Several operations on <strong >std::string</strong> objects
<p>
<h2 >SYNOPSIS</h2>
<strong >#include <bobcat/string></strong><br/>
Linking option: <em >-lbobcat</em>
<p>
<h2 >DESCRIPTION</h2>
This class offers facilities for often used transformations on
<em >std::string</em> objects, but which are not supported by the <em >std::string</em>
class itself. All members of <strong >FBB::String</strong> are static.
<p>
<h2 >NAMESPACE</h2>
<strong >FBB</strong><br/>
All members, operators and manipulators, mentioned in this man-page, are
defined in the namespace <strong >FBB</strong>.
<p>
<h2 >INHERITS FROM</h2>
--
<p>
<h2 >ENUMERATION</h2>
<ul>
<li> <strong >Type</strong>:<br/>
This enumeration indicates the nature of the contents of an element in
the array returned by the overloaded <em >split</em> members (see below).
<p>
<strong >DQUOTE</strong>, a subset of the characters in the matching <em >string</em>
element was delimited by double quotes in the in the string that was parsed by
the <em >split</em> members.
<p>
<strong >DQUOTE_UNTERMINATED</strong>, the contents of the string that was
parsed by the <em >split</em> members started at some point with a double quote, but
the matching ending double quote was lacking.
<p>
<strong >ESCAPED_END</strong>, the contents of the string that was
parsed by the <em >split</em> members ended in a mere backslash.
<p>
<strong >NORMAL</strong>, a normal string;
<p>
<strong >SEPARATOR</strong>, a separator;
<p>
<strong >SQUOTE</strong>, a subset of the characters in the matching <em >string</em>
element was delimited by quotes in the in the string that was parsed by
the <em >split</em> members.
<p>
<strong >SQUOTE_UNTERMINATED</strong>, the contents of the string that was
parsed by the <em >split</em> members started at some point with a quote, but
the matching ending quote was lacking.
</ul>
<p>
<h2 >TYPEDEF</h2>
<p>
The <strong >typedef SplitPair</strong> represents <strong >std::pair<std::string,
String::Type></strong> and is used in the second variant of the <strong >split</strong> member (see
below).
<p>
<h2 >HISTORY</h2>
Initially this class was derived from <strong >std::string</strong>. Deriving from
<em >std::string</em>, however, is considerd bad design as <em >std::string</em> was
not designed as a base-class.
<p>
<strong >FBB::String</strong> offers a series of <em >static</em> member functions
providing the facilities originally implemented as non-static members.
<p>
<h2 >STATIC MEMBER FUNCTIONS</h2>
<ul>
<p>
<li> <strong >char const **argv(std::vector<std::string> const &words)</strong>:<br/>
Returns a pointer to an allocated series of pointers to the <strong >C</strong>
strings stored in the vector <em >words</em>. The caller is responsible for
returning the array of pointers to the common pool, but should <em >not</em> delete
the <strong >C</strong>-strings to which the pointers point. The last element of the
returned array is guaranteed to be a 0-pointer.
<p>
<li> <strong >int casecmp(std::string const &lhs, std::string const &rhs)</strong>:<br/>
Performs a case-insensitive comparison between the two <em >std::string</em>
objects. A negative value is returned if <em >lhs</em> should be ordered before
<em >rhs</em>; 0 is returned if the two strings have identical contents; a
positive value is returned if the <em >lhs</em> object should be ordered beyond
<em >rhs</em>.
<p>
<li> <strong >std::string escape(std::string const &str,
char const *series = "'\"\\")</strong>:<br/>
Returns a copy of the <em >str</em> object in which all characters in
<em >series</em> are prefixed by a backslash character.
<p>
<li> <strong >std::string lc(std::string const &str) const</strong>:<br/>
Returns a copy of the <em >str</em> object in which all letters were
transformed to lower case letters.
<p>
<li> <strong >std::string trim(std::string const &str)</strong>:<br/>
Returns a copy of the <em >str</em> object from which the leading and
trailing blanks have been removed.
<p>
<li> <strong >std::vector<std::string> split(Type *type, std::string const
&str, char const *separators = " \t", bool addEmpty = false)</strong>:<br/>
Returns a vector containing the elements in <em >str</em> which are
separated from each other by at least one of the characters found in
<em >*separators</em>. The member's first parameter points to a <em >Type</em> variable,
which will show <em >DQUOTE_UNTERMINATED, SQUOTE_UNTERMINATED,</em> or
<em >ESCAPED_END</em> in cases where the contents of <em >str</em> are ill-formed, or
<em >NORMAL</em> if <em >str</em>'s contents shows not syntactic errors (i.e., ill-formed
strings or escape-sequences). If the corresponding argument equals 0 then no
<em >Type</em> indication is provided.
<p>
If the parameter <em >addEmpty</em> is set to <em >true</em>, then individual separators
encountered in <em >str</em> are stored as empty strings in <em >words</em> (e.g., if two
elements are separated by three blank spaces, then the returned vector
contains three empty strings between the two elements).
<p>
If an element in <em >str</em> contains a double quote (<em >"</em>), then all characters
from the initial double quote through the matching double quote character are
processed as follows: the surrounding double quotes are removed, and the
remaining characters are <em >unescaped</em> using the <em >String::unescape</em>
member. The resulting unescaped string is added to the element currently under
construction. E.g., if <em >str</em> contains
<pre>
string="\"hello world\""
</pre>
then the element becomes
<pre>
string="hello world"
</pre>
<p>
If an element in <em >str</em> contains a single quote (<em >'</em>), then all characters
between the initial quote and the matching quote character are literally
appended to the element currently under construction. E.g., if <em >str</em>
contains
<pre>
string='"hello\ world"'
</pre>
then the element becomes
<pre>
string="hello\ world"
</pre>
<p>
Backslash characters encountered in <em >str</em> outside of single or double quoted
strings are unescaped (using <em >String::unescape</em>) and the resulting character
is appended to the element currently under construction.
<p>
E.g., if <em >str</em>
contains
<pre>
string=\"hello\ world\"
</pre>
then the element becomes
<pre>
string="hello world"
</pre>
<p>
<li> <strong >std::vector<SplitPair> split(std::string const &str,
char const *separators = " \t", bool addEmpty = false)</strong>:<br/>
Same functionality as the previous <em >split</em> member, but the <em >words</em>
vector is filled with pairs, of which the first elements represent the
recognized strings, and the second elements are values of the <em >String::Type</em>
enumeration. If <strong >addEmpty</strong> is requested, then the <strong >string</strong> elements
contain the actual contents of the separator, while the <strong >Type</strong> elements are
set to <strong >SEPARATOR</strong>. If the returned vector is not empty then the <em >second</em>
member of the last element may be <em >DQUOTE_UNTERMINATED,
SQUOTE_UNTERMINATED,</em> or <em >ESCAPED_END</em> in cases where the contents of
<em >str</em> are ill-formed.
<p>
<li> <strong >size_t split(std::vector<std::string> *words,
std::string const &str,
char const *separators = " \t", bool addEmpty = false)</strong>:<br/>
Fills <em >words</em> with all elements of the <em >str</em> object, separated by
any of the characters in <em >separators</em>. If the parameter <em >addEmpty</em> is set
to <em >true</em>, the individual separators are stored as empty strings in
<em >words</em>. If a word starts with <em >"</em> or <em >'</em> all characters until a
matching terminating <em >"</em> or <em >'</em> at the end of a word are considered as one
word. The surrounding quotes are not stored. The function returns the number
of elements in the vector pointed to by <em >words</em>. This vector is initially
cleared.
<p>
<li> <strong >size_t split(std::vector<SplitPair> *words,
std::string const &str,
char const *separators = " \t", bool addEmpty = false)</strong>:<br/>
Same functionality as the former member, but the <em >words</em> vector is
filled with pairs, of which the first elements are the recognized strings, and
the second elements values of the <em >String::Type</em> enumeration. If
<strong >addEmpty</strong> is requested, then the <strong >string</strong> elements contain the actual
contents of the separator, while the <strong >Type</strong> elements are set to
<strong >SEPARATOR</strong>.
<p>
<li> <strong >std::string unescape(std::string const &str)</strong>:<br/>
Returns a copy of the <em >str</em> object in which the escaped (i.e.,
prefixed by a backslash) characters have been interpreted. All standard escape
characters (<em >\a</em>, <em >\b</em>, <em >\f</em>, <em >\n</em>, <em >\r</em>, <em >\t</em>, <em >\v</em>) are
recognized. If an escape character is followed by <em >x</em> the next two
characters are interpreted as a hexadecimal number. If an escape character is
followed by an octal digit, then the next three characters following the
backslash are interpreted as an octal number. In all other cases, the
backslash is removed and the character following the backslash is kept.
<p>
<li> <strong >std::string uc(std::string const &str)</strong>:<br/>
Returns a copy of the <em >str</em> object in which all letters were
capitalized.
</ul>
<p>
<h2 >EXAMPLE</h2>
<pre>
#include <iostream>
#include <vector>
#include <bobcat/string>
using namespace std;
using namespace FBB;
char const *type[] =
{
"DQUOTE_UNTERMINATED",
"SQUOTE_UNTERMINATED",
"ESCAPED_END",
"SEPARATOR",
"NORMAL",
"DQUOTE",
"SQUOTE",
};
int main(int argc, char **argv)
{
cout << "Program's name in uppercase: " << String::uc(argv[0]) << endl;
if (argc == 1)
cout << "Provide any argument to suppress SEPARATOR fields\n";
while (true)
{
cout << "Enter a line, or empty line to stop:" << endl;
String line;
if (!getline(cin, line) || !line.length())
break;
vector<String::SplitPair> splitpair;
cout << "Split into " << line.split(&splitpair, " \t", argc == 1) <<
" fields\n";
for
(
vector<String::SplitPair>::iterator it = splitpair.begin();
it != splitpair.end();
++it
)
cout << (it - splitpair.begin() + 1) << ": " <<
type[it->second] << ": `" << it->first <<
"', unescaped: `" << String(it->first).unescape() <<
"'" << endl;
}
return 0;
}
</pre>
<p>
<h2 >FILES</h2>
<em >bobcat/string</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>
|