1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
3
5
<title>Ipelib: ipe::String Class Reference</title>
4
<link href="tabs.css" rel="stylesheet" type="text/css">
5
<link href="doxygen.css" rel="stylesheet" type="text/css">
7
<!-- Generated by Doxygen 1.5.8 -->
8
<div class="navigation" id="top">
11
<li><a href="index.html"><span>Main Page</span></a></li>
6
<link href="tabs.css" rel="stylesheet" type="text/css"/>
7
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
10
<!-- Generated by Doxygen 1.7.3 -->
13
<table cellspacing="0" cellpadding="0">
15
<tr style="height: 56px;">
16
<td style="padding-left: 0.5em;">
17
<div id="projectname">Ipelib</div>
23
<div id="navrow1" class="tabs">
25
<li><a href="index.html"><span>Main Page</span></a></li>
12
26
<li><a href="modules.html"><span>Modules</span></a></li>
13
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
14
27
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
30
<div id="navrow2" class="tabs2">
32
<li><a href="annotated.html"><span>Class List</span></a></li>
33
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
34
<li><a href="functions.html"><span>Class Members</span></a></li>
37
<div id="nav-path" class="navpath">
19
<li><a href="annotated.html"><span>Class List</span></a></li>
20
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
21
<li><a href="functions.html"><span>Class Members</span></a></li>
24
<div class="navpath"><a class="el" href="namespaceipe.html">ipe</a>::<a class="el" href="classipe_1_1_string.html">String</a>
39
<li class="navelem"><b>ipe</b> </li>
40
<li class="navelem"><a class="el" href="classipe_1_1_string.html">String</a> </li>
44
<a href="#nested-classes">Classes</a> |
45
<a href="#pub-methods">Public Member Functions</a> </div>
46
<div class="headertitle">
47
<h1>ipe::String Class Reference<div class="ingroups"><a class="el" href="group__base.html">Ipe Base</a></div></h1> </div>
27
49
<div class="contents">
28
<h1>ipe::String Class Reference<br>
30
[<a class="el" href="group__base.html">Ipe Base</a>]</small>
31
</h1><!-- doxytag: class="ipe::String" -->Strings and buffers.
32
<a href="#_details">More...</a>
34
<code>#include <ipebase.h></code>
38
<a href="classipe_1_1_string-members.html">List of all members.</a><h2>Classes</h2>
50
<!-- doxytag: class="ipe::String" -->
51
<p>Strings and buffers.
52
<a href="#_details">More...</a></p>
54
<p><code>#include <ipebase.h></code></p>
56
<p><a href="classipe_1_1_string-members.html">List of all members.</a></p>
57
<h2><a name="nested-classes"></a>
40
60
<li>struct <b>Imp</b>
42
<h2>Public Member Functions</h2>
62
<h2><a name="pub-methods"></a>
63
Public Member Functions</h2>
44
<li><a class="el" href="classipe_1_1_string.html#8a7ef356e05eb9b1ea1ab518baee3095">String</a> ()
45
<li><a class="el" href="classipe_1_1_string.html#3fba40cf6cb11735ffddc355a5ff68f4">String</a> (const char *str)
46
<li><a class="el" href="classipe_1_1_string.html#117f8a4ef8cd2c6b3632324b0146d7ae">String</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
47
<li><a class="el" href="classipe_1_1_string.html#38b584c89d79a8b6654e8d40577695d0">String</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs, int index, int len)
48
<li><a class="el" href="classipe_1_1_string.html">String</a> & <a class="el" href="classipe_1_1_string.html#70b3aba8ac7a57e3bb48a52a5d64a88b">operator=</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
49
<li><a class="el" href="classipe_1_1_string.html#c40b2a3fb58c2d8556f5e6ff73510036">~String</a> ()
50
<li>char <a class="el" href="classipe_1_1_string.html#31bf41d9c7e2a85ade1cd9c6ba17e4f5">operator[]</a> (int i) const
51
<li>bool <a class="el" href="classipe_1_1_string.html#5a053d22050137196cca9cca1a4e9b42">empty</a> () const
52
<li>bool <a class="el" href="classipe_1_1_string.html#a8ad780569e40cc86c1afb0475910c57">isEmpty</a> () const
53
<li>const char * <a class="el" href="classipe_1_1_string.html#57a7cd02ec8eee40eec446e27b331e59">data</a> () const
54
<li>int <a class="el" href="classipe_1_1_string.html#025d035cd6ff7deaa9fdfa96ba39129f">size</a> () const
55
<li>void <a class="el" href="classipe_1_1_string.html#df2969eaf89907e88bbeb90e97d37b38">operator+=</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
56
<li>void <a class="el" href="classipe_1_1_string.html#d17c4955f194bf3cc38073916a41ccd6">operator+=</a> (char ch)
57
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#5d2bc42037447ee489350c56774e627c">substr</a> (int i, int len=-1) const
58
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#8b6748ce34485f3b137de02357a5b5cf">left</a> (int i) const
59
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#71db37324cbd157f031326870722a852">right</a> (int i) const
60
<li>bool <a class="el" href="classipe_1_1_string.html#407ac1c536d9ab9d6f8d768e68b40e7a">operator!=</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
61
<li>int <a class="el" href="classipe_1_1_string.html#b37400fd0ed547f7c65dc29cf73643ee">find</a> (char ch) const
62
<li>int <a class="el" href="classipe_1_1_string.html#dcf7cd202938ad0798ced0380d0e141d">rfind</a> (char ch) const
63
<li>int <a class="el" href="classipe_1_1_string.html#ef7b09a6d79e02936427a5e39734e01e">find</a> (const char *rhs) const
64
<li>void <a class="el" href="classipe_1_1_string.html#3ce2ea55be9ec912bb2dbc88d461b479">erase</a> ()
65
<li>void <a class="el" href="classipe_1_1_string.html#887c957724678e481e1dd0d8753e8d01">append</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
66
<li>void <a class="el" href="classipe_1_1_string.html#2bbaae7f5d8733e35baabdbadc039dab">append</a> (char ch)
67
<li>bool <a class="el" href="classipe_1_1_string.html#b1426554db4fc54efba8c80be7ab87c9">operator==</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
68
<li>bool <a class="el" href="classipe_1_1_string.html#d17973b1a6ca7be84afdbb32ac3ed4e3">operator<</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
69
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#b42e009ab85d895999ee3208048df18b">operator+</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
70
<li>int <a class="el" href="classipe_1_1_string.html#5c4533ae4f17acb2735761e8ff83185d">unicode</a> (int &index) const
71
<li>const char * <a class="el" href="classipe_1_1_string.html#964635e9e0c6178d63110410ec9ab7dc">z</a> () const
73
<hr><a name="_details"></a><h2>Detailed Description</h2>
76
<a class="el" href="classipe_1_1_string.html" title="Strings and buffers.">String</a> is is an implicitly shared byte string. It is designed to be efficient for strings of arbitrary length, and supposed to be passed by value (the size of <a class="el" href="classipe_1_1_string.html" title="Strings and buffers.">String</a> is a single pointer). Sharing is implicit---the string creates its own representation as soon as it is modified.<p>
77
<a class="el" href="classipe_1_1_string.html" title="Strings and buffers.">String</a> can be used for binary data. For text, it is usually assumed that the string is UTF-8 encoded, but only the unicode member function actually requires this. In particular, all indices into the string are byte indices, not Unicode character indices. <hr><h2>Constructor & Destructor Documentation</h2>
78
<a class="anchor" name="8a7ef356e05eb9b1ea1ab518baee3095"></a><!-- doxytag: member="ipe::String::String" ref="8a7ef356e05eb9b1ea1ab518baee3095" args="()" -->
80
<div class="memproto">
81
<table class="memname">
83
<td class="memname">String::String </td>
85
<td class="paramname"> </td>
86
<td> ) </td>
94
Construct an empty string.
99
<a class="anchor" name="3fba40cf6cb11735ffddc355a5ff68f4"></a><!-- doxytag: member="ipe::String::String" ref="3fba40cf6cb11735ffddc355a5ff68f4" args="(const char *str)" -->
100
<div class="memitem">
101
<div class="memproto">
102
<table class="memname">
104
<td class="memname">String::String </td>
106
<td class="paramtype">const char * </td>
107
<td class="paramname"> <em>str</em> </td>
108
<td> ) </td>
116
Construct a string by making copy of <em>str</em>.
121
<a class="anchor" name="117f8a4ef8cd2c6b3632324b0146d7ae"></a><!-- doxytag: member="ipe::String::String" ref="117f8a4ef8cd2c6b3632324b0146d7ae" args="(const String &rhs)" -->
122
<div class="memitem">
123
<div class="memproto">
124
<table class="memname">
126
<td class="memname">String::String </td>
128
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
129
<td class="paramname"> <em>rhs</em> </td>
130
<td> ) </td>
138
Copy constructor. This only copies the reference and takes constant time.
143
<a class="anchor" name="38b584c89d79a8b6654e8d40577695d0"></a><!-- doxytag: member="ipe::String::String" ref="38b584c89d79a8b6654e8d40577695d0" args="(const String &rhs, int index, int len)" -->
144
<div class="memitem">
145
<div class="memproto">
146
<table class="memname">
148
<td class="memname">String::String </td>
150
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
151
<td class="paramname"> <em>rhs</em>, </td>
154
<td class="paramkey"></td>
156
<td class="paramtype">int </td>
157
<td class="paramname"> <em>index</em>, </td>
160
<td class="paramkey"></td>
162
<td class="paramtype">int </td>
163
<td class="paramname"> <em>len</em></td><td> </td>
168
<td></td><td></td><td></td>
175
Construct a substring.
177
<em>index</em> must be >= 0. <em>len</em> can be negative or too large to return entire string.
180
<a class="anchor" name="c40b2a3fb58c2d8556f5e6ff73510036"></a><!-- doxytag: member="ipe::String::~String" ref="c40b2a3fb58c2d8556f5e6ff73510036" args="()" -->
181
<div class="memitem">
182
<div class="memproto">
183
<table class="memname">
185
<td class="memname">String::~String </td>
187
<td class="paramname"> </td>
188
<td> ) </td>
196
Destruct string if reference count has reached zero.
201
<hr><h2>Member Function Documentation</h2>
202
<a class="anchor" name="70b3aba8ac7a57e3bb48a52a5d64a88b"></a><!-- doxytag: member="ipe::String::operator=" ref="70b3aba8ac7a57e3bb48a52a5d64a88b" args="(const String &rhs)" -->
203
<div class="memitem">
204
<div class="memproto">
205
<table class="memname">
207
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> & String::operator= </td>
209
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
210
<td class="paramname"> <em>rhs</em> </td>
211
<td> ) </td>
219
Assignment takes constant time.
224
<a class="anchor" name="31bf41d9c7e2a85ade1cd9c6ba17e4f5"></a><!-- doxytag: member="ipe::String::operator[]" ref="31bf41d9c7e2a85ade1cd9c6ba17e4f5" args="(int i) const " -->
225
<div class="memitem">
226
<div class="memproto">
227
<table class="memname">
229
<td class="memname">char ipe::String::operator[] </td>
231
<td class="paramtype">int </td>
232
<td class="paramname"> <em>i</em> </td>
233
<td> ) </td>
234
<td> const<code> [inline]</code></td>
241
Return character at index i.
246
<a class="anchor" name="5a053d22050137196cca9cca1a4e9b42"></a><!-- doxytag: member="ipe::String::empty" ref="5a053d22050137196cca9cca1a4e9b42" args="() const " -->
247
<div class="memitem">
248
<div class="memproto">
249
<table class="memname">
251
<td class="memname">bool ipe::String::empty </td>
253
<td class="paramname"> </td>
254
<td> ) </td>
255
<td> const<code> [inline]</code></td>
267
<a class="anchor" name="a8ad780569e40cc86c1afb0475910c57"></a><!-- doxytag: member="ipe::String::isEmpty" ref="a8ad780569e40cc86c1afb0475910c57" args="() const " -->
268
<div class="memitem">
269
<div class="memproto">
270
<table class="memname">
272
<td class="memname">bool ipe::String::isEmpty </td>
274
<td class="paramname"> </td>
275
<td> ) </td>
276
<td> const<code> [inline]</code></td>
288
<a class="anchor" name="57a7cd02ec8eee40eec446e27b331e59"></a><!-- doxytag: member="ipe::String::data" ref="57a7cd02ec8eee40eec446e27b331e59" args="() const " -->
289
<div class="memitem">
290
<div class="memproto">
291
<table class="memname">
293
<td class="memname">const char* ipe::String::data </td>
295
<td class="paramname"> </td>
296
<td> ) </td>
297
<td> const<code> [inline]</code></td>
304
Return read-only pointer to the data.
309
<a class="anchor" name="025d035cd6ff7deaa9fdfa96ba39129f"></a><!-- doxytag: member="ipe::String::size" ref="025d035cd6ff7deaa9fdfa96ba39129f" args="() const " -->
310
<div class="memitem">
311
<div class="memproto">
312
<table class="memname">
314
<td class="memname">int ipe::String::size </td>
316
<td class="paramname"> </td>
317
<td> ) </td>
318
<td> const<code> [inline]</code></td>
325
Return number of bytes in the string.
330
<a class="anchor" name="df2969eaf89907e88bbeb90e97d37b38"></a><!-- doxytag: member="ipe::String::operator+=" ref="df2969eaf89907e88bbeb90e97d37b38" args="(const String &rhs)" -->
331
<div class="memitem">
332
<div class="memproto">
333
<table class="memname">
335
<td class="memname">void ipe::String::operator+= </td>
337
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
338
<td class="paramname"> <em>rhs</em> </td>
339
<td> ) </td>
340
<td><code> [inline]</code></td>
347
Operator syntax for append.
352
<a class="anchor" name="d17c4955f194bf3cc38073916a41ccd6"></a><!-- doxytag: member="ipe::String::operator+=" ref="d17c4955f194bf3cc38073916a41ccd6" args="(char ch)" -->
353
<div class="memitem">
354
<div class="memproto">
355
<table class="memname">
357
<td class="memname">void ipe::String::operator+= </td>
359
<td class="paramtype">char </td>
360
<td class="paramname"> <em>ch</em> </td>
361
<td> ) </td>
362
<td><code> [inline]</code></td>
369
Operator syntax for append.
374
<a class="anchor" name="5d2bc42037447ee489350c56774e627c"></a><!-- doxytag: member="ipe::String::substr" ref="5d2bc42037447ee489350c56774e627c" args="(int i, int len=-1) const " -->
375
<div class="memitem">
376
<div class="memproto">
377
<table class="memname">
379
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> ipe::String::substr </td>
381
<td class="paramtype">int </td>
382
<td class="paramname"> <em>i</em>, </td>
385
<td class="paramkey"></td>
387
<td class="paramtype">int </td>
388
<td class="paramname"> <em>len</em> = <code>-1</code></td><td> </td>
393
<td></td><td></td><td> const<code> [inline]</code></td>
405
<a class="anchor" name="8b6748ce34485f3b137de02357a5b5cf"></a><!-- doxytag: member="ipe::String::left" ref="8b6748ce34485f3b137de02357a5b5cf" args="(int i) const " -->
406
<div class="memitem">
407
<div class="memproto">
408
<table class="memname">
410
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> ipe::String::left </td>
412
<td class="paramtype">int </td>
413
<td class="paramname"> <em>i</em> </td>
414
<td> ) </td>
415
<td> const<code> [inline]</code></td>
422
Create substring at the left.
427
<a class="anchor" name="71db37324cbd157f031326870722a852"></a><!-- doxytag: member="ipe::String::right" ref="71db37324cbd157f031326870722a852" args="(int i) const " -->
428
<div class="memitem">
429
<div class="memproto">
430
<table class="memname">
432
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> String::right </td>
434
<td class="paramtype">int </td>
435
<td class="paramname"> <em>i</em> </td>
436
<td> ) </td>
444
Create substring at the right.
446
Returns the entire string if <em>i</em> is larger than its length.
449
<a class="anchor" name="407ac1c536d9ab9d6f8d768e68b40e7a"></a><!-- doxytag: member="ipe::String::operator!=" ref="407ac1c536d9ab9d6f8d768e68b40e7a" args="(const String &rhs) const " -->
450
<div class="memitem">
451
<div class="memproto">
452
<table class="memname">
454
<td class="memname">bool ipe::String::operator!= </td>
456
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
457
<td class="paramname"> <em>rhs</em> </td>
458
<td> ) </td>
459
<td> const<code> [inline]</code></td>
471
<a class="anchor" name="b37400fd0ed547f7c65dc29cf73643ee"></a><!-- doxytag: member="ipe::String::find" ref="b37400fd0ed547f7c65dc29cf73643ee" args="(char ch) const " -->
472
<div class="memitem">
473
<div class="memproto">
474
<table class="memname">
476
<td class="memname">int String::find </td>
478
<td class="paramtype">char </td>
479
<td class="paramname"> <em>ch</em> </td>
480
<td> ) </td>
488
Return index of first occurrence of ch.
490
Return -1 if character does not appear.
493
<a class="anchor" name="dcf7cd202938ad0798ced0380d0e141d"></a><!-- doxytag: member="ipe::String::rfind" ref="dcf7cd202938ad0798ced0380d0e141d" args="(char ch) const " -->
494
<div class="memitem">
495
<div class="memproto">
496
<table class="memname">
498
<td class="memname">int String::rfind </td>
500
<td class="paramtype">char </td>
501
<td class="paramname"> <em>ch</em> </td>
502
<td> ) </td>
510
Return index of last occurrence of ch.
512
Return -1 if character does not appear.
515
<a class="anchor" name="ef7b09a6d79e02936427a5e39734e01e"></a><!-- doxytag: member="ipe::String::find" ref="ef7b09a6d79e02936427a5e39734e01e" args="(const char *rhs) const " -->
516
<div class="memitem">
517
<div class="memproto">
518
<table class="memname">
520
<td class="memname">int String::find </td>
522
<td class="paramtype">const char * </td>
523
<td class="paramname"> <em>rhs</em> </td>
524
<td> ) </td>
532
Return index of first occurrence of rhs.
534
Return -1 if not substring is not present.
537
<a class="anchor" name="3ce2ea55be9ec912bb2dbc88d461b479"></a><!-- doxytag: member="ipe::String::erase" ref="3ce2ea55be9ec912bb2dbc88d461b479" args="()" -->
538
<div class="memitem">
539
<div class="memproto">
540
<table class="memname">
542
<td class="memname">void String::erase </td>
544
<td class="paramname"> </td>
545
<td> ) </td>
558
<a class="anchor" name="887c957724678e481e1dd0d8753e8d01"></a><!-- doxytag: member="ipe::String::append" ref="887c957724678e481e1dd0d8753e8d01" args="(const String &rhs)" -->
559
<div class="memitem">
560
<div class="memproto">
561
<table class="memname">
563
<td class="memname">void String::append </td>
565
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
566
<td class="paramname"> <em>rhs</em> </td>
567
<td> ) </td>
575
Append <em>rhs</em> to this string.
580
<a class="anchor" name="2bbaae7f5d8733e35baabdbadc039dab"></a><!-- doxytag: member="ipe::String::append" ref="2bbaae7f5d8733e35baabdbadc039dab" args="(char ch)" -->
581
<div class="memitem">
582
<div class="memproto">
583
<table class="memname">
585
<td class="memname">void String::append </td>
587
<td class="paramtype">char </td>
588
<td class="paramname"> <em>ch</em> </td>
589
<td> ) </td>
597
Append <em>ch</em> to this string.
602
<a class="anchor" name="b1426554db4fc54efba8c80be7ab87c9"></a><!-- doxytag: member="ipe::String::operator==" ref="b1426554db4fc54efba8c80be7ab87c9" args="(const String &rhs) const " -->
603
<div class="memitem">
604
<div class="memproto">
605
<table class="memname">
607
<td class="memname">bool String::operator== </td>
609
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
610
<td class="paramname"> <em>rhs</em> </td>
611
<td> ) </td>
619
Equality operator (bytewise comparison).
624
<a class="anchor" name="d17973b1a6ca7be84afdbb32ac3ed4e3"></a><!-- doxytag: member="ipe::String::operator<" ref="d17973b1a6ca7be84afdbb32ac3ed4e3" args="(const String &rhs) const " -->
625
<div class="memitem">
626
<div class="memproto">
627
<table class="memname">
629
<td class="memname">bool String::operator< </td>
631
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
632
<td class="paramname"> <em>rhs</em> </td>
633
<td> ) </td>
641
Inequality operator (bytewise comparison).
646
<a class="anchor" name="b42e009ab85d895999ee3208048df18b"></a><!-- doxytag: member="ipe::String::operator+" ref="b42e009ab85d895999ee3208048df18b" args="(const String &rhs) const " -->
647
<div class="memitem">
648
<div class="memproto">
649
<table class="memname">
651
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> String::operator+ </td>
653
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
654
<td class="paramname"> <em>rhs</em> </td>
655
<td> ) </td>
663
Concatenate this string with <em>rhs</em>.
668
<a class="anchor" name="5c4533ae4f17acb2735761e8ff83185d"></a><!-- doxytag: member="ipe::String::unicode" ref="5c4533ae4f17acb2735761e8ff83185d" args="(int &index) const " -->
669
<div class="memitem">
670
<div class="memproto">
671
<table class="memname">
673
<td class="memname">int String::unicode </td>
675
<td class="paramtype">int & </td>
676
<td class="paramname"> <em>index</em> </td>
677
<td> ) </td>
685
Return Unicode value from UTF-8 string.
687
The <em>index</em> is incremented to the next UTF-8 character. This returns 0xfffd if there is any problem in parsing UTF-8.
690
<a class="anchor" name="964635e9e0c6178d63110410ec9ab7dc"></a><!-- doxytag: member="ipe::String::z" ref="964635e9e0c6178d63110410ec9ab7dc" args="() const " -->
691
<div class="memitem">
692
<div class="memproto">
693
<table class="memname">
695
<td class="memname">const char * String::z </td>
697
<td class="paramname"> </td>
698
<td> ) </td>
706
Return a C style string with final zero byte.
711
<hr>The documentation for this class was generated from the following files:<ul>
712
<li>ipebase.h<li>ipebase.cpp</ul>
65
<li><a class="el" href="classipe_1_1_string.html#a8a7ef356e05eb9b1ea1ab518baee3095">String</a> ()
66
<li><a class="el" href="classipe_1_1_string.html#a3fba40cf6cb11735ffddc355a5ff68f4">String</a> (const char *str)
67
<li><a class="el" href="classipe_1_1_string.html#a117f8a4ef8cd2c6b3632324b0146d7ae">String</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
68
<li><a class="el" href="classipe_1_1_string.html#a38b584c89d79a8b6654e8d40577695d0">String</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs, int index, int len)
69
<li><a class="el" href="classipe_1_1_string.html">String</a> & <a class="el" href="classipe_1_1_string.html#a70b3aba8ac7a57e3bb48a52a5d64a88b">operator=</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
70
<li><a class="el" href="classipe_1_1_string.html#ac40b2a3fb58c2d8556f5e6ff73510036">~String</a> ()
71
<li>char <a class="el" href="classipe_1_1_string.html#a31bf41d9c7e2a85ade1cd9c6ba17e4f5">operator[]</a> (int i) const
72
<li>bool <a class="el" href="classipe_1_1_string.html#a5a053d22050137196cca9cca1a4e9b42">empty</a> () const
73
<li>bool <a class="el" href="classipe_1_1_string.html#aa8ad780569e40cc86c1afb0475910c57">isEmpty</a> () const
74
<li>const char * <a class="el" href="classipe_1_1_string.html#a57a7cd02ec8eee40eec446e27b331e59">data</a> () const
75
<li>int <a class="el" href="classipe_1_1_string.html#a025d035cd6ff7deaa9fdfa96ba39129f">size</a> () const
76
<li>void <a class="el" href="classipe_1_1_string.html#adf2969eaf89907e88bbeb90e97d37b38">operator+=</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
77
<li>void <a class="el" href="classipe_1_1_string.html#ad17c4955f194bf3cc38073916a41ccd6">operator+=</a> (char ch)
78
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#a5d2bc42037447ee489350c56774e627c">substr</a> (int i, int len=-1) const
79
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#a8b6748ce34485f3b137de02357a5b5cf">left</a> (int i) const
80
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#a71db37324cbd157f031326870722a852">right</a> (int i) const
81
<li>bool <a class="el" href="classipe_1_1_string.html#a407ac1c536d9ab9d6f8d768e68b40e7a">operator!=</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
82
<li>int <a class="el" href="classipe_1_1_string.html#ab37400fd0ed547f7c65dc29cf73643ee">find</a> (char ch) const
83
<li>int <a class="el" href="classipe_1_1_string.html#adcf7cd202938ad0798ced0380d0e141d">rfind</a> (char ch) const
84
<li>int <a class="el" href="classipe_1_1_string.html#aef7b09a6d79e02936427a5e39734e01e">find</a> (const char *rhs) const
85
<li>void <a class="el" href="classipe_1_1_string.html#a3ce2ea55be9ec912bb2dbc88d461b479">erase</a> ()
86
<li>void <a class="el" href="classipe_1_1_string.html#a887c957724678e481e1dd0d8753e8d01">append</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs)
87
<li>void <a class="el" href="classipe_1_1_string.html#a2bbaae7f5d8733e35baabdbadc039dab">append</a> (char ch)
88
<li>bool <a class="el" href="classipe_1_1_string.html#ab1426554db4fc54efba8c80be7ab87c9">operator==</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
89
<li>bool <a class="el" href="classipe_1_1_string.html#ad17973b1a6ca7be84afdbb32ac3ed4e3">operator<</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
90
<li><a class="el" href="classipe_1_1_string.html">String</a> <a class="el" href="classipe_1_1_string.html#ab42e009ab85d895999ee3208048df18b">operator+</a> (const <a class="el" href="classipe_1_1_string.html">String</a> &rhs) const
91
<li>int <a class="el" href="classipe_1_1_string.html#a5c4533ae4f17acb2735761e8ff83185d">unicode</a> (int &index) const
92
<li>const char * <a class="el" href="classipe_1_1_string.html#a964635e9e0c6178d63110410ec9ab7dc">z</a> () const
94
<hr/><a name="_details"></a><h2>Detailed Description</h2>
95
<div class="textblock"><p>Strings and buffers. </p>
96
<p><a class="el" href="classipe_1_1_string.html" title="Strings and buffers.">String</a> is is an implicitly shared byte string. It is designed to be efficient for strings of arbitrary length, and supposed to be passed by value (the size of <a class="el" href="classipe_1_1_string.html" title="Strings and buffers.">String</a> is a single pointer). Sharing is implicit---the string creates its own representation as soon as it is modified.</p>
97
<p><a class="el" href="classipe_1_1_string.html" title="Strings and buffers.">String</a> can be used for binary data. For text, it is usually assumed that the string is UTF-8 encoded, but only the unicode member function actually requires this. In particular, all indices into the string are byte indices, not Unicode character indices. </p>
98
</div><hr/><h2>Constructor & Destructor Documentation</h2>
99
<a class="anchor" id="a8a7ef356e05eb9b1ea1ab518baee3095"></a><!-- doxytag: member="ipe::String::String" ref="a8a7ef356e05eb9b1ea1ab518baee3095" args="()" -->
100
<div class="memitem">
101
<div class="memproto">
102
<table class="memname">
104
<td class="memname">String::String </td>
106
<td class="paramname"></td><td>)</td>
113
<p>Construct an empty string. </p>
117
<a class="anchor" id="a3fba40cf6cb11735ffddc355a5ff68f4"></a><!-- doxytag: member="ipe::String::String" ref="a3fba40cf6cb11735ffddc355a5ff68f4" args="(const char *str)" -->
118
<div class="memitem">
119
<div class="memproto">
120
<table class="memname">
122
<td class="memname">String::String </td>
124
<td class="paramtype">const char * </td>
125
<td class="paramname"><em>str</em></td><td>)</td>
132
<p>Construct a string by making copy of <em>str</em>. </p>
136
<a class="anchor" id="a117f8a4ef8cd2c6b3632324b0146d7ae"></a><!-- doxytag: member="ipe::String::String" ref="a117f8a4ef8cd2c6b3632324b0146d7ae" args="(const String &rhs)" -->
137
<div class="memitem">
138
<div class="memproto">
139
<table class="memname">
141
<td class="memname">String::String </td>
143
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
144
<td class="paramname"><em>rhs</em></td><td>)</td>
151
<p>Copy constructor. This only copies the reference and takes constant time. </p>
155
<a class="anchor" id="a38b584c89d79a8b6654e8d40577695d0"></a><!-- doxytag: member="ipe::String::String" ref="a38b584c89d79a8b6654e8d40577695d0" args="(const String &rhs, int index, int len)" -->
156
<div class="memitem">
157
<div class="memproto">
158
<table class="memname">
160
<td class="memname">String::String </td>
162
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
163
<td class="paramname"><em>rhs</em>, </td>
166
<td class="paramkey"></td>
168
<td class="paramtype">int </td>
169
<td class="paramname"><em>index</em>, </td>
172
<td class="paramkey"></td>
174
<td class="paramtype">int </td>
175
<td class="paramname"><em>len</em> </td>
186
<p>Construct a substring. </p>
187
<p><em>index</em> must be >= 0. <em>len</em> can be negative or too large to return entire string. </p>
191
<a class="anchor" id="ac40b2a3fb58c2d8556f5e6ff73510036"></a><!-- doxytag: member="ipe::String::~String" ref="ac40b2a3fb58c2d8556f5e6ff73510036" args="()" -->
192
<div class="memitem">
193
<div class="memproto">
194
<table class="memname">
196
<td class="memname">String::~String </td>
198
<td class="paramname"></td><td>)</td>
205
<p>Destruct string if reference count has reached zero. </p>
209
<hr/><h2>Member Function Documentation</h2>
210
<a class="anchor" id="a70b3aba8ac7a57e3bb48a52a5d64a88b"></a><!-- doxytag: member="ipe::String::operator=" ref="a70b3aba8ac7a57e3bb48a52a5d64a88b" args="(const String &rhs)" -->
211
<div class="memitem">
212
<div class="memproto">
213
<table class="memname">
215
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> & String::operator= </td>
217
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
218
<td class="paramname"><em>rhs</em></td><td>)</td>
225
<p>Assignment takes constant time. </p>
229
<a class="anchor" id="a31bf41d9c7e2a85ade1cd9c6ba17e4f5"></a><!-- doxytag: member="ipe::String::operator[]" ref="a31bf41d9c7e2a85ade1cd9c6ba17e4f5" args="(int i) const " -->
230
<div class="memitem">
231
<div class="memproto">
232
<table class="memname">
234
<td class="memname">char ipe::String::operator[] </td>
236
<td class="paramtype">int </td>
237
<td class="paramname"><em>i</em></td><td>)</td>
238
<td> const<code> [inline]</code></td>
244
<p>Return character at index i. </p>
248
<a class="anchor" id="a5a053d22050137196cca9cca1a4e9b42"></a><!-- doxytag: member="ipe::String::empty" ref="a5a053d22050137196cca9cca1a4e9b42" args="() const " -->
249
<div class="memitem">
250
<div class="memproto">
251
<table class="memname">
253
<td class="memname">bool ipe::String::empty </td>
255
<td class="paramname"></td><td>)</td>
256
<td> const<code> [inline]</code></td>
262
<p>Is the string empty? </p>
266
<a class="anchor" id="aa8ad780569e40cc86c1afb0475910c57"></a><!-- doxytag: member="ipe::String::isEmpty" ref="aa8ad780569e40cc86c1afb0475910c57" args="() const " -->
267
<div class="memitem">
268
<div class="memproto">
269
<table class="memname">
271
<td class="memname">bool ipe::String::isEmpty </td>
273
<td class="paramname"></td><td>)</td>
274
<td> const<code> [inline]</code></td>
280
<p>Is the string empty? </p>
284
<a class="anchor" id="a57a7cd02ec8eee40eec446e27b331e59"></a><!-- doxytag: member="ipe::String::data" ref="a57a7cd02ec8eee40eec446e27b331e59" args="() const " -->
285
<div class="memitem">
286
<div class="memproto">
287
<table class="memname">
289
<td class="memname">const char* ipe::String::data </td>
291
<td class="paramname"></td><td>)</td>
292
<td> const<code> [inline]</code></td>
298
<p>Return read-only pointer to the data. </p>
302
<a class="anchor" id="a025d035cd6ff7deaa9fdfa96ba39129f"></a><!-- doxytag: member="ipe::String::size" ref="a025d035cd6ff7deaa9fdfa96ba39129f" args="() const " -->
303
<div class="memitem">
304
<div class="memproto">
305
<table class="memname">
307
<td class="memname">int ipe::String::size </td>
309
<td class="paramname"></td><td>)</td>
310
<td> const<code> [inline]</code></td>
316
<p>Return number of bytes in the string. </p>
320
<a class="anchor" id="adf2969eaf89907e88bbeb90e97d37b38"></a><!-- doxytag: member="ipe::String::operator+=" ref="adf2969eaf89907e88bbeb90e97d37b38" args="(const String &rhs)" -->
321
<div class="memitem">
322
<div class="memproto">
323
<table class="memname">
325
<td class="memname">void ipe::String::operator+= </td>
327
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
328
<td class="paramname"><em>rhs</em></td><td>)</td>
329
<td><code> [inline]</code></td>
335
<p>Operator syntax for append. </p>
339
<a class="anchor" id="ad17c4955f194bf3cc38073916a41ccd6"></a><!-- doxytag: member="ipe::String::operator+=" ref="ad17c4955f194bf3cc38073916a41ccd6" args="(char ch)" -->
340
<div class="memitem">
341
<div class="memproto">
342
<table class="memname">
344
<td class="memname">void ipe::String::operator+= </td>
346
<td class="paramtype">char </td>
347
<td class="paramname"><em>ch</em></td><td>)</td>
348
<td><code> [inline]</code></td>
354
<p>Operator syntax for append. </p>
358
<a class="anchor" id="a5d2bc42037447ee489350c56774e627c"></a><!-- doxytag: member="ipe::String::substr" ref="a5d2bc42037447ee489350c56774e627c" args="(int i, int len=-1) const " -->
359
<div class="memitem">
360
<div class="memproto">
361
<table class="memname">
363
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> ipe::String::substr </td>
365
<td class="paramtype">int </td>
366
<td class="paramname"><em>i</em>, </td>
369
<td class="paramkey"></td>
371
<td class="paramtype">int </td>
372
<td class="paramname"><em>len</em> = <code>-1</code> </td>
377
<td></td><td> const<code> [inline]</code></td>
383
<p>Create substring. </p>
387
<a class="anchor" id="a8b6748ce34485f3b137de02357a5b5cf"></a><!-- doxytag: member="ipe::String::left" ref="a8b6748ce34485f3b137de02357a5b5cf" args="(int i) const " -->
388
<div class="memitem">
389
<div class="memproto">
390
<table class="memname">
392
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> ipe::String::left </td>
394
<td class="paramtype">int </td>
395
<td class="paramname"><em>i</em></td><td>)</td>
396
<td> const<code> [inline]</code></td>
402
<p>Create substring at the left. </p>
406
<a class="anchor" id="a71db37324cbd157f031326870722a852"></a><!-- doxytag: member="ipe::String::right" ref="a71db37324cbd157f031326870722a852" args="(int i) const " -->
407
<div class="memitem">
408
<div class="memproto">
409
<table class="memname">
411
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> String::right </td>
413
<td class="paramtype">int </td>
414
<td class="paramname"><em>i</em></td><td>)</td>
421
<p>Create substring at the right. </p>
422
<p>Returns the entire string if <em>i</em> is larger than its length. </p>
426
<a class="anchor" id="a407ac1c536d9ab9d6f8d768e68b40e7a"></a><!-- doxytag: member="ipe::String::operator!=" ref="a407ac1c536d9ab9d6f8d768e68b40e7a" args="(const String &rhs) const " -->
427
<div class="memitem">
428
<div class="memproto">
429
<table class="memname">
431
<td class="memname">bool ipe::String::operator!= </td>
433
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
434
<td class="paramname"><em>rhs</em></td><td>)</td>
435
<td> const<code> [inline]</code></td>
445
<a class="anchor" id="ab37400fd0ed547f7c65dc29cf73643ee"></a><!-- doxytag: member="ipe::String::find" ref="ab37400fd0ed547f7c65dc29cf73643ee" args="(char ch) const " -->
446
<div class="memitem">
447
<div class="memproto">
448
<table class="memname">
450
<td class="memname">int String::find </td>
452
<td class="paramtype">char </td>
453
<td class="paramname"><em>ch</em></td><td>)</td>
460
<p>Return index of first occurrence of ch. </p>
461
<p>Return -1 if character does not appear. </p>
465
<a class="anchor" id="adcf7cd202938ad0798ced0380d0e141d"></a><!-- doxytag: member="ipe::String::rfind" ref="adcf7cd202938ad0798ced0380d0e141d" args="(char ch) const " -->
466
<div class="memitem">
467
<div class="memproto">
468
<table class="memname">
470
<td class="memname">int String::rfind </td>
472
<td class="paramtype">char </td>
473
<td class="paramname"><em>ch</em></td><td>)</td>
480
<p>Return index of last occurrence of ch. </p>
481
<p>Return -1 if character does not appear. </p>
485
<a class="anchor" id="aef7b09a6d79e02936427a5e39734e01e"></a><!-- doxytag: member="ipe::String::find" ref="aef7b09a6d79e02936427a5e39734e01e" args="(const char *rhs) const " -->
486
<div class="memitem">
487
<div class="memproto">
488
<table class="memname">
490
<td class="memname">int String::find </td>
492
<td class="paramtype">const char * </td>
493
<td class="paramname"><em>rhs</em></td><td>)</td>
500
<p>Return index of first occurrence of rhs. </p>
501
<p>Return -1 if not substring is not present. </p>
505
<a class="anchor" id="a3ce2ea55be9ec912bb2dbc88d461b479"></a><!-- doxytag: member="ipe::String::erase" ref="a3ce2ea55be9ec912bb2dbc88d461b479" args="()" -->
506
<div class="memitem">
507
<div class="memproto">
508
<table class="memname">
510
<td class="memname">void String::erase </td>
512
<td class="paramname"></td><td>)</td>
519
<p>Make string empty. </p>
523
<a class="anchor" id="a887c957724678e481e1dd0d8753e8d01"></a><!-- doxytag: member="ipe::String::append" ref="a887c957724678e481e1dd0d8753e8d01" args="(const String &rhs)" -->
524
<div class="memitem">
525
<div class="memproto">
526
<table class="memname">
528
<td class="memname">void String::append </td>
530
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
531
<td class="paramname"><em>rhs</em></td><td>)</td>
538
<p>Append <em>rhs</em> to this string. </p>
542
<a class="anchor" id="a2bbaae7f5d8733e35baabdbadc039dab"></a><!-- doxytag: member="ipe::String::append" ref="a2bbaae7f5d8733e35baabdbadc039dab" args="(char ch)" -->
543
<div class="memitem">
544
<div class="memproto">
545
<table class="memname">
547
<td class="memname">void String::append </td>
549
<td class="paramtype">char </td>
550
<td class="paramname"><em>ch</em></td><td>)</td>
557
<p>Append <em>ch</em> to this string. </p>
561
<a class="anchor" id="ab1426554db4fc54efba8c80be7ab87c9"></a><!-- doxytag: member="ipe::String::operator==" ref="ab1426554db4fc54efba8c80be7ab87c9" args="(const String &rhs) const " -->
562
<div class="memitem">
563
<div class="memproto">
564
<table class="memname">
566
<td class="memname">bool String::operator== </td>
568
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
569
<td class="paramname"><em>rhs</em></td><td>)</td>
576
<p>Equality operator (bytewise comparison). </p>
580
<a class="anchor" id="ad17973b1a6ca7be84afdbb32ac3ed4e3"></a><!-- doxytag: member="ipe::String::operator<" ref="ad17973b1a6ca7be84afdbb32ac3ed4e3" args="(const String &rhs) const " -->
581
<div class="memitem">
582
<div class="memproto">
583
<table class="memname">
585
<td class="memname">bool String::operator< </td>
587
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
588
<td class="paramname"><em>rhs</em></td><td>)</td>
595
<p>Inequality operator (bytewise comparison). </p>
599
<a class="anchor" id="ab42e009ab85d895999ee3208048df18b"></a><!-- doxytag: member="ipe::String::operator+" ref="ab42e009ab85d895999ee3208048df18b" args="(const String &rhs) const " -->
600
<div class="memitem">
601
<div class="memproto">
602
<table class="memname">
604
<td class="memname"><a class="el" href="classipe_1_1_string.html">String</a> String::operator+ </td>
606
<td class="paramtype">const <a class="el" href="classipe_1_1_string.html">String</a> & </td>
607
<td class="paramname"><em>rhs</em></td><td>)</td>
614
<p>Concatenate this string with <em>rhs</em>. </p>
618
<a class="anchor" id="a5c4533ae4f17acb2735761e8ff83185d"></a><!-- doxytag: member="ipe::String::unicode" ref="a5c4533ae4f17acb2735761e8ff83185d" args="(int &index) const " -->
619
<div class="memitem">
620
<div class="memproto">
621
<table class="memname">
623
<td class="memname">int String::unicode </td>
625
<td class="paramtype">int & </td>
626
<td class="paramname"><em>index</em></td><td>)</td>
633
<p>Return Unicode value from UTF-8 string. </p>
634
<p>The <em>index</em> is incremented to the next UTF-8 character. This returns 0xfffd if there is any problem in parsing UTF-8. </p>
638
<a class="anchor" id="a964635e9e0c6178d63110410ec9ab7dc"></a><!-- doxytag: member="ipe::String::z" ref="a964635e9e0c6178d63110410ec9ab7dc" args="() const " -->
639
<div class="memitem">
640
<div class="memproto">
641
<table class="memname">
643
<td class="memname">const char * String::z </td>
645
<td class="paramname"></td><td>)</td>
652
<p>Return a C style string with final zero byte. </p>
656
<hr/>The documentation for this class was generated from the following files:<ul>