blob: db35054263aa675f4d2281c4a5c16d1a7f36ffca [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: Pointer</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('md_doc_pointer.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="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Pointer </div> </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#JsonPointer">JSON Pointer</a></li>
<li class="level1"><a href="#BasicUsage">Basic Usage</a></li>
<li class="level1"><a href="#HelperFunctions">Helper Functions</a></li>
<li class="level1"><a href="#ResolvingPointer">Resolving Pointer</a><ul><li class="level2"><a href="#autotoc_md51">Resolving Minus Sign Token</a></li>
<li class="level2"><a href="#autotoc_md52">Resolving Document and Value</a></li>
</ul>
</li>
<li class="level1"><a href="#ErrorHandling">Error Handling</a></li>
<li class="level1"><a href="#URIFragment">URI Fragment Representation</a></li>
<li class="level1"><a href="#autotoc_md53">Stringify</a></li>
<li class="level1"><a href="#UserSuppliedTokens">User-Supplied Tokens</a></li>
</ul>
</div>
<div class="textblock"><p>(This feature was released in v1.1.0)</p>
<p>JSON Pointer is a standardized (<a href="https://tools.ietf.org/html/rfc6901">RFC6901</a>) way to select a value inside a JSON Document (DOM). This can be analogous to XPath for XML document. However, JSON Pointer is much simpler, and a single JSON Pointer only pointed to a single value.</p>
<p>Using RapidJSON's implementation of JSON Pointer can simplify some manipulations of the DOM.</p>
<h1><a class="anchor" id="JsonPointer"></a>
JSON Pointer</h1>
<p>A JSON Pointer is a list of zero-to-many tokens, each prefixed by <code>/</code>. Each token can be a string or a number. For example, given a JSON: </p><div class="fragment"><div class="line">{</div>
<div class="line"> &quot;foo&quot; : [&quot;bar&quot;, &quot;baz&quot;],</div>
<div class="line"> &quot;pi&quot; : 3.1416</div>
<div class="line">}</div>
</div><!-- fragment --><p>The following JSON Pointers resolve this JSON as:</p>
<ol type="1">
<li><code>"/foo"</code><code>[ "bar", "baz" ]</code></li>
<li><code>"/foo/0"</code><code>"bar"</code></li>
<li><code>"/foo/1"</code><code>"baz"</code></li>
<li><code>"/pi"</code><code>3.1416</code></li>
</ol>
<p>Note that, an empty JSON Pointer <code>""</code> (zero token) resolves to the whole JSON.</p>
<h1><a class="anchor" id="BasicUsage"></a>
Basic Usage</h1>
<p>The following example code is self-explanatory.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;rapidjson/pointer.h&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// ...</span></div>
<div class="line"><a class="code" href="namespacerapidjson.html#ace11b5b575baf1cccd5ba5f8586dcdc8">Document</a> d;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Create DOM by Set()</span></div>
<div class="line"><a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/project&quot;</span>).Set(d, <span class="stringliteral">&quot;RapidJSON&quot;</span>);</div>
<div class="line"><a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/stars&quot;</span>).Set(d, 10);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// { &quot;project&quot; : &quot;RapidJSON&quot;, &quot;stars&quot; : 10 }</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Access DOM by Get(). It return nullptr if the value does not exist.</span></div>
<div class="line"><span class="keywordflow">if</span> (<a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a>* stars = <a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/stars&quot;</span>).Get(d))</div>
<div class="line"> stars-&gt;SetInt(stars-&gt;GetInt() + 1);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// { &quot;project&quot; : &quot;RapidJSON&quot;, &quot;stars&quot; : 11 }</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Set() and Create() automatically generate parents if not exist.</span></div>
<div class="line"><a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/a/b/0&quot;</span>).Create(d);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// { &quot;project&quot; : &quot;RapidJSON&quot;, &quot;stars&quot; : 11, &quot;a&quot; : { &quot;b&quot; : [ null ] } }</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// GetWithDefault() returns reference. And it deep clones the default value.</span></div>
<div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a>&amp; hello = <a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/hello&quot;</span>).GetWithDefault(d, <span class="stringliteral">&quot;world&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// { &quot;project&quot; : &quot;RapidJSON&quot;, &quot;stars&quot; : 11, &quot;a&quot; : { &quot;b&quot; : [ null ] }, &quot;hello&quot; : &quot;world&quot; }</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Swap() is similar to Set()</span></div>
<div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a> x(<span class="stringliteral">&quot;C++&quot;</span>);</div>
<div class="line"><a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/hello&quot;</span>).Swap(d, x);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// { &quot;project&quot; : &quot;RapidJSON&quot;, &quot;stars&quot; : 11, &quot;a&quot; : { &quot;b&quot; : [ null ] }, &quot;hello&quot; : &quot;C++&quot; }</span></div>
<div class="line"><span class="comment">// x becomes &quot;world&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Erase a member or element, return true if the value exists</span></div>
<div class="line"><span class="keywordtype">bool</span> success = <a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a>(<span class="stringliteral">&quot;/a&quot;</span>).Erase(d);</div>
<div class="line">assert(success);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// { &quot;project&quot; : &quot;RapidJSON&quot;, &quot;stars&quot; : 10 }</span></div>
</div><!-- fragment --><h1><a class="anchor" id="HelperFunctions"></a>
Helper Functions</h1>
<p>Since object-oriented calling convention may be non-intuitive, RapidJSON also provides helper functions, which just wrap the member functions with free-functions.</p>
<p>The following example does exactly the same as the above one.</p>
<div class="fragment"><div class="line"><a class="code" href="namespacerapidjson.html#ace11b5b575baf1cccd5ba5f8586dcdc8">Document</a> d;</div>
<div class="line"> </div>
<div class="line">SetValueByPointer(d, <span class="stringliteral">&quot;/project&quot;</span>, <span class="stringliteral">&quot;RapidJSON&quot;</span>);</div>
<div class="line">SetValueByPointer(d, <span class="stringliteral">&quot;/stars&quot;</span>, 10);</div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">if</span> (<a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a>* stars = GetValueByPointer(d, <span class="stringliteral">&quot;/stars&quot;</span>))</div>
<div class="line"> stars-&gt;SetInt(stars-&gt;GetInt() + 1);</div>
<div class="line"> </div>
<div class="line">CreateValueByPointer(d, <span class="stringliteral">&quot;/a/b/0&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a>&amp; hello = GetValueByPointerWithDefault(d, <span class="stringliteral">&quot;/hello&quot;</span>, <span class="stringliteral">&quot;world&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a> x(<span class="stringliteral">&quot;C++&quot;</span>);</div>
<div class="line">SwapValueByPointer(d, <span class="stringliteral">&quot;/hello&quot;</span>, x);</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">bool</span> success = EraseValueByPointer(d, <span class="stringliteral">&quot;/a&quot;</span>);</div>
<div class="line">assert(success);</div>
</div><!-- fragment --><p>The conventions are shown here for comparison:</p>
<ol type="1">
<li><code>Pointer(source).&lt;Method&gt;(root, ...)</code></li>
<li><code>&lt;Method&gt;ValueByPointer(root, Pointer(source), ...)</code></li>
<li><code>&lt;Method&gt;ValueByPointer(root, source, ...)</code></li>
</ol>
<h1><a class="anchor" id="ResolvingPointer"></a>
Resolving Pointer</h1>
<p><code>Pointer::Get()</code> or <code>GetValueByPointer()</code> function does not modify the DOM. If the tokens cannot match a value in the DOM, it returns <code>nullptr</code>. User can use this to check whether a value exists.</p>
<p>Note that, numerical tokens can represent an array index or member name. The resolving process will match the values according to the types of value.</p>
<div class="fragment"><div class="line">{</div>
<div class="line"> &quot;0&quot; : 123,</div>
<div class="line"> &quot;1&quot; : [456]</div>
<div class="line">}</div>
</div><!-- fragment --><ol type="1">
<li><code>"/0"</code><code>123</code></li>
<li><code>"/1/0"</code><code>456</code></li>
</ol>
<p>The token <code>"0"</code> is treated as member name in the first pointer. It is treated as an array index in the second pointer.</p>
<p>The other functions, including <code>Create()</code>, <code>GetWithDefault()</code>, <code>Set()</code> and <code>Swap()</code>, will change the DOM. These functions will always succeed. They will create the parent values if they do not exist. If the parent values do not match the tokens, they will also be forced to change their type. Changing the type also mean fully removal of that DOM subtree.</p>
<p>Parsing the above JSON into <code>d</code>,</p>
<div class="fragment"><div class="line">SetValueByPointer(d, <span class="stringliteral">&quot;1/a&quot;</span>, 789); <span class="comment">// { &quot;0&quot; : 123, &quot;1&quot; : { &quot;a&quot; : 789 } }</span></div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md51"></a>
Resolving Minus Sign Token</h2>
<p>Besides, <a href="https://tools.ietf.org/html/rfc6901">RFC6901</a> defines a special token <code>-</code> (single minus sign), which represents the pass-the-end element of an array. <code>Get()</code> only treats this token as a member name '"-"'. Yet the other functions can resolve this for array, equivalent to calling <code>Value::PushBack()</code> to the array.</p>
<div class="fragment"><div class="line"><a class="code" href="namespacerapidjson.html#ace11b5b575baf1cccd5ba5f8586dcdc8">Document</a> d;</div>
<div class="line">d.Parse(<span class="stringliteral">&quot;{\&quot;foo\&quot;:[123]}&quot;</span>);</div>
<div class="line">SetValueByPointer(d, <span class="stringliteral">&quot;/foo/-&quot;</span>, 456); <span class="comment">// { &quot;foo&quot; : [123, 456] }</span></div>
<div class="line">SetValueByPointer(d, <span class="stringliteral">&quot;/-&quot;</span>, 789); <span class="comment">// { &quot;foo&quot; : [123, 456], &quot;-&quot; : 789 }</span></div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md52"></a>
Resolving Document and Value</h2>
<p>When using <code>p.Get(root)</code> or <code>GetValueByPointer(root, p)</code>, <code>root</code> is a (const) <code>Value&amp;</code>. That means, it can be a subtree of the DOM.</p>
<p>The other functions have two groups of signature. One group uses <code>Document&amp; document</code> as parameter, another one uses <code>Value&amp; root</code>. The first group uses <code>document.GetAllocator()</code> for creating values. And the second group needs user to supply an allocator, like the functions in DOM.</p>
<p>All examples above do not require an allocator parameter, because the first parameter is a <code>Document&amp;</code>. But if you want to resolve a pointer to a subtree, you need to supply the allocator as in the following example:</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>Person {</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line"> Person() {</div>
<div class="line"> document_ = <span class="keyword">new</span> <a class="code" href="namespacerapidjson.html#ace11b5b575baf1cccd5ba5f8586dcdc8">Document</a>();</div>
<div class="line"> <span class="comment">// CreateValueByPointer() here no need allocator</span></div>
<div class="line"> SetLocation(CreateValueByPointer(*document_, <span class="stringliteral">&quot;/residence&quot;</span>), ...);</div>
<div class="line"> SetLocation(CreateValueByPointer(*document_, <span class="stringliteral">&quot;/office&quot;</span>), ...);</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"><span class="keyword">private</span>:</div>
<div class="line"> <span class="keywordtype">void</span> SetLocation(<a class="code" href="namespacerapidjson.html#aa65fc9fb381b2cbc54f98673eadd6505">Value</a>&amp; location, <span class="keyword">const</span> <span class="keywordtype">char</span>* country, <span class="keyword">const</span> <span class="keywordtype">char</span>* addresses[2]) {</div>
<div class="line"> Value::Allocator&amp; a = document_-&gt;GetAllocator();</div>
<div class="line"> <span class="comment">// SetValueByPointer() here need allocator</span></div>
<div class="line"> SetValueByPointer(location, <span class="stringliteral">&quot;/country&quot;</span>, country, a);</div>
<div class="line"> SetValueByPointer(location, <span class="stringliteral">&quot;/address/0&quot;</span>, address[0], a);</div>
<div class="line"> SetValueByPointer(location, <span class="stringliteral">&quot;/address/1&quot;</span>, address[1], a);</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// ...</span></div>
<div class="line"> </div>
<div class="line"> <a class="code" href="namespacerapidjson.html#ace11b5b575baf1cccd5ba5f8586dcdc8">Document</a>* document_;</div>
<div class="line">};</div>
</div><!-- fragment --><p><code>Erase()</code> or <code>EraseValueByPointer()</code> does not need allocator. And they return <code>true</code> if the value is erased successfully.</p>
<h1><a class="anchor" id="ErrorHandling"></a>
Error Handling</h1>
<p>A <code>Pointer</code> parses a source string in its constructor. If there is parsing error, <code>Pointer::IsValid()</code> returns <code>false</code>. And you can use <code>Pointer::GetParseErrorCode()</code> and <code>GetParseErrorOffset()</code> to retrieve the error information.</p>
<p>Note that, all resolving functions assumes valid pointer. Resolving with an invalid pointer causes assertion failure.</p>
<h1><a class="anchor" id="URIFragment"></a>
URI Fragment Representation</h1>
<p>In addition to the string representation of JSON pointer that we are using till now, <a href="https://tools.ietf.org/html/rfc6901">RFC6901</a> also defines the URI fragment representation of JSON pointer. URI fragment is specified in <a href="https://tools.ietf.org/html/rfc3986">RFC3986</a> "Uniform Resource Identifier (URI): Generic Syntax".</p>
<p>The main differences are that a the URI fragment always has a <code>#</code> (pound sign) in the beginning, and some characters are encoded by percent-encoding in UTF-8 sequence. For example, the following table shows different C/C++ string literals of different representations.</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">String Representation </th><th class="markdownTableHeadNone">URI Fragment Representation </th><th class="markdownTableHeadNone">Pointer Tokens (UTF-8) </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><code>"/foo/0"</code> </td><td class="markdownTableBodyNone"><code>"#/foo/0"</code> </td><td class="markdownTableBodyNone"><code>{"foo", 0}</code> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><code>"/a~1b"</code> </td><td class="markdownTableBodyNone"><code>"#/a~1b"</code> </td><td class="markdownTableBodyNone"><code>{"a/b"}</code> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><code>"/m~0n"</code> </td><td class="markdownTableBodyNone"><code>"#/m~0n"</code> </td><td class="markdownTableBodyNone"><code>{"m~n"}</code> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><code>"/ "</code> </td><td class="markdownTableBodyNone"><code>"#/%20"</code> </td><td class="markdownTableBodyNone"><code>{" "}</code> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><code>"/\0"</code> </td><td class="markdownTableBodyNone"><code>"#/%00"</code> </td><td class="markdownTableBodyNone"><code>{"\0"}</code> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><code>"/€"</code> </td><td class="markdownTableBodyNone"><code>"#/%E2%82%AC"</code> </td><td class="markdownTableBodyNone"><code>{"€"}</code> </td></tr>
</table>
<p>RapidJSON fully support URI fragment representation. It automatically detects the pound sign during parsing.</p>
<h1><a class="anchor" id="autotoc_md53"></a>
Stringify</h1>
<p>You may also stringify a <code>Pointer</code> to a string or other output streams. This can be done by:</p>
<div class="fragment"><div class="line">Pointer p(...);</div>
<div class="line">StringBuffer sb;</div>
<div class="line">p.Stringify(sb);</div>
<div class="line">std::cout &lt;&lt; sb.GetString() &lt;&lt; std::endl;</div>
</div><!-- fragment --><p>It can also stringify to URI fragment representation by <code>StringifyUriFragment()</code>.</p>
<h1><a class="anchor" id="UserSuppliedTokens"></a>
User-Supplied Tokens</h1>
<p>If a pointer will be resolved multiple times, it should be constructed once, and then apply it to different DOMs or in different times. This reduce time and memory allocation for constructing <code>Pointer</code> multiple times.</p>
<p>We can go one step further, to completely eliminate the parsing process and dynamic memory allocation, we can establish the token array directly:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#define NAME(s) { s, sizeof(s) / sizeof(s[0]) - 1, kPointerInvalidIndex }</span></div>
<div class="line"><span class="preprocessor">#define INDEX(i) { #i, sizeof(#i) - 1, i }</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">const</span> Pointer::Token kTokens[] = { NAME(<span class="stringliteral">&quot;foo&quot;</span>), INDEX(123) };</div>
<div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">Pointer</a> p(kTokens, <span class="keyword">sizeof</span>(kTokens) / <span class="keyword">sizeof</span>(kTokens[0]));</div>
<div class="line"><span class="comment">// Equivalent to static const Pointer p(&quot;/foo/123&quot;);</span></div>
</div><!-- fragment --><p>This may be useful for memory constrained systems. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<div class="ttc" id="anamespacerapidjson_html_a080910f74d2f5046e6724280159cf374"><div class="ttname"><a href="namespacerapidjson.html#a080910f74d2f5046e6724280159cf374">rapidjson::Pointer</a></div><div class="ttdeci">GenericPointer&lt; Value, CrtAllocator &gt; Pointer</div><div class="ttdoc">GenericPointer for Value (UTF-8, default allocator).</div><div class="ttdef"><b>Definition:</b> fwd.h:126</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>
<div class="ttc" id="anamespacerapidjson_html_ace11b5b575baf1cccd5ba5f8586dcdc8"><div class="ttname"><a href="namespacerapidjson.html#ace11b5b575baf1cccd5ba5f8586dcdc8">rapidjson::Document</a></div><div class="ttdeci">GenericDocument&lt; UTF8&lt;&gt; &gt; Document</div><div class="ttdoc">GenericDocument with UTF8 encoding.</div><div class="ttdef"><b>Definition:</b> document.h:2873</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>
</ul>
</div>
</body>
</html>