Welcome to mirror list, hosted at ThFree Co, Russian Federation.

structrapidjson_1_1_generic_string_ref.html « zh-cn - github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7a941b9eb911720666ecf4c8d7b205938b5328b7 (plain)
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!-- HTML header for doxygen 1.8.7-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>RapidJSON: rapidjson::GenericStringRef&lt; CharType &gt; 模板结构体 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygenextra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="topbanner"><a href="https://github.com/miloyip/rapidjson" title="RapidJSON GitHub"><i class="githublogo"></i></a></div>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('structrapidjson_1_1_generic_string_ref.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public 类型</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="#related">相关函数</a> &#124;
<a href="structrapidjson_1_1_generic_string_ref-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">rapidjson::GenericStringRef&lt; CharType &gt; 模板结构体 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>Reference to a constant string (not taking a copy)  
 <a href="structrapidjson_1_1_generic_string_ref.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="document_8h_source.html">document.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public 类型</h2></td></tr>
<tr class="memitem:aa2a8eccae3d7eb14c30bc21afb7d6fba"><td class="memItemLeft" align="right" valign="top"><a id="aa2a8eccae3d7eb14c30bc21afb7d6fba"></a>
typedef CharType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa2a8eccae3d7eb14c30bc21afb7d6fba">Ch</a></td></tr>
<tr class="memdesc:aa2a8eccae3d7eb14c30bc21afb7d6fba"><td class="mdescLeft">&#160;</td><td class="mdescRight">character type of the string <br /></td></tr>
<tr class="separator:aa2a8eccae3d7eb14c30bc21afb7d6fba"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:acd4d5ebac2b610ce647356aa52998002"><td class="memTemplParams" colspan="2">template&lt;SizeType N&gt; </td></tr>
<tr class="memitem:acd4d5ebac2b610ce647356aa52998002"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#acd4d5ebac2b610ce647356aa52998002">GenericStringRef</a> (const CharType(&amp;str)[N]) RAPIDJSON_NOEXCEPT</td></tr>
<tr class="memdesc:acd4d5ebac2b610ce647356aa52998002"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create string reference from <code>const</code> character array  <a href="#acd4d5ebac2b610ce647356aa52998002">更多...</a><br /></td></tr>
<tr class="separator:acd4d5ebac2b610ce647356aa52998002"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29cf407c6aa2313f13dff78d6ce02687"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a29cf407c6aa2313f13dff78d6ce02687">GenericStringRef</a> (const CharType *str)</td></tr>
<tr class="memdesc:a29cf407c6aa2313f13dff78d6ce02687"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explicitly create string reference from <code>const</code> character pointer  <a href="#a29cf407c6aa2313f13dff78d6ce02687">更多...</a><br /></td></tr>
<tr class="separator:a29cf407c6aa2313f13dff78d6ce02687"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad9eb120a58cee500ff3bd5706779c4e4"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#ad9eb120a58cee500ff3bd5706779c4e4">GenericStringRef</a> (const CharType *str, <a class="el" href="namespacerapidjson.html#a44eb33eaa523e36d466b1ced64b85c84">SizeType</a> len)</td></tr>
<tr class="memdesc:ad9eb120a58cee500ff3bd5706779c4e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create constant string reference from pointer and length  <a href="#ad9eb120a58cee500ff3bd5706779c4e4">更多...</a><br /></td></tr>
<tr class="separator:ad9eb120a58cee500ff3bd5706779c4e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45345164abed97ea24603d2020b33448"><td class="memItemLeft" align="right" valign="top"><a id="a45345164abed97ea24603d2020b33448"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>GenericStringRef</b> (const <a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a> &amp;rhs)</td></tr>
<tr class="separator:a45345164abed97ea24603d2020b33448"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86d30bb594a41619a7a5ba6c8dcce2bd"><td class="memItemLeft" align="right" valign="top"><a id="a86d30bb594a41619a7a5ba6c8dcce2bd"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a86d30bb594a41619a7a5ba6c8dcce2bd">operator const Ch *</a> () const</td></tr>
<tr class="memdesc:a86d30bb594a41619a7a5ba6c8dcce2bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">implicit conversion to plain CharType pointer <br /></td></tr>
<tr class="separator:a86d30bb594a41619a7a5ba6c8dcce2bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:a001276ee57cbcbd3c14449045c71e994"><td class="memItemLeft" align="right" valign="top"><a id="a001276ee57cbcbd3c14449045c71e994"></a>
const <a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa2a8eccae3d7eb14c30bc21afb7d6fba">Ch</a> *const&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a001276ee57cbcbd3c14449045c71e994">s</a></td></tr>
<tr class="memdesc:a001276ee57cbcbd3c14449045c71e994"><td class="mdescLeft">&#160;</td><td class="mdescRight">plain CharType pointer <br /></td></tr>
<tr class="separator:a001276ee57cbcbd3c14449045c71e994"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae223535ec20edf0c1db44a40b7735111"><td class="memItemLeft" align="right" valign="top"><a id="ae223535ec20edf0c1db44a40b7735111"></a>
const <a class="el" href="namespacerapidjson.html#a44eb33eaa523e36d466b1ced64b85c84">SizeType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#ae223535ec20edf0c1db44a40b7735111">length</a></td></tr>
<tr class="memdesc:ae223535ec20edf0c1db44a40b7735111"><td class="mdescLeft">&#160;</td><td class="mdescRight">length of the string (excluding the trailing NULL terminator) <br /></td></tr>
<tr class="separator:ae223535ec20edf0c1db44a40b7735111"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
相关函数</h2></td></tr>
<tr><td class="ititle" colspan="2"><p>(请注意: 这些不是成员函数.) </p>
</td></tr>
<tr class="memitem:aa6b9fd9f6aa49405a574c362ba9af6b5"><td class="memTemplParams" colspan="2">template&lt;typename CharType &gt; </td></tr>
<tr class="memitem:aa6b9fd9f6aa49405a574c362ba9af6b5"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a>&lt; CharType &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5">StringRef</a> (const CharType *str)</td></tr>
<tr class="memdesc:aa6b9fd9f6aa49405a574c362ba9af6b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark a character pointer as constant string  <a href="#aa6b9fd9f6aa49405a574c362ba9af6b5">更多...</a><br /></td></tr>
<tr class="separator:aa6b9fd9f6aa49405a574c362ba9af6b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a578c51ab574a50a9c760b9da7c7562f2"><td class="memTemplParams" colspan="2">template&lt;typename CharType &gt; </td></tr>
<tr class="memitem:a578c51ab574a50a9c760b9da7c7562f2"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a>&lt; CharType &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a578c51ab574a50a9c760b9da7c7562f2">StringRef</a> (const CharType *str, size_t <a class="el" href="structrapidjson_1_1_generic_string_ref.html#ae223535ec20edf0c1db44a40b7735111">length</a>)</td></tr>
<tr class="memdesc:a578c51ab574a50a9c760b9da7c7562f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark a character pointer as constant string  <a href="#a578c51ab574a50a9c760b9da7c7562f2">更多...</a><br /></td></tr>
<tr class="separator:a578c51ab574a50a9c760b9da7c7562f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af94951529a5d51e8c4e6e770bb707c1f"><td class="memTemplParams" colspan="2">template&lt;typename CharType &gt; </td></tr>
<tr class="memitem:af94951529a5d51e8c4e6e770bb707c1f"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a>&lt; CharType &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structrapidjson_1_1_generic_string_ref.html#af94951529a5d51e8c4e6e770bb707c1f">StringRef</a> (const std::basic_string&lt; CharType &gt; &amp;str)</td></tr>
<tr class="memdesc:af94951529a5d51e8c4e6e770bb707c1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark a string object as constant string  <a href="#af94951529a5d51e8c4e6e770bb707c1f">更多...</a><br /></td></tr>
<tr class="separator:af94951529a5d51e8c4e6e770bb707c1f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><h3>template&lt;typename CharType&gt;<br />
struct rapidjson::GenericStringRef&lt; CharType &gt;</h3>

<p>Reference to a constant string (not taking a copy) </p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">CharType</td><td>character type of the string</td></tr>
  </table>
  </dd>
</dl>
<p>This helper class is used to automatically infer constant string references for string literals, especially from <code>const</code> <b></b>(!) character arrays.</p>
<p>The main use is for creating JSON string values without copying the source string via an <a class="el" href="md_doc_dom_8zh-cn.html#Allocator">分配器</a>. This requires that the referenced string pointers have a sufficient lifetime, which exceeds the lifetime of the associated <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a>.</p>
<p><b>Example</b> </p><div class="fragment"><div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a> v(<span class="stringliteral">&quot;foo&quot;</span>);   <span class="comment">// ok, no need to copy &amp; calculate length</span></div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> foo[] = <span class="stringliteral">&quot;foo&quot;</span>;</div><div class="line">v.SetString(foo); <span class="comment">// ok</span></div><div class="line"></div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* bar = foo;</div><div class="line"><span class="comment">// Value x(bar); // not ok, can&#39;t rely on bar&#39;s lifetime</span></div><div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a> x(<a class="code" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5">StringRef</a>(bar)); <span class="comment">// lifetime explicitly guaranteed by user</span></div><div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a> y(<a class="code" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5">StringRef</a>(bar, 3));  <span class="comment">// ok, explicitly pass length</span></div></div><!-- fragment --><dl class="section see"><dt>参见</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5" title="Mark a character pointer as constant string ">StringRef</a>, <a class="el" href="classrapidjson_1_1_generic_value.html#afb91480cc6242ca96ffc603e649c319f" title="Set this value as a string without copying source string. ">GenericValue::SetString</a> </dd></dl>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="acd4d5ebac2b610ce647356aa52998002"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acd4d5ebac2b610ce647356aa52998002">&#9670;&nbsp;</a></span>GenericStringRef() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename CharType&gt; </div>
<div class="memtemplate">
template&lt;SizeType N&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">rapidjson::GenericStringRef</a>&lt; CharType &gt;::<a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a> </td>
          <td>(</td>
          <td class="paramtype">const CharType(&amp;)&#160;</td>
          <td class="paramname"><em>str</em>[N]</td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Create string reference from <code>const</code> character array </p>
<p>This constructor implicitly creates a constant string reference from a <code>const</code> character array. It has better performance than <a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5">StringRef(const CharType*)</a> by inferring the string <a class="el" href="structrapidjson_1_1_generic_string_ref.html#ae223535ec20edf0c1db44a40b7735111">length</a> from the array length, and also supports strings containing null characters.</p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">N</td><td>length of the string, automatically inferred</td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>Constant character array, lifetime assumed to be longer than the use of the string in e.g. a <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section post"><dt>后置条件</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a001276ee57cbcbd3c14449045c71e994">s</a> == str</dd></dl>
<dl class="section note"><dt>注解</dt><dd>Constant complexity. </dd>
<dd>
There is a hidden, private overload to disallow references to non-const character arrays to be created via this constructor. By this, e.g. function-scope arrays used to be filled via <code>snprintf</code> are excluded from consideration. In such cases, the referenced string should be <b>copied</b> to the <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> instead. </dd></dl>

</div>
</div>
<a id="a29cf407c6aa2313f13dff78d6ce02687"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a29cf407c6aa2313f13dff78d6ce02687">&#9670;&nbsp;</a></span>GenericStringRef() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename CharType&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">rapidjson::GenericStringRef</a>&lt; CharType &gt;::<a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a> </td>
          <td>(</td>
          <td class="paramtype">const CharType *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Explicitly create string reference from <code>const</code> character pointer </p>
<p>This constructor can be used to <b>explicitly</b> create a reference to a constant string pointer.</p>
<dl class="section see"><dt>参见</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5" title="Mark a character pointer as constant string ">StringRef(const CharType*)</a></dd></dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>Constant character pointer, lifetime assumed to be longer than the use of the string in e.g. a <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section post"><dt>后置条件</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a001276ee57cbcbd3c14449045c71e994">s</a> == str</dd></dl>
<dl class="section note"><dt>注解</dt><dd>There is a hidden, private overload to disallow references to non-const character arrays to be created via this constructor. By this, e.g. function-scope arrays used to be filled via <code>snprintf</code> are excluded from consideration. In such cases, the referenced string should be <b>copied</b> to the <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> instead. </dd></dl>

</div>
</div>
<a id="ad9eb120a58cee500ff3bd5706779c4e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad9eb120a58cee500ff3bd5706779c4e4">&#9670;&nbsp;</a></span>GenericStringRef() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename CharType&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">rapidjson::GenericStringRef</a>&lt; CharType &gt;::<a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a> </td>
          <td>(</td>
          <td class="paramtype">const CharType *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacerapidjson.html#a44eb33eaa523e36d466b1ced64b85c84">SizeType</a>&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Create constant string reference from pointer and length </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>constant string, lifetime assumed to be longer than the use of the string in e.g. a <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> </td></tr>
    <tr><td class="paramname">len</td><td>length of the string, excluding the trailing NULL terminator</td></tr>
  </table>
  </dd>
</dl>
<dl class="section post"><dt>后置条件</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a001276ee57cbcbd3c14449045c71e994">s</a> == str &amp;&amp; <a class="el" href="structrapidjson_1_1_generic_string_ref.html#ae223535ec20edf0c1db44a40b7735111">length</a> == len </dd></dl>
<dl class="section note"><dt>注解</dt><dd>Constant complexity. </dd></dl>

</div>
</div>
<h2 class="groupheader">友元及相关函数文档</h2>
<a id="aa6b9fd9f6aa49405a574c362ba9af6b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa6b9fd9f6aa49405a574c362ba9af6b5">&#9670;&nbsp;</a></span>StringRef() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename CharType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a>&lt; CharType &gt; StringRef </td>
          <td>(</td>
          <td class="paramtype">const CharType *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Mark a character pointer as constant string </p>
<p>Mark a plain character pointer as a "string literal". This function can be used to avoid copying a character string to be referenced as a value in a JSON <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> object, if the string's lifetime is known to be valid long enough. </p><dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">CharType</td><td>Character type of the string </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>Constant string, lifetime assumed to be longer than the use of the string in e.g. a <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html" title="Reference to a constant string (not taking a copy) ">GenericStringRef</a> string reference object</dd></dl>
<dl class="section see"><dt>参见</dt><dd><a class="el" href="classrapidjson_1_1_generic_value.html#a65bfc3073fa80ee5eba8e985abe2f941" title="Constructor for constant string (i.e. do not make a copy of string) ">GenericValue::GenericValue(StringRefType)</a>, <a class="el" href="classrapidjson_1_1_generic_value.html#aecc9d0a6aafe31f4fdf9f6e75e5f089c" title="Assignment of constant string reference (no copy) ">GenericValue::operator=(StringRefType)</a>, <a class="el" href="classrapidjson_1_1_generic_value.html#aabb538578a3c1e60c86cda32d062bc1c" title="Set this value as a string without copying source string. ">GenericValue::SetString(StringRefType)</a>, <a class="el" href="classrapidjson_1_1_generic_value.html#a41946915cb219a684f6ffc9341efee22" title="Append a constant string reference at the end of the array. ">GenericValue::PushBack(StringRefType, Allocator&amp;)</a>, <a class="el" href="classrapidjson_1_1_generic_value.html#ab018d734d189532b27943bc45776ba68" title="Add a member (name-value pair) to the object. ">GenericValue::AddMember</a> </dd></dl>

</div>
</div>
<a id="a578c51ab574a50a9c760b9da7c7562f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a578c51ab574a50a9c760b9da7c7562f2">&#9670;&nbsp;</a></span>StringRef() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename CharType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a>&lt; CharType &gt; StringRef </td>
          <td>(</td>
          <td class="paramtype">const CharType *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Mark a character pointer as constant string </p>
<p>Mark a plain character pointer as a "string literal". This function can be used to avoid copying a character string to be referenced as a value in a JSON <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> object, if the string's lifetime is known to be valid long enough.</p>
<p>This version has better performance with supplied length, and also supports string containing null characters.</p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">CharType</td><td>character type of the string </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>Constant string, lifetime assumed to be longer than the use of the string in e.g. a <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> </td></tr>
    <tr><td class="paramname">length</td><td>The length of source string. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html" title="Reference to a constant string (not taking a copy) ">GenericStringRef</a> string reference object </dd></dl>

</div>
</div>
<a id="af94951529a5d51e8c4e6e770bb707c1f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af94951529a5d51e8c4e6e770bb707c1f">&#9670;&nbsp;</a></span>StringRef() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename CharType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a>&lt; CharType &gt; StringRef </td>
          <td>(</td>
          <td class="paramtype">const std::basic_string&lt; CharType &gt; &amp;&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Mark a string object as constant string </p>
<p>Mark a string object (e.g. <code>std::string</code>) as a "string literal". This function can be used to avoid copying a string to be referenced as a value in a JSON <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> object, if the string's lifetime is known to be valid long enough.</p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">CharType</td><td>character type of the string </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>Constant string, lifetime assumed to be longer than the use of the string in e.g. a <a class="el" href="classrapidjson_1_1_generic_value.html" title="Represents a JSON value. Use Value for UTF8 encoding and default allocator. ">GenericValue</a> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html" title="Reference to a constant string (not taking a copy) ">GenericStringRef</a> string reference object</dd></dl>
<dl class="section note"><dt>注解</dt><dd>Requires the definition of the preprocessor symbol <a class="el" href="group___r_a_p_i_d_j_s_o_n___c_o_n_f_i_g.html#ga2f2eef0ee4477f3fe5874703a66e997f">RAPIDJSON_HAS_STDSTRING</a>. </dd></dl>

</div>
</div>
<hr/>该结构体的文档由以下文件生成:<ul>
<li>include/rapidjson/<a class="el" href="document_8h_source.html">document.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.7-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacerapidjson.html">rapidjson</a></li><li class="navelem"><a class="el" href="structrapidjson_1_1_generic_string_ref.html">GenericStringRef</a></li>
  </ul>
</div>
</body>
</html>