-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathclass_r_t_json_parser.html
More file actions
159 lines (152 loc) · 10.5 KB
/
class_r_t_json_parser.html
File metadata and controls
159 lines (152 loc) · 10.5 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>C++ TargetRTS: RTJsonParser Class 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="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>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">C++ TargetRTS
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="class_r_t_json_parser-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">RTJsonParser Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Utility for parsing JSON.
<a href="class_r_t_json_parser.html#details">More...</a></p>
<p><code>#include <<a class="el" href="_r_t_json_parser_8h_source.html">RTJsonParser.h</a>></code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:abf23ec010028031ed02f670d70ac0914"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_r_t_json_parser.html#abf23ec010028031ed02f670d70ac0914">parseJsonString</a> (<a class="el" href="class_r_t_json_result.html">RTJsonResult</a> &result, const std::string &jsonStr)</td></tr>
<tr class="memdesc:abf23ec010028031ed02f670d70ac0914"><td class="mdescLeft"> </td><td class="mdescRight">Parse a JSON string. <br /></td></tr>
<tr class="separator:abf23ec010028031ed02f670d70ac0914"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Utility for parsing JSON. </p>
<p>The result of parsing is represented by a tree of </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="class_r_t_json_result.html" title="Represents the result of parsing a JSON string.">RTJsonResult</a> objects. </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="abf23ec010028031ed02f670d70ac0914" name="abf23ec010028031ed02f670d70ac0914"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abf23ec010028031ed02f670d70ac0914">◆ </a></span>parseJsonString()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RTJsonParser::parseJsonString </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_r_t_json_result.html">RTJsonResult</a> & </td>
<td class="paramname"><em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>jsonStr</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Parse a JSON string. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">result</td><td><a class="el" href="class_r_t_json_result.html" title="Represents the result of parsing a JSON string.">RTJsonResult</a> object representing the parsed JSON </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">jsonStr</td><td>JSON string to parse </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successfully parsed, false otherwise <div class="fragment"><div class="line"><span class="keyword">const</span> std::string jsonStr = R<span class="stringliteral">"({ "event" : "ping", "bVal" : true, "array" : [ 1, 2 ] })";</span></div>
<div class="line"><span class="stringliteral"><a class="code hl_class" href="class_r_t_json_parser.html">RTJsonParser</a> parse;</span></div>
<div class="line"><span class="stringliteral"><a class="code hl_class" href="class_r_t_json_result.html">RTJsonResult</a> result;</span></div>
<div class="line"><span class="stringliteral"></span><span class="keywordtype">bool</span> ret = parse.<a class="code hl_function" href="class_r_t_json_parser.html#abf23ec010028031ed02f670d70ac0914">parseJsonString</a>(result, jsonStr);</div>
<div class="line"><span class="keywordflow">if</span>(ret)</div>
<div class="line">{</div>
<div class="line"> std::cout << <span class="stringliteral">"event type: "</span> << result[<span class="stringliteral">"event"</span>].<a class="code hl_function" href="class_r_t_json_result.html#a75f20f61f2b5dfdbdaf4ef482b9849f1">get_type</a>() << std::endl;</div>
<div class="line"> std::cout << <span class="stringliteral">"event: "</span> << result[<span class="stringliteral">"event"</span>].<a class="code hl_function" href="class_r_t_json_result.html#a5a234d03141648371413d2cc5778afc2">get_string</a>() << std::endl;</div>
<div class="line"> std::cout << <span class="stringliteral">"bVal: "</span> << result[<span class="stringliteral">"bVal"</span>].<a class="code hl_function" href="class_r_t_json_result.html#a6e10877766f747c5100c1b1d741e1837">get_bool</a>() << std::endl;</div>
<div class="line"> std::cout << <span class="stringliteral">"array: "</span> << result[<span class="stringliteral">"array"</span>][0].<a class="code hl_function" href="class_r_t_json_result.html#a8ef82044cc93afde9b52aee9157957a9">get_int</a>() << std::endl;</div>
<div class="line">}</div>
<div class="ttc" id="aclass_r_t_json_parser_html"><div class="ttname"><a href="class_r_t_json_parser.html">RTJsonParser</a></div><div class="ttdoc">Utility for parsing JSON.</div><div class="ttdef"><b>Definition:</b> RTJsonParser.h:23</div></div>
<div class="ttc" id="aclass_r_t_json_parser_html_abf23ec010028031ed02f670d70ac0914"><div class="ttname"><a href="class_r_t_json_parser.html#abf23ec010028031ed02f670d70ac0914">RTJsonParser::parseJsonString</a></div><div class="ttdeci">bool parseJsonString(RTJsonResult &result, const std::string &jsonStr)</div><div class="ttdoc">Parse a JSON string.</div></div>
<div class="ttc" id="aclass_r_t_json_result_html"><div class="ttname"><a href="class_r_t_json_result.html">RTJsonResult</a></div><div class="ttdoc">Represents the result of parsing a JSON string.</div><div class="ttdef"><b>Definition:</b> RTJsonResult.h:30</div></div>
<div class="ttc" id="aclass_r_t_json_result_html_a5a234d03141648371413d2cc5778afc2"><div class="ttname"><a href="class_r_t_json_result.html#a5a234d03141648371413d2cc5778afc2">RTJsonResult::get_string</a></div><div class="ttdeci">const std::string & get_string() const</div><div class="ttdoc">Get a string representation of the JSON value.</div></div>
<div class="ttc" id="aclass_r_t_json_result_html_a6e10877766f747c5100c1b1d741e1837"><div class="ttname"><a href="class_r_t_json_result.html#a6e10877766f747c5100c1b1d741e1837">RTJsonResult::get_bool</a></div><div class="ttdeci">bool get_bool() const</div><div class="ttdoc">Interpret the JSON value as a bool.</div></div>
<div class="ttc" id="aclass_r_t_json_result_html_a75f20f61f2b5dfdbdaf4ef482b9849f1"><div class="ttname"><a href="class_r_t_json_result.html#a75f20f61f2b5dfdbdaf4ef482b9849f1">RTJsonResult::get_type</a></div><div class="ttdeci">RTJsonType get_type() const</div><div class="ttdoc">Get the type of JSON value represented by the RTJsonResult.</div></div>
<div class="ttc" id="aclass_r_t_json_result_html_a8ef82044cc93afde9b52aee9157957a9"><div class="ttname"><a href="class_r_t_json_result.html#a8ef82044cc93afde9b52aee9157957a9">RTJsonResult::get_int</a></div><div class="ttdeci">int get_int() const</div><div class="ttdoc">Interpret the JSON value as an int.</div></div>
</div><!-- fragment --> </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_r_t_json_parser_8h_source.html">RTJsonParser.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6
</small></address>
</body>
</html>