blob: fe9d4064334be49779eb9b3d6141e0864a137e50 [file] [log] [blame]
<!-- 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.16"/>
<title>RapidJSON: rapidjson::GenericStringRef&lt; CharType &gt; Struct Template Reference</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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</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/Tencent/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="Search" 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 -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structrapidjson_1_1_generic_string_ref.html','');});
/* @license-end */
</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 Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="#related">Related Functions</a> &#124;
<a href="structrapidjson_1_1_generic_string_ref-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">rapidjson::GenericStringRef&lt; CharType &gt; Struct Template Reference</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">More...</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 Types</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 Member Functions</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="structrapidjson_1_1_generic_string_ref.html#acd4d5ebac2b610ce647356aa52998002">More...</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="structrapidjson_1_1_generic_string_ref.html#a29cf407c6aa2313f13dff78d6ce02687">More...</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="structrapidjson_1_1_generic_string_ref.html#ad9eb120a58cee500ff3bd5706779c4e4">More...</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 Attributes</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>
Related Functions</h2></td></tr>
<tr><td class="ititle" colspan="2"><p>(Note that these are not member functions.) </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="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5">More...</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="structrapidjson_1_1_generic_string_ref.html#a578c51ab574a50a9c760b9da7c7562f2">More...</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="structrapidjson_1_1_generic_string_ref.html#af94951529a5d51e8c4e6e770bb707c1f">More...</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">Detailed Description</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>Template Parameters</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.html#Allocator">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>See also</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5" title="Mark a character pointer as constant string.">StringRef</a>, GenericValue::SetString </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</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>Template Parameters</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>Parameters</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>Postcondition</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a001276ee57cbcbd3c14449045c71e994">s</a> == str</dd></dl>
<dl class="section note"><dt>Note</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>See also</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>Parameters</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>Postcondition</dt><dd><a class="el" href="structrapidjson_1_1_generic_string_ref.html#a001276ee57cbcbd3c14449045c71e994">s</a> == str</dd></dl>
<dl class="section note"><dt>Note</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>Parameters</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>Postcondition</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>Note</dt><dd>Constant complexity. </dd></dl>
</div>
</div>
<h2 class="groupheader">Friends And Related Function Documentation</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>Template Parameters</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>Parameters</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>Returns</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>See also</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>, GenericValue::SetString(StringRefType), GenericValue::PushBack(StringRefType, Allocator&amp;), GenericValue::AddMember </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>Template Parameters</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>Parameters</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>Returns</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>Template Parameters</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>Parameters</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>Returns</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>Note</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/>The documentation for this struct was generated from the following file:<ul>
<li>include/rapidjson/<a class="el" href="document_8h_source.html">document.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="astructrapidjson_1_1_generic_string_ref_html_aa6b9fd9f6aa49405a574c362ba9af6b5"><div class="ttname"><a href="structrapidjson_1_1_generic_string_ref.html#aa6b9fd9f6aa49405a574c362ba9af6b5">rapidjson::GenericStringRef::StringRef</a></div><div class="ttdeci">GenericStringRef&lt; CharType &gt; StringRef(const CharType *str)</div><div class="ttdoc">Mark a character pointer as constant string.</div><div class="ttdef"><b>Definition:</b> document.h:454</div></div>
<div class="ttc" id="anamespacerapidjson_html_aa65fc9fb381b2cbc54f98673eadd6505"><div class="ttname"><a href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">rapidjson::Value</a></div><div class="ttdeci">GenericValue&lt; UTF8&lt;&gt; &gt; Value</div><div class="ttdoc">GenericValue with UTF8 encoding.</div><div class="ttdef"><b>Definition:</b> document.h:2470</div></div>
<!-- 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>