mastodonpp/docs/namespacemastodonpp.html

487 lines
58 KiB
HTML
Raw Normal View History

2020-01-03 12:47:36 +01:00
<!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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
2020-11-13 13:39:58 +01:00
<meta name="generator" content="Doxygen 1.8.17"/>
2020-01-03 12:47:36 +01:00
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mastodonpp: mastodonpp Namespace 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 style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">mastodonpp
2020-11-13 13:39:58 +01:00
&#160;<span id="projectnumber">0.5.5</span>
2020-01-03 12:47:36 +01:00
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
2020-11-13 13:39:58 +01:00
<!-- Generated by Doxygen 1.8.17 -->
2020-01-03 12:47:36 +01:00
<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>
<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:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(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">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
2020-01-06 14:47:08 +01:00
<a href="#typedef-members">Typedefs</a> &#124;
2020-01-05 13:28:39 +01:00
<a href="#enum-members">Enumerations</a> &#124;
2020-01-03 12:47:36 +01:00
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">mastodonpp Namespace Reference</div> </div>
</div><!--header-->
<div class="contents">
2020-01-05 13:28:39 +01:00
<p>C++ wrapper for the Mastodon API.
2020-01-03 12:47:36 +01:00
<a href="namespacemastodonpp.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
2020-01-04 11:40:17 +01:00
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a></td></tr>
2020-01-05 13:28:39 +01:00
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return type for Requests. <a href="structmastodonpp_1_1answer__type.html#details">More...</a><br /></td></tr>
2020-01-04 11:40:17 +01:00
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1API.html">API</a></td></tr>
2020-01-06 09:51:44 +01:00
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Holds API endpoints. <a href="classmastodonpp_1_1API.html#details">More...</a><br /></td></tr>
2020-01-04 11:40:17 +01:00
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-05 13:28:39 +01:00
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1Connection.html">Connection</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Represents a connection to an instance. Used for requests. <a href="classmastodonpp_1_1Connection.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-04 11:40:17 +01:00
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLException.html">CURLException</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exception for libcurl errors. <a href="classmastodonpp_1_1CURLException.html#details">More...</a><br /></td></tr>
2020-01-03 12:47:36 +01:00
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-05 13:28:39 +01:00
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handles the details of network connections. <a href="classmastodonpp_1_1CURLWrapper.html#details">More...</a><br /></td></tr>
2020-01-03 12:47:36 +01:00
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-09 18:51:18 +01:00
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmastodonpp_1_1event__type.html">event_type</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A stream event. <a href="structmastodonpp_1_1event__type.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-05 13:28:39 +01:00
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1Instance.html">Instance</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Holds the access data of an instance. <a href="classmastodonpp_1_1Instance.html#details">More...</a><br /></td></tr>
2020-01-03 12:47:36 +01:00
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
2020-01-06 14:47:08 +01:00
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
2020-01-08 22:43:13 +01:00
<tr class="memitem:ad228a850ba86374f95d9fa1fece3c33b"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemastodonpp.html#ad228a850ba86374f95d9fa1fece3c33b">endpoint_variant</a> = variant&lt; <a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f">API::endpoint_type</a>, string_view &gt;</td></tr>
<tr class="memdesc:ad228a850ba86374f95d9fa1fece3c33b"><td class="mdescLeft">&#160;</td><td class="mdescRight">An endpoint. Either <a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f" title="Type for endpoints. Can be API::v1, API::v2, API::oauth, API::other or API::pleroma.">API::endpoint_type</a> or <code>std::string_view</code>. <a href="namespacemastodonpp.html#ad228a850ba86374f95d9fa1fece3c33b">More...</a><br /></td></tr>
<tr class="separator:ad228a850ba86374f95d9fa1fece3c33b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8b3b89118adeccc71c54dfd36c987f6"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> = map&lt; string_view, variant&lt; string_view, vector&lt; string_view &gt; &gt;&gt;</td></tr>
2020-01-10 19:10:54 +01:00
<tr class="memdesc:af8b3b89118adeccc71c54dfd36c987f6"><td class="mdescLeft">&#160;</td><td class="mdescRight"><code>std::map</code> of parameters for API calls. <a href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">More...</a><br /></td></tr>
2020-01-08 22:43:13 +01:00
<tr class="separator:af8b3b89118adeccc71c54dfd36c987f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-10 19:10:54 +01:00
<tr class="memitem:a63b360bdefd56276e903619eb6a76049"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">parameterpair</a> = pair&lt; string_view, variant&lt; string_view, vector&lt; string_view &gt; &gt;&gt;</td></tr>
<tr class="memdesc:a63b360bdefd56276e903619eb6a76049"><td class="mdescLeft">&#160;</td><td class="mdescRight">A single parameter of a parametermap. <a href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">More...</a><br /></td></tr>
<tr class="separator:a63b360bdefd56276e903619eb6a76049"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-06 14:47:08 +01:00
</table><table class="memberdecls">
2020-01-05 13:28:39 +01:00
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
2020-01-06 09:51:44 +01:00
<tr class="memitem:a7d60fc71ad0fb1fbd467b37fe1f1f100"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a> { <br />
&#160;&#160;<b>GET</b>,
<b>POST</b>,
<b>PATCH</b>,
<b>PUT</b>,
<br />
&#160;&#160;<b>DELETE</b>
<br />
2020-01-05 13:28:39 +01:00
}</td></tr>
<tr class="memdesc:a7d60fc71ad0fb1fbd467b37fe1f1f100"><td class="mdescLeft">&#160;</td><td class="mdescRight">The HTTP method. <a href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">More...</a><br /></td></tr>
<tr class="separator:a7d60fc71ad0fb1fbd467b37fe1f1f100"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
2020-01-03 12:47:36 +01:00
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
2020-01-16 18:34:50 +01:00
<tr class="memitem:a4e42b93c60074920fb731ab6ba797935"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemastodonpp.html#a4e42b93c60074920fb731ab6ba797935">unescape_html</a> (string html)</td></tr>
<tr class="memdesc:a4e42b93c60074920fb731ab6ba797935"><td class="mdescLeft">&#160;</td><td class="mdescRight">Replaces HTML entities with UTF-8 characters. <a href="namespacemastodonpp.html#a4e42b93c60074920fb731ab6ba797935">More...</a><br /></td></tr>
<tr class="separator:a4e42b93c60074920fb731ab6ba797935"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-04 11:40:17 +01:00
<tr class="memitem:a9a5182698aabe03eb3a682b40053083d"><td class="memItemLeft" align="right" valign="top">std::ostream &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemastodonpp.html#a9a5182698aabe03eb3a682b40053083d">operator&lt;&lt;</a> (std::ostream &amp;out, const <a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a> &amp;answer)</td></tr>
<tr class="separator:a9a5182698aabe03eb3a682b40053083d"><td class="memSeparator" colspan="2">&#160;</td></tr>
2020-01-03 12:47:36 +01:00
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
2020-01-05 13:28:39 +01:00
<div class="textblock"><p>C++ wrapper for the Mastodon API. </p>
2020-01-03 12:47:36 +01:00
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
2020-01-06 14:47:08 +01:00
</div><h2 class="groupheader">Typedef Documentation</h2>
2020-01-08 22:43:13 +01:00
<a id="ad228a850ba86374f95d9fa1fece3c33b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad228a850ba86374f95d9fa1fece3c33b">&#9670;&nbsp;</a></span>endpoint_variant</h2>
2020-01-06 14:47:08 +01:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2020-01-08 22:43:13 +01:00
<td class="memname">using <a class="el" href="namespacemastodonpp.html#ad228a850ba86374f95d9fa1fece3c33b">mastodonpp::endpoint_variant</a> = typedef variant&lt;<a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f">API::endpoint_type</a>,string_view&gt;</td>
</tr>
</table>
</div><div class="memdoc">
<p>An endpoint. Either <a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f" title="Type for endpoints. Can be API::v1, API::v2, API::oauth, API::other or API::pleroma.">API::endpoint_type</a> or <code>std::string_view</code>. </p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
</div>
</div>
<a id="af8b3b89118adeccc71c54dfd36c987f6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8b3b89118adeccc71c54dfd36c987f6">&#9670;&nbsp;</a></span>parametermap</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">using <a class="el" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">mastodonpp::parametermap</a> = typedef map&lt;string_view, variant&lt;string_view, vector&lt;string_view&gt; &gt;&gt;</td>
2020-01-06 14:47:08 +01:00
</tr>
</table>
</div><div class="memdoc">
2020-01-10 19:10:54 +01:00
<p><code>std::map</code> of parameters for API calls. </p>
2020-01-11 17:19:34 +01:00
<p>Note that arrays always have to be specified as vectors, even if they have only 1 element. To send a file, use “<code>@file:</code>” followed by the file name as value.</p>
2020-01-08 22:43:13 +01:00
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> parameters</div>
2020-01-06 14:47:08 +01:00
<div class="line"> {</div>
2020-01-11 17:19:34 +01:00
<div class="line"> {<span class="stringliteral">&quot;poll[expires_in]&quot;</span>, <span class="stringliteral">&quot;86400&quot;</span>},</div>
<div class="line"> {<span class="stringliteral">&quot;poll[options]&quot;</span>, vector&lt;string_view&gt;{<span class="stringliteral">&quot;Yes&quot;</span>, <span class="stringliteral">&quot;No&quot;</span>, <span class="stringliteral">&quot;Maybe&quot;</span>}},</div>
<div class="line"> {<span class="stringliteral">&quot;status&quot;</span>, <span class="stringliteral">&quot;How is the weather?&quot;</span>}</div>
2020-01-06 14:47:08 +01:00
<div class="line"> };</div>
</div><!-- fragment --><dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
2020-01-10 19:10:54 +01:00
</div>
</div>
<a id="a63b360bdefd56276e903619eb6a76049"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a63b360bdefd56276e903619eb6a76049">&#9670;&nbsp;</a></span>parameterpair</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">using <a class="el" href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">mastodonpp::parameterpair</a> = typedef pair&lt;string_view, variant&lt;string_view, vector&lt;string_view&gt; &gt;&gt;</td>
</tr>
</table>
</div><div class="memdoc">
<p>A single parameter of a parametermap. </p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
2020-01-06 14:47:08 +01:00
</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
2020-01-05 13:28:39 +01:00
<a id="a7d60fc71ad0fb1fbd467b37fe1f1f100"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7d60fc71ad0fb1fbd467b37fe1f1f100">&#9670;&nbsp;</a></span>http_method</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">mastodonpp::http_method</a></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The HTTP method. </p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
2020-01-14 23:20:02 +01:00
<div class="fragment"><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;{</div>
2020-02-03 07:58:41 +01:00
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; GET, <span class="comment">// NOLINT(readability-identifier-naming)</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; POST, <span class="comment">// NOLINT(readability-identifier-naming)</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; PATCH, <span class="comment">// NOLINT(readability-identifier-naming)</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; PUT, <span class="comment">// NOLINT(readability-identifier-naming)</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; DELETE <span class="comment">// NOLINT(readability-identifier-naming)</span></div>
2020-01-14 23:20:02 +01:00
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;};</div>
2020-01-05 13:28:39 +01:00
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
2020-01-04 11:40:17 +01:00
<a id="a9a5182698aabe03eb3a682b40053083d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a5182698aabe03eb3a682b40053083d">&#9670;&nbsp;</a></span>operator&lt;&lt;()</h2>
2020-01-03 12:47:36 +01:00
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::ostream&amp; mastodonpp::operator&lt;&lt; </td>
<td>(</td>
<td class="paramtype">std::ostream &amp;&#160;</td>
<td class="paramname"><em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2020-01-04 11:40:17 +01:00
<td class="paramtype">const <a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a> &amp;&#160;</td>
2020-01-03 12:47:36 +01:00
<td class="paramname"><em>answer</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
2020-01-14 23:20:02 +01:00
<div class="fragment"><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;{</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; out &lt;&lt; answer.body;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">return</span> out;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;}</div>
2020-01-03 12:47:36 +01:00
</div><!-- fragment -->
</div>
</div>
2020-01-16 18:34:50 +01:00
<a id="a4e42b93c60074920fb731ab6ba797935"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4e42b93c60074920fb731ab6ba797935">&#9670;&nbsp;</a></span>unescape_html()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">string mastodonpp::unescape_html </td>
<td>(</td>
<td class="paramtype">string&#160;</td>
<td class="paramname"><em>html</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Replaces HTML entities with UTF-8 characters. </p>
<p>Supports named and numbered entities, decimal and hexadecimal.</p>
<p>Example: </p><div class="fragment"><div class="line"><span class="comment">// Will output: 2€ = 2€ = 2€</span></div>
<div class="line">std::cout &lt;&lt; <a class="code" href="namespacemastodonpp.html#a4e42b93c60074920fb731ab6ba797935">mastodonpp::unescape_html</a>(<span class="stringliteral">&quot;2&amp;euro; = 2&amp;#8364; = 2&amp;#x20ac;&quot;</span>);</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">html</td><td>The HTML to unescape.</td></tr>
</table>
</dd>
</dl>
<dl class="section since"><dt>Since</dt><dd>0.4.0 </dd></dl>
2020-02-03 07:58:41 +01:00
<div class="fragment"><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;{</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="keywordtype">string</span> buffer{move(html)};</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordtype">string</span> output;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="comment">// Source: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="comment">// entity_references#Character_entity_references_in_HTML</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <span class="keyword">const</span> map&lt;string_view, char32_t&gt; names</div>
2020-03-12 12:26:31 +01:00
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; {</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; { <span class="stringliteral">&quot;exclamation&quot;</span>, 0x0021 }, { <span class="stringliteral">&quot;quot&quot;</span>, 0x0022 },</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; { <span class="stringliteral">&quot;percent&quot;</span>, 0x0025 }, { <span class="stringliteral">&quot;amp&quot;</span>, 0x0026 },</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; { <span class="stringliteral">&quot;apos&quot;</span>, 0x0027 }, { <span class="stringliteral">&quot;add&quot;</span>, 0x002B },</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; { <span class="stringliteral">&quot;lt&quot;</span>, 0x003C }, { <span class="stringliteral">&quot;equal&quot;</span>, 0x003D },</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; { <span class="stringliteral">&quot;gt&quot;</span>, 0x003E }, { <span class="stringliteral">&quot;nbsp&quot;</span>, 0x00A0 },</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; { <span class="stringliteral">&quot;iexcl&quot;</span>, 0x00A1 }, { <span class="stringliteral">&quot;cent&quot;</span>, 0x00A2 },</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; { <span class="stringliteral">&quot;pound&quot;</span>, 0x00A3 }, { <span class="stringliteral">&quot;curren&quot;</span>, 0x00A4 },</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; { <span class="stringliteral">&quot;yen&quot;</span>, 0x00A5 }, { <span class="stringliteral">&quot;brvbar&quot;</span>, 0x00A6 },</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; { <span class="stringliteral">&quot;sect&quot;</span>, 0x00A7 }, { <span class="stringliteral">&quot;uml&quot;</span>, 0x00A8 },</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; { <span class="stringliteral">&quot;copy&quot;</span>, 0x00A9 }, { <span class="stringliteral">&quot;ordf&quot;</span>, 0x00AA },</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; { <span class="stringliteral">&quot;laquo&quot;</span>, 0x00AB }, { <span class="stringliteral">&quot;not&quot;</span>, 0x00AC },</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; { <span class="stringliteral">&quot;shy&quot;</span>, 0x00AD }, { <span class="stringliteral">&quot;reg&quot;</span>, 0x00AE },</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; { <span class="stringliteral">&quot;macr&quot;</span>, 0x00AF }, { <span class="stringliteral">&quot;deg&quot;</span>, 0x00B0 },</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; { <span class="stringliteral">&quot;plusmn&quot;</span>, 0x00B1 }, { <span class="stringliteral">&quot;sup2&quot;</span>, 0x00B2 },</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; { <span class="stringliteral">&quot;sup3&quot;</span>, 0x00B3 }, { <span class="stringliteral">&quot;acute&quot;</span>, 0x00B4 },</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; { <span class="stringliteral">&quot;micro&quot;</span>, 0x00B5 }, { <span class="stringliteral">&quot;para&quot;</span>, 0x00B6 },</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; { <span class="stringliteral">&quot;middot&quot;</span>, 0x00B7 }, { <span class="stringliteral">&quot;cedil&quot;</span>, 0x00B8 },</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; { <span class="stringliteral">&quot;sup1&quot;</span>, 0x00B9 }, { <span class="stringliteral">&quot;ordm&quot;</span>, 0x00BA },</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; { <span class="stringliteral">&quot;raquo&quot;</span>, 0x00BB }, { <span class="stringliteral">&quot;frac14&quot;</span>, 0x00BC },</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; { <span class="stringliteral">&quot;frac12&quot;</span>, 0x00BD }, { <span class="stringliteral">&quot;frac34&quot;</span>, 0x00BE },</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; { <span class="stringliteral">&quot;iquest&quot;</span>, 0x00BF }, { <span class="stringliteral">&quot;Agrave&quot;</span>, 0x00C0 },</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; { <span class="stringliteral">&quot;Aacute&quot;</span>, 0x00C1 }, { <span class="stringliteral">&quot;Acirc&quot;</span>, 0x00C2 },</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; { <span class="stringliteral">&quot;Atilde&quot;</span>, 0x00C3 }, { <span class="stringliteral">&quot;Auml&quot;</span>, 0x00C4 },</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; { <span class="stringliteral">&quot;Aring&quot;</span>, 0x00C5 }, { <span class="stringliteral">&quot;AElig&quot;</span>, 0x00C6 },</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; { <span class="stringliteral">&quot;Ccedil&quot;</span>, 0x00C7 }, { <span class="stringliteral">&quot;Egrave&quot;</span>, 0x00C8 },</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; { <span class="stringliteral">&quot;Eacute&quot;</span>, 0x00C9 }, { <span class="stringliteral">&quot;Ecirc&quot;</span>, 0x00CA },</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; { <span class="stringliteral">&quot;Euml&quot;</span>, 0x00CB }, { <span class="stringliteral">&quot;Igrave&quot;</span>, 0x00CC },</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; { <span class="stringliteral">&quot;Iacute&quot;</span>, 0x00CD }, { <span class="stringliteral">&quot;Icirc&quot;</span>, 0x00CE },</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; { <span class="stringliteral">&quot;Iuml&quot;</span>, 0x00CF }, { <span class="stringliteral">&quot;ETH&quot;</span>, 0x00D0 },</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; { <span class="stringliteral">&quot;Ntilde&quot;</span>, 0x00D1 }, { <span class="stringliteral">&quot;Ograve&quot;</span>, 0x00D2 },</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; { <span class="stringliteral">&quot;Oacute&quot;</span>, 0x00D3 }, { <span class="stringliteral">&quot;Ocirc&quot;</span>, 0x00D4 },</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; { <span class="stringliteral">&quot;Otilde&quot;</span>, 0x00D5 }, { <span class="stringliteral">&quot;Ouml&quot;</span>, 0x00D6 },</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; { <span class="stringliteral">&quot;times&quot;</span>, 0x00D7 }, { <span class="stringliteral">&quot;Oslash&quot;</span>, 0x00D8 },</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; { <span class="stringliteral">&quot;Ugrave&quot;</span>, 0x00D9 }, { <span class="stringliteral">&quot;Uacute&quot;</span>, 0x00DA },</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; { <span class="stringliteral">&quot;Ucirc&quot;</span>, 0x00DB }, { <span class="stringliteral">&quot;Uuml&quot;</span>, 0x00DC },</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; { <span class="stringliteral">&quot;Yacute&quot;</span>, 0x00DD }, { <span class="stringliteral">&quot;THORN&quot;</span>, 0x00DE },</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; { <span class="stringliteral">&quot;szlig&quot;</span>, 0x00DF }, { <span class="stringliteral">&quot;agrave&quot;</span>, 0x00E0 },</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; { <span class="stringliteral">&quot;aacute&quot;</span>, 0x00E1 }, { <span class="stringliteral">&quot;acirc&quot;</span>, 0x00E2 },</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; { <span class="stringliteral">&quot;atilde&quot;</span>, 0x00E3 }, { <span class="stringliteral">&quot;auml&quot;</span>, 0x00E4 },</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; { <span class="stringliteral">&quot;aring&quot;</span>, 0x00E5 }, { <span class="stringliteral">&quot;aelig&quot;</span>, 0x00E6 },</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; { <span class="stringliteral">&quot;ccedil&quot;</span>, 0x00E7 }, { <span class="stringliteral">&quot;egrave&quot;</span>, 0x00E8 },</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; { <span class="stringliteral">&quot;eacute&quot;</span>, 0x00E9 }, { <span class="stringliteral">&quot;ecirc&quot;</span>, 0x00EA },</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; { <span class="stringliteral">&quot;euml&quot;</span>, 0x00EB }, { <span class="stringliteral">&quot;igrave&quot;</span>, 0x00EC },</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; { <span class="stringliteral">&quot;iacute&quot;</span>, 0x00ED }, { <span class="stringliteral">&quot;icirc&quot;</span>, 0x00EE },</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; { <span class="stringliteral">&quot;iuml&quot;</span>, 0x00EF }, { <span class="stringliteral">&quot;eth&quot;</span>, 0x00F0 },</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; { <span class="stringliteral">&quot;ntilde&quot;</span>, 0x00F1 }, { <span class="stringliteral">&quot;ograve&quot;</span>, 0x00F2 },</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; { <span class="stringliteral">&quot;oacute&quot;</span>, 0x00F3 }, { <span class="stringliteral">&quot;ocirc&quot;</span>, 0x00F4 },</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; { <span class="stringliteral">&quot;otilde&quot;</span>, 0x00F5 }, { <span class="stringliteral">&quot;ouml&quot;</span>, 0x00F6 },</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; { <span class="stringliteral">&quot;divide&quot;</span>, 0x00F7 }, { <span class="stringliteral">&quot;oslash&quot;</span>, 0x00F8 },</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; { <span class="stringliteral">&quot;ugrave&quot;</span>, 0x00F9 }, { <span class="stringliteral">&quot;uacute&quot;</span>, 0x00FA },</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; { <span class="stringliteral">&quot;ucirc&quot;</span>, 0x00FB }, { <span class="stringliteral">&quot;uuml&quot;</span>, 0x00FC },</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; { <span class="stringliteral">&quot;yacute&quot;</span>, 0x00FD }, { <span class="stringliteral">&quot;thorn&quot;</span>, 0x00FE },</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; { <span class="stringliteral">&quot;yuml&quot;</span>, 0x00FF }, { <span class="stringliteral">&quot;OElig&quot;</span>, 0x0152 },</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; { <span class="stringliteral">&quot;oelig&quot;</span>, 0x0153 }, { <span class="stringliteral">&quot;Scaron&quot;</span>, 0x0160 },</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; { <span class="stringliteral">&quot;scaron&quot;</span>, 0x0161 }, { <span class="stringliteral">&quot;Yuml&quot;</span>, 0x0178 },</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; { <span class="stringliteral">&quot;fnof&quot;</span>, 0x0192 }, { <span class="stringliteral">&quot;circ&quot;</span>, 0x02C6 },</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; { <span class="stringliteral">&quot;tilde&quot;</span>, 0x02DC }, { <span class="stringliteral">&quot;Alpha&quot;</span>, 0x0391 },</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; { <span class="stringliteral">&quot;Beta&quot;</span>, 0x0392 }, { <span class="stringliteral">&quot;Gamma&quot;</span>, 0x0393 },</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; { <span class="stringliteral">&quot;Delta&quot;</span>, 0x0394 }, { <span class="stringliteral">&quot;Epsilon&quot;</span>, 0x0395 },</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; { <span class="stringliteral">&quot;Zeta&quot;</span>, 0x0396 }, { <span class="stringliteral">&quot;Eta&quot;</span>, 0x0397 },</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; { <span class="stringliteral">&quot;Theta&quot;</span>, 0x0398 }, { <span class="stringliteral">&quot;Iota&quot;</span>, 0x0399 },</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; { <span class="stringliteral">&quot;Kappa&quot;</span>, 0x039A }, { <span class="stringliteral">&quot;Lambda&quot;</span>, 0x039B },</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; { <span class="stringliteral">&quot;Mu&quot;</span>, 0x039C }, { <span class="stringliteral">&quot;Nu&quot;</span>, 0x039D },</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; { <span class="stringliteral">&quot;Xi&quot;</span>, 0x039E }, { <span class="stringliteral">&quot;Omicron&quot;</span>, 0x039F },</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; { <span class="stringliteral">&quot;Pi&quot;</span>, 0x03A0 }, { <span class="stringliteral">&quot;Rho&quot;</span>, 0x03A1 },</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; { <span class="stringliteral">&quot;Sigma&quot;</span>, 0x03A3 }, { <span class="stringliteral">&quot;Tau&quot;</span>, 0x03A4 },</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; { <span class="stringliteral">&quot;Upsilon&quot;</span>, 0x03A5 }, { <span class="stringliteral">&quot;Phi&quot;</span>, 0x03A6 },</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; { <span class="stringliteral">&quot;Chi&quot;</span>, 0x03A7 }, { <span class="stringliteral">&quot;Psi&quot;</span>, 0x03A8 },</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; { <span class="stringliteral">&quot;Omega&quot;</span>, 0x03A9 }, { <span class="stringliteral">&quot;alpha&quot;</span>, 0x03B1 },</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; { <span class="stringliteral">&quot;beta&quot;</span>, 0x03B2 }, { <span class="stringliteral">&quot;gamma&quot;</span>, 0x03B3 },</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; { <span class="stringliteral">&quot;delta&quot;</span>, 0x03B4 }, { <span class="stringliteral">&quot;epsilon&quot;</span>, 0x03B5 },</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; { <span class="stringliteral">&quot;zeta&quot;</span>, 0x03B6 }, { <span class="stringliteral">&quot;eta&quot;</span>, 0x03B7 },</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; { <span class="stringliteral">&quot;theta&quot;</span>, 0x03B8 }, { <span class="stringliteral">&quot;iota&quot;</span>, 0x03B9 },</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; { <span class="stringliteral">&quot;kappa&quot;</span>, 0x03BA }, { <span class="stringliteral">&quot;lambda&quot;</span>, 0x03BB },</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; { <span class="stringliteral">&quot;mu&quot;</span>, 0x03BC }, { <span class="stringliteral">&quot;nu&quot;</span>, 0x03BD },</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; { <span class="stringliteral">&quot;xi&quot;</span>, 0x03BE }, { <span class="stringliteral">&quot;omicron&quot;</span>, 0x03BF },</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; { <span class="stringliteral">&quot;pi&quot;</span>, 0x03C0 }, { <span class="stringliteral">&quot;rho&quot;</span>, 0x03C1 },</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; { <span class="stringliteral">&quot;sigmaf&quot;</span>, 0x03C2 }, { <span class="stringliteral">&quot;sigma&quot;</span>, 0x03C3 },</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; { <span class="stringliteral">&quot;tau&quot;</span>, 0x03C4 }, { <span class="stringliteral">&quot;upsilon&quot;</span>, 0x03C5 },</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; { <span class="stringliteral">&quot;phi&quot;</span>, 0x03C6 }, { <span class="stringliteral">&quot;chi&quot;</span>, 0x03C7 },</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; { <span class="stringliteral">&quot;psi&quot;</span>, 0x03C8 }, { <span class="stringliteral">&quot;omega&quot;</span>, 0x03C9 },</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; { <span class="stringliteral">&quot;thetasym&quot;</span>, 0x03D1 }, { <span class="stringliteral">&quot;upsih&quot;</span>, 0x03D2 },</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; { <span class="stringliteral">&quot;piv&quot;</span>, 0x03D6 }, { <span class="stringliteral">&quot;ensp&quot;</span>, 0x2002 },</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; { <span class="stringliteral">&quot;emsp&quot;</span>, 0x2003 }, { <span class="stringliteral">&quot;thinsp&quot;</span>, 0x2009 },</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; { <span class="stringliteral">&quot;zwnj&quot;</span>, 0x200C }, { <span class="stringliteral">&quot;zwj&quot;</span>, 0x200D },</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; { <span class="stringliteral">&quot;lrm&quot;</span>, 0x200E }, { <span class="stringliteral">&quot;rlm&quot;</span>, 0x200F },</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; { <span class="stringliteral">&quot;ndash&quot;</span>, 0x2013 }, { <span class="stringliteral">&quot;mdash&quot;</span>, 0x2014 },</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; { <span class="stringliteral">&quot;horbar&quot;</span>, 0x2015 }, { <span class="stringliteral">&quot;lsquo&quot;</span>, 0x2018 },</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; { <span class="stringliteral">&quot;rsquo&quot;</span>, 0x2019 }, { <span class="stringliteral">&quot;sbquo&quot;</span>, 0x201A },</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; { <span class="stringliteral">&quot;ldquo&quot;</span>, 0x201C }, { <span class="stringliteral">&quot;rdquo&quot;</span>, 0x201D },</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; { <span class="stringliteral">&quot;bdquo&quot;</span>, 0x201E }, { <span class="stringliteral">&quot;dagger&quot;</span>, 0x2020 },</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; { <span class="stringliteral">&quot;Dagger&quot;</span>, 0x2021 }, { <span class="stringliteral">&quot;bull&quot;</span>, 0x2022 },</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; { <span class="stringliteral">&quot;hellip&quot;</span>, 0x2026 }, { <span class="stringliteral">&quot;permil&quot;</span>, 0x2030 },</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; { <span class="stringliteral">&quot;prime&quot;</span>, 0x2032 }, { <span class="stringliteral">&quot;Prime&quot;</span>, 0x2033 },</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; { <span class="stringliteral">&quot;lsaquo&quot;</span>, 0x2039 }, { <span class="stringliteral">&quot;rsaquo&quot;</span>, 0x203A },</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; { <span class="stringliteral">&quot;oline&quot;</span>, 0x203E }, { <span class="stringliteral">&quot;frasl&quot;</span>, 0x2044 },</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; { <span class="stringliteral">&quot;euro&quot;</span>, 0x20AC }, { <span class="stringliteral">&quot;image&quot;</span>, 0x2111 },</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; { <span class="stringliteral">&quot;weierp&quot;</span>, 0x2118 }, { <span class="stringliteral">&quot;real&quot;</span>, 0x211C },</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; { <span class="stringliteral">&quot;trade&quot;</span>, 0x2122 }, { <span class="stringliteral">&quot;alefsym&quot;</span>, 0x2135 },</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; { <span class="stringliteral">&quot;larr&quot;</span>, 0x2190 }, { <span class="stringliteral">&quot;uarr&quot;</span>, 0x2191 },</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; { <span class="stringliteral">&quot;rarr&quot;</span>, 0x2192 }, { <span class="stringliteral">&quot;darr&quot;</span>, 0x2193 },</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; { <span class="stringliteral">&quot;harr&quot;</span>, 0x2194 }, { <span class="stringliteral">&quot;crarr&quot;</span>, 0x21B5 },</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; { <span class="stringliteral">&quot;lArr&quot;</span>, 0x21D0 }, { <span class="stringliteral">&quot;uArr&quot;</span>, 0x21D1 },</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; { <span class="stringliteral">&quot;rArr&quot;</span>, 0x21D2 }, { <span class="stringliteral">&quot;dArr&quot;</span>, 0x21D3 },</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; { <span class="stringliteral">&quot;hArr&quot;</span>, 0x21D4 }, { <span class="stringliteral">&quot;forall&quot;</span>, 0x2200 },</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; { <span class="stringliteral">&quot;part&quot;</span>, 0x2202 }, { <span class="stringliteral">&quot;exist&quot;</span>, 0x2203 },</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; { <span class="stringliteral">&quot;empty&quot;</span>, 0x2205 }, { <span class="stringliteral">&quot;nabla&quot;</span>, 0x2207 },</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; { <span class="stringliteral">&quot;isin&quot;</span>, 0x2208 }, { <span class="stringliteral">&quot;notin&quot;</span>, 0x2209 },</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; { <span class="stringliteral">&quot;ni&quot;</span>, 0x220B }, { <span class="stringliteral">&quot;prod&quot;</span>, 0x220F },</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; { <span class="stringliteral">&quot;sum&quot;</span>, 0x2211 }, { <span class="stringliteral">&quot;minus&quot;</span>, 0x2212 },</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; { <span class="stringliteral">&quot;lowast&quot;</span>, 0x2217 }, { <span class="stringliteral">&quot;radic&quot;</span>, 0x221A },</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; { <span class="stringliteral">&quot;prop&quot;</span>, 0x221D }, { <span class="stringliteral">&quot;infin&quot;</span>, 0x221E },</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; { <span class="stringliteral">&quot;ang&quot;</span>, 0x2220 }, { <span class="stringliteral">&quot;and&quot;</span>, 0x2227 },</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; { <span class="stringliteral">&quot;or&quot;</span>, 0x2228 }, { <span class="stringliteral">&quot;cap&quot;</span>, 0x2229 },</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; { <span class="stringliteral">&quot;cup&quot;</span>, 0x222A }, { <span class="stringliteral">&quot;int&quot;</span>, 0x222B },</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; { <span class="stringliteral">&quot;there4&quot;</span>, 0x2234 }, { <span class="stringliteral">&quot;sim&quot;</span>, 0x223C },</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; { <span class="stringliteral">&quot;cong&quot;</span>, 0x2245 }, { <span class="stringliteral">&quot;asymp&quot;</span>, 0x2248 },</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; { <span class="stringliteral">&quot;ne&quot;</span>, 0x2260 }, { <span class="stringliteral">&quot;equiv&quot;</span>, 0x2261 },</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; { <span class="stringliteral">&quot;le&quot;</span>, 0x2264 }, { <span class="stringliteral">&quot;ge&quot;</span>, 0x2265 },</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; { <span class="stringliteral">&quot;sub&quot;</span>, 0x2282 }, { <span class="stringliteral">&quot;sup&quot;</span>, 0x2283 },</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; { <span class="stringliteral">&quot;nsub&quot;</span>, 0x2284 }, { <span class="stringliteral">&quot;sube&quot;</span>, 0x2286 },</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; { <span class="stringliteral">&quot;supe&quot;</span>, 0x2287 }, { <span class="stringliteral">&quot;oplus&quot;</span>, 0x2295 },</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; { <span class="stringliteral">&quot;otimes&quot;</span>, 0x2297 }, { <span class="stringliteral">&quot;perp&quot;</span>, 0x22A5 },</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; { <span class="stringliteral">&quot;sdot&quot;</span>, 0x22C5 }, { <span class="stringliteral">&quot;lceil&quot;</span>, 0x2308 },</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; { <span class="stringliteral">&quot;rceil&quot;</span>, 0x2309 }, { <span class="stringliteral">&quot;lfloor&quot;</span>, 0x230A },</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; { <span class="stringliteral">&quot;rfloor&quot;</span>, 0x230B }, { <span class="stringliteral">&quot;lang&quot;</span>, 0x2329 },</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; { <span class="stringliteral">&quot;rang&quot;</span>, 0x232A }, { <span class="stringliteral">&quot;loz&quot;</span>, 0x25CA },</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; { <span class="stringliteral">&quot;spades&quot;</span>, 0x2660 }, { <span class="stringliteral">&quot;clubs&quot;</span>, 0x2663 },</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; { <span class="stringliteral">&quot;hearts&quot;</span>, 0x2665 }, { <span class="stringliteral">&quot;diams&quot;</span>, 0x2666 }</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; };</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; </div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="comment">// Used to convert number to utf-8 char.</span></div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; wstring_convert&lt;codecvt_utf8&lt;char32_t&gt;, char32_t&gt; u8c;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="comment">// Matches numbered entities between 1 and 8 digits, decimal or hexadecimal,</span></div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <span class="comment">// or named entities.</span></div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="keyword">const</span> regex re_entity{<span class="stringliteral">&quot;&amp;(#(x)?([[:alnum:]]{1,8})&quot;</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="stringliteral">&quot;|[^;[:space:][:punct:]]+);&quot;</span>};</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; smatch match;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; </div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordflow">while</span> (regex_search(buffer, match, re_entity))</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; {</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; output += match.prefix().str();</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordflow">try</span></div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; {</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="keyword">const</span> char32_t codepoint{[&amp;match, &amp;names]</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; {</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="comment">// If it doesn&#39;t start with a &#39;#&#39; it is a named entity.</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keywordflow">if</span> (match[1].str()[0] != <span class="charliteral">&#39;#&#39;</span>)</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; {</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <span class="keywordflow">return</span> names.at(match[1].str());</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; }</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="comment">// &#39;x&#39; after &#39;#&#39; means the number is hexadecimal.</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <span class="keywordflow">if</span> (match[2].length() == 1)</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; {</div>
2020-11-13 13:39:58 +01:00
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>char32_t<span class="keyword">&gt;</span>(stoul(match[3].str(),</div>
2020-03-12 12:26:31 +01:00
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="keyword">nullptr</span>, 16));</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; }</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="comment">// &#39;#&#39; without &#39;x&#39; means the number is decimal.</span></div>
2020-11-13 13:39:58 +01:00
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>char32_t<span class="keyword">&gt;</span>(stoul(match[3].str(),</div>
2020-03-12 12:26:31 +01:00
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <span class="keyword">nullptr</span>, 10));</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; }()};</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; output += u8c.to_bytes(codepoint);</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; }</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="keywordflow">catch</span> (<span class="keyword">const</span> std::out_of_range &amp;) <span class="comment">// Named entity could not be found.</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; {</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; output += match.str();</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; }</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; buffer = match.suffix().str();</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; }</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; output += buffer;</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keywordflow">return</span> output;</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;}</div>
2020-01-16 18:34:50 +01:00
</div><!-- fragment -->
</div>
</div>
2020-01-03 12:47:36 +01:00
</div><!-- contents -->
2020-01-16 19:21:38 +01:00
<div class="ttc" id="anamespacemastodonpp_html_af8b3b89118adeccc71c54dfd36c987f6"><div class="ttname"><a href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">mastodonpp::parametermap</a></div><div class="ttdeci">map&lt; string_view, variant&lt; string_view, vector&lt; string_view &gt; &gt;&gt; parametermap</div><div class="ttdoc">std::map of parameters for API calls.</div><div class="ttdef"><b>Definition:</b> types.hpp:64</div></div>
2020-02-03 07:58:41 +01:00
<div class="ttc" id="anamespacemastodonpp_html_a4e42b93c60074920fb731ab6ba797935"><div class="ttname"><a href="namespacemastodonpp.html#a4e42b93c60074920fb731ab6ba797935">mastodonpp::unescape_html</a></div><div class="ttdeci">string unescape_html(string html)</div><div class="ttdoc">Replaces HTML entities with UTF-8 characters.</div><div class="ttdef"><b>Definition:</b> helpers.cpp:39</div></div>
2020-01-03 12:47:36 +01:00
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
2020-11-13 13:39:58 +01:00
</a> 1.8.17
2020-01-03 12:47:36 +01:00
</small></address>
</body>
</html>