Willkommen bei WordPress. Dies ist dein erster Beitrag. Bearbeite oder lösche ihn und beginne mit dem Schreiben!
Hallo Welt!
von raredesign | Dez 3, 2019 | Allgemein | 0 Kommentare
Cokiee Shell
Current Path : /usr/share/doc/libjsoncpp-dev/jsoncpp-api-html/ |
Current File : //usr/share/doc/libjsoncpp-dev/jsoncpp-api-html/json__tool_8h_source.html |
<html> <head> <title> JsonCpp - JSON data format manipulation library </title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ffffff"> <table width="100%"> <tr> <td width="40%" align="left" valign="center"> <a href="http://sourceforge.net/projects/jsoncpp/"> JsonCpp project page </a> </td> <td width="40%" align="right" valign="center"> <a href="http://jsoncpp.sourceforge.net">JsonCpp home page</a> </td> </tr> </table> <hr> <!-- Generated by Doxygen 1.7.6.1 --> <script type="text/javascript" src="dynsections.js"></script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_98a0868cf2f166cd104f97edd9e7e6b0.html">src</a> </li> <li class="navelem"><a class="el" href="dir_c3e165d54b8a49f78816620c9cb89059.html">lib_json</a> </li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">json_tool.h</div> </div> </div><!--header--> <div class="contents"> <a href="json__tool_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright 2007-2010 Baptiste Lepilleur</span> <a name="l00002"></a>00002 <span class="comment">// Distributed under MIT license, or public domain if desired and</span> <a name="l00003"></a>00003 <span class="comment">// recognized in your jurisdiction.</span> <a name="l00004"></a>00004 <span class="comment">// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE</span> <a name="l00005"></a>00005 <a name="l00006"></a>00006 <span class="preprocessor">#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED</span> <a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor"># define LIB_JSONCPP_JSON_TOOL_H_INCLUDED</span> <a name="l00008"></a>00008 <span class="preprocessor"></span> <a name="l00009"></a>00009 <span class="comment">/* This header provides common string manipulation support, such as UTF-8,</span> <a name="l00010"></a>00010 <span class="comment"> * portable conversion from/to string...</span> <a name="l00011"></a>00011 <span class="comment"> *</span> <a name="l00012"></a>00012 <span class="comment"> * It is an internal header that must not be exposed.</span> <a name="l00013"></a>00013 <span class="comment"> */</span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="keyword">namespace </span>Json { <a name="l00016"></a>00016 <a name="l00018"></a>00018 <span class="keyword">static</span> <span class="keyword">inline</span> std::string <a name="l00019"></a><a class="code" href="namespace_json.html#adf0456e397a18cd7218a7b51dfc13c73">00019</a> <a class="code" href="namespace_json.html#adf0456e397a18cd7218a7b51dfc13c73" title="Converts a unicode code-point to UTF-8.">codePointToUTF8</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> cp) <a name="l00020"></a>00020 { <a name="l00021"></a>00021 std::string result; <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="comment">// based on description from http://en.wikipedia.org/wiki/UTF-8</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="keywordflow">if</span> (cp <= 0x7f) <a name="l00026"></a>00026 { <a name="l00027"></a>00027 result.resize(1); <a name="l00028"></a>00028 result[0] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(cp); <a name="l00029"></a>00029 } <a name="l00030"></a>00030 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cp <= 0x7FF) <a name="l00031"></a>00031 { <a name="l00032"></a>00032 result.resize(2); <a name="l00033"></a>00033 result[1] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0x80 | (0x3f & cp)); <a name="l00034"></a>00034 result[0] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0xC0 | (0x1f & (cp >> 6))); <a name="l00035"></a>00035 } <a name="l00036"></a>00036 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cp <= 0xFFFF) <a name="l00037"></a>00037 { <a name="l00038"></a>00038 result.resize(3); <a name="l00039"></a>00039 result[2] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0x80 | (0x3f & cp)); <a name="l00040"></a>00040 result[1] = 0x80 | <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>((0x3f & (cp >> 6))); <a name="l00041"></a>00041 result[0] = 0xE0 | <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>((0xf & (cp >> 12))); <a name="l00042"></a>00042 } <a name="l00043"></a>00043 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cp <= 0x10FFFF) <a name="l00044"></a>00044 { <a name="l00045"></a>00045 result.resize(4); <a name="l00046"></a>00046 result[3] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0x80 | (0x3f & cp)); <a name="l00047"></a>00047 result[2] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0x80 | (0x3f & (cp >> 6))); <a name="l00048"></a>00048 result[1] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0x80 | (0x3f & (cp >> 12))); <a name="l00049"></a>00049 result[0] = <span class="keyword">static_cast<</span><span class="keywordtype">char</span><span class="keyword">></span>(0xF0 | (0x7 & (cp >> 18))); <a name="l00050"></a>00050 } <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keywordflow">return</span> result; <a name="l00053"></a>00053 } <a name="l00054"></a>00054 <a name="l00055"></a>00055 <a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a name="l00058"></a><a class="code" href="namespace_json.html#a0381e631737f51331065a388f4f59197">00058</a> <a class="code" href="namespace_json.html#a0381e631737f51331065a388f4f59197" title="Returns true if ch is a control character (in range [0,32[).">isControlCharacter</a>(<span class="keywordtype">char</span> ch) <a name="l00059"></a>00059 { <a name="l00060"></a>00060 <span class="keywordflow">return</span> ch > 0 && ch <= 0x1F; <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="keyword">enum</span> { <a name="l00066"></a><a class="code" href="namespace_json.html#a7ecb56fc8de76a41123995225ca54986ae4f2008c7919f20d81286121d1374424">00066</a> <a class="code" href="namespace_json.html#a7ecb56fc8de76a41123995225ca54986ae4f2008c7919f20d81286121d1374424" title="Constant that specify the size of the buffer that must be passed to uintToString.">uintToStringBufferSize</a> = 3*<span class="keyword">sizeof</span>(<a class="code" href="namespace_json.html#ae202ecad69725e23443f465e257456d0">LargestUInt</a>)+1 <a name="l00067"></a>00067 }; <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="comment">// Defines a char buffer for use with uintToString().</span> <a name="l00070"></a><a class="code" href="namespace_json.html#a602bcf69c2042fb61c3b243cb16f04ca">00070</a> <span class="keyword">typedef</span> <span class="keywordtype">char</span> <a class="code" href="namespace_json.html#a602bcf69c2042fb61c3b243cb16f04ca">UIntToStringBuffer</a>[<a class="code" href="namespace_json.html#a7ecb56fc8de76a41123995225ca54986ae4f2008c7919f20d81286121d1374424" title="Constant that specify the size of the buffer that must be passed to uintToString.">uintToStringBufferSize</a>]; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <a name="l00078"></a>00078 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00079"></a><a class="code" href="namespace_json.html#ac1ffd21a9e55122014353c773ccc496e">00079</a> <a class="code" href="namespace_json.html#ac1ffd21a9e55122014353c773ccc496e" title="Converts an unsigned integer to string.">uintToString</a>( <a class="code" href="namespace_json.html#ae202ecad69725e23443f465e257456d0">LargestUInt</a> value, <a name="l00080"></a>00080 <span class="keywordtype">char</span> *&current ) <a name="l00081"></a>00081 { <a name="l00082"></a>00082 *--current = 0; <a name="l00083"></a>00083 <span class="keywordflow">do</span> <a name="l00084"></a>00084 { <a name="l00085"></a>00085 *--current = char(value % 10) + <span class="charliteral">'0'</span>; <a name="l00086"></a>00086 value /= 10; <a name="l00087"></a>00087 } <a name="l00088"></a>00088 <span class="keywordflow">while</span> ( value != 0 ); <a name="l00089"></a>00089 } <a name="l00090"></a>00090 <a name="l00091"></a>00091 } <span class="comment">// namespace Json {</span> <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="preprocessor">#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED</span> </pre></div></div><!-- contents --> <hr> <table width="100%"> <tr> <td width="10%" align="left" valign="center"> <a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=144446" width="88" height="31" border="0" alt="SourceForge Logo"></a> </td> <td width="20%" align="left" valign="center"> hosts this site. </td> <td> </td> <td align="right" valign="center"> Send comments to:<br> <a href="mailto:jsoncpp-devel@lists.sourceforge.net">Json-cpp Developers</a> </td> </tr> </table> </body> </html>
Cokiee Shell Web 1.0, Coded By Razor
Neueste Kommentare