| <!-- 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: include/rapidjson/cursorstreamwrapper.h Source File</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&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&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&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&dn=gpl-2.0.txt GPL-v2 */ |
| $(document).ready(function(){initNavTree('cursorstreamwrapper_8h_source.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="headertitle"> |
| <div class="title">cursorstreamwrapper.h</div> </div> |
| </div><!--header--> |
| <div class="contents"> |
| <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Tencent is pleased to support the open source community by making RapidJSON available.</span></div> |
| <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">//</span></div> |
| <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.</span></div> |
| <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div> |
| <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// Licensed under the MIT License (the "License"); you may not use this file except</span></div> |
| <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">// in compliance with the License. You may obtain a copy of the License at</span></div> |
| <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">//</span></div> |
| <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">// http://opensource.org/licenses/MIT</span></div> |
| <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">//</span></div> |
| <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">// Unless required by applicable law or agreed to in writing, software distributed</span></div> |
| <div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR</span></div> |
| <div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">// CONDITIONS OF ANY KIND, either express or implied. See the License for the</span></div> |
| <div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">// specific language governing permissions and limitations under the License.</span></div> |
| <div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  </div> |
| <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#ifndef RAPIDJSON_CURSORSTREAMWRAPPER_H_</span></div> |
| <div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#define RAPIDJSON_CURSORSTREAMWRAPPER_H_</span></div> |
| <div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  </div> |
| <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "stream.h"</span></div> |
| <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  </div> |
| <div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#if defined(__GNUC__)</span></div> |
| <div class="line"><a name="l00021"></a><span class="lineno"> 21</span> RAPIDJSON_DIAG_PUSH</div> |
| <div class="line"><a name="l00022"></a><span class="lineno"> 22</span> RAPIDJSON_DIAG_OFF(effc++)</div> |
| <div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  </div> |
| <div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#if defined(_MSC_VER) && _MSC_VER <= 1800</span></div> |
| <div class="line"><a name="l00026"></a><span class="lineno"> 26</span> RAPIDJSON_DIAG_PUSH</div> |
| <div class="line"><a name="l00027"></a><span class="lineno"> 27</span> RAPIDJSON_DIAG_OFF(4702) <span class="comment">// unreachable code</span></div> |
| <div class="line"><a name="l00028"></a><span class="lineno"> 28</span> RAPIDJSON_DIAG_OFF(4512) <span class="comment">// assignment operator could not be generated</span></div> |
| <div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  </div> |
| <div class="line"><a name="l00031"></a><span class="lineno"> 31</span> RAPIDJSON_NAMESPACE_BEGIN</div> |
| <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  </div> |
| <div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="comment"></span> </div> |
| <div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="comment">//! Cursor stream wrapper for counting line and column number if error exists.</span></div> |
| <div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="comment"></span><span class="comment">/*!</span></div> |
| <div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="comment"> \tparam InputStream Any stream that implements Stream Concept</span></div> |
| <div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="comment">*/</span></div> |
| <div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keyword">template</span> <<span class="keyword">typename</span> InputStream, <span class="keyword">typename</span> Encoding = UTF8<> ></div> |
| <div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classrapidjson_1_1_cursor_stream_wrapper.html"> 39</a></span> <span class="keyword">class </span><a class="code" href="classrapidjson_1_1_cursor_stream_wrapper.html">CursorStreamWrapper</a> : <span class="keyword">public</span> <a class="code" href="classrapidjson_1_1_generic_stream_wrapper.html">GenericStreamWrapper</a><InputStream, Encoding> {</div> |
| <div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">public</span>:</div> |
| <div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keyword">typedef</span> <span class="keyword">typename</span> Encoding::Ch Ch;</div> |
| <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  </div> |
| <div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <a class="code" href="classrapidjson_1_1_cursor_stream_wrapper.html">CursorStreamWrapper</a>(InputStream& is):</div> |
| <div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <a class="code" href="classrapidjson_1_1_generic_stream_wrapper.html">GenericStreamWrapper<InputStream, Encoding></a>(is), line_(1), col_(0) {}</div> |
| <div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  </div> |
| <div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="comment">// counting line and column number</span></div> |
| <div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  Ch Take() {</div> |
| <div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  Ch ch = this->is_.Take();</div> |
| <div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">if</span>(ch == <span class="charliteral">'\n'</span>) {</div> |
| <div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  line_ ++;</div> |
| <div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  col_ = 0;</div> |
| <div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  } <span class="keywordflow">else</span> {</div> |
| <div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  col_ ++;</div> |
| <div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  }</div> |
| <div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keywordflow">return</span> ch;</div> |
| <div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  }</div> |
| <div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="comment"></span> </div> |
| <div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="comment"> //! Get the error line number, if error exists.</span></div> |
| <div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classrapidjson_1_1_cursor_stream_wrapper.html#a97c6cbbd334911639fe522bbfdd350b7"> 59</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="classrapidjson_1_1_cursor_stream_wrapper.html#a97c6cbbd334911639fe522bbfdd350b7">GetLine</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> line_; }<span class="comment"></span></div> |
| <div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="comment"> //! Get the error column number, if error exists.</span></div> |
| <div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classrapidjson_1_1_cursor_stream_wrapper.html#a33002632924bb10108077a22c6aa108d"> 61</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="classrapidjson_1_1_cursor_stream_wrapper.html#a33002632924bb10108077a22c6aa108d">GetColumn</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> col_; }</div> |
| <div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  </div> |
| <div class="line"><a name="l00063"></a><span class="lineno"> 63</span> <span class="keyword">private</span>:</div> |
| <div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordtype">size_t</span> line_; <span class="comment">//!< Current Line</span></div> |
| <div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="comment"></span> <span class="keywordtype">size_t</span> col_; <span class="comment">//!< Current Column</span></div> |
| <div class="line"><a name="l00066"></a><span class="lineno"> 66</span> <span class="comment"></span>};</div> |
| <div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  </div> |
| <div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="preprocessor">#if defined(_MSC_VER) && _MSC_VER <= 1800</span></div> |
| <div class="line"><a name="l00069"></a><span class="lineno"> 69</span> RAPIDJSON_DIAG_POP</div> |
| <div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  </div> |
| <div class="line"><a name="l00072"></a><span class="lineno"> 72</span> <span class="preprocessor">#if defined(__GNUC__)</span></div> |
| <div class="line"><a name="l00073"></a><span class="lineno"> 73</span> RAPIDJSON_DIAG_POP</div> |
| <div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="preprocessor">#endif</span></div> |
| <div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div> |
| <div class="line"><a name="l00076"></a><span class="lineno"> 76</span> RAPIDJSON_NAMESPACE_END</div> |
| <div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  </div> |
| <div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="preprocessor">#endif // RAPIDJSON_CURSORSTREAMWRAPPER_H_</span></div> |
| </div><!-- fragment --></div><!-- contents --> |
| </div><!-- doc-content --> |
| <div class="ttc" id="aclassrapidjson_1_1_cursor_stream_wrapper_html_a33002632924bb10108077a22c6aa108d"><div class="ttname"><a href="classrapidjson_1_1_cursor_stream_wrapper.html#a33002632924bb10108077a22c6aa108d">rapidjson::CursorStreamWrapper::GetColumn</a></div><div class="ttdeci">size_t GetColumn() const</div><div class="ttdoc">Get the error column number, if error exists.</div><div class="ttdef"><b>Definition:</b> cursorstreamwrapper.h:61</div></div> |
| <div class="ttc" id="aclassrapidjson_1_1_generic_stream_wrapper_html"><div class="ttname"><a href="classrapidjson_1_1_generic_stream_wrapper.html">rapidjson::GenericStreamWrapper</a></div><div class="ttdoc">A Stream Wrapper.</div><div class="ttdef"><b>Definition:</b> stream.h:119</div></div> |
| <div class="ttc" id="aclassrapidjson_1_1_cursor_stream_wrapper_html_a97c6cbbd334911639fe522bbfdd350b7"><div class="ttname"><a href="classrapidjson_1_1_cursor_stream_wrapper.html#a97c6cbbd334911639fe522bbfdd350b7">rapidjson::CursorStreamWrapper::GetLine</a></div><div class="ttdeci">size_t GetLine() const</div><div class="ttdoc">Get the error line number, if error exists.</div><div class="ttdef"><b>Definition:</b> cursorstreamwrapper.h:59</div></div> |
| <div class="ttc" id="aclassrapidjson_1_1_cursor_stream_wrapper_html"><div class="ttname"><a href="classrapidjson_1_1_cursor_stream_wrapper.html">rapidjson::CursorStreamWrapper</a></div><div class="ttdoc">Cursor stream wrapper for counting line and column number if error exists.</div><div class="ttdef"><b>Definition:</b> cursorstreamwrapper.h:39</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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_32fb88e4d38e67d524aa70efbc36f66b.html">rapidjson</a></li><li class="navelem"><b>cursorstreamwrapper.h</b></li> |
| </ul> |
| </div> |
| </body> |
| </html> |