mastodonpp/docs/types_8hpp_source.html

182 lines
22 KiB
HTML

<!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"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mastodonpp: include/types.hpp 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="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
&#160;<span id="projectnumber">0.5.7</span>
</div>
<div id="projectbrief">C++ wrapper for the Mastodon and Pleroma APIs.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">types.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/* This file is part of mastodonpp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * Copyright © 2020 tastytea &lt;tastytea@tastytea.de&gt;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> * This program is free software: you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * it under the terms of the GNU Affero General Public License as published by</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> * the Free Software Foundation, version 3.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * This program is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> * GNU Affero General Public License for more details.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> * You should have received a copy of the GNU Affero General Public License</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> * along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment">// Types that are used in more than one file.</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#ifndef MASTODONPP_TYPES_HPP</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#define MASTODONPP_TYPES_HPP</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;ostream&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &lt;string_view&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;utility&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#include &lt;variant&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacemastodonpp.html">mastodonpp</a></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;{</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="keyword">using</span> std::map;</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="keyword">using</span> std::ostream;</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="keyword">using</span> std::pair;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="keyword">using</span> std::string;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="keyword">using</span> std::string_view;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="keyword">using</span> std::uint16_t;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="keyword">using</span> std::uint8_t;</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="keyword">using</span> std::variant;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="keyword">using</span> std::vector;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="keyword">using</span> <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> = map&lt;string_view,</div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6"> 64</a></span>&#160; variant&lt;string_view, vector&lt;string_view&gt;&gt;&gt;;</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="keyword">using</span> <a class="code" href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">parameterpair</a> = pair&lt;string_view,</div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049"> 72</a></span>&#160; variant&lt;string_view, vector&lt;string_view&gt;&gt;&gt;;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; </div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html"> 79</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structmastodonpp_1_1answer__type.html">answer_type</a></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;{</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#a7c5582c4500034c0ea36ab1694944139"> 91</a></span>&#160; uint8_t <a class="code" href="structmastodonpp_1_1answer__type.html#a7c5582c4500034c0ea36ab1694944139">curl_error_code</a>{0};</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#adda74145891e444f223ccdfe623af726"> 98</a></span>&#160; <span class="keywordtype">string</span> <a class="code" href="structmastodonpp_1_1answer__type.html#adda74145891e444f223ccdfe623af726">error_message</a>;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#a0716af5033e02551937187a149c3f52d"> 105</a></span>&#160; uint16_t <a class="code" href="structmastodonpp_1_1answer__type.html#a0716af5033e02551937187a149c3f52d">http_status</a>{0};</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; </div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#ab84b7094800ffe32d34b33085dcef9aa"> 112</a></span>&#160; <span class="keywordtype">string</span> <a class="code" href="structmastodonpp_1_1answer__type.html#ab84b7094800ffe32d34b33085dcef9aa">headers</a>;</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#a9da206eb4954ff15402083379909cc38"> 119</a></span>&#160; <span class="keywordtype">string</span> <a class="code" href="structmastodonpp_1_1answer__type.html#a9da206eb4954ff15402083379909cc38">body</a>;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keyword">explicit</span> <span class="keyword">operator</span> bool() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="keyword">explicit</span> <span class="keyword">operator</span> string_view() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="keyword">friend</span> ostream &amp;<a class="code" href="structmastodonpp_1_1answer__type.html#a0154563855aee896209319101c217106">operator&lt;&lt;</a>(ostream &amp;out, <span class="keyword">const</span> <a class="code" href="structmastodonpp_1_1answer__type.html">answer_type</a> &amp;answer);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; </div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; [[nodiscard]] string_view <a class="code" href="structmastodonpp_1_1answer__type.html#a65f4ba85d95c15ebc07377a2b74959da">get_header</a>(string_view field) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; </div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#a12606bd15901a56b80e3a68b6078294d"> 161</a></span>&#160; [[nodiscard]] <span class="keyword">inline</span> <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> <a class="code" href="structmastodonpp_1_1answer__type.html#a12606bd15901a56b80e3a68b6078294d">next</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <span class="keywordflow">return</span> parse_pagination(<span class="keyword">true</span>);</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; }</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; </div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="structmastodonpp_1_1answer__type.html#a54baac6518a4178062d6963661ba50e9"> 174</a></span>&#160; [[nodiscard]] <span class="keyword">inline</span> <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> <a class="code" href="structmastodonpp_1_1answer__type.html#a54baac6518a4178062d6963661ba50e9">prev</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="keywordflow">return</span> parse_pagination(<span class="keyword">false</span>);</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="keyword">private</span>:</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; [[nodiscard]] <a class="code" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> parse_pagination(<span class="keywordtype">bool</span> <a class="code" href="structmastodonpp_1_1answer__type.html#a12606bd15901a56b80e3a68b6078294d">next</a>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;};</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; </div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;} <span class="comment">// namespace mastodonpp</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; </div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;<span class="preprocessor">#endif // MASTODONPP_TYPES_HPP</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a0154563855aee896209319101c217106"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a0154563855aee896209319101c217106">mastodonpp::answer_type::operator&lt;&lt;</a></div><div class="ttdeci">friend ostream &amp; operator&lt;&lt;(ostream &amp;out, const answer_type &amp;answer)</div><div class="ttdoc">Returns body as std::ostream.</div><div class="ttdef"><b>Definition:</b> types.cpp:40</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a54baac6518a4178062d6963661ba50e9"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a54baac6518a4178062d6963661ba50e9">mastodonpp::answer_type::prev</a></div><div class="ttdeci">parametermap prev() const</div><div class="ttdoc">Returns the parameters needed for the previous entries.</div><div class="ttdef"><b>Definition:</b> types.hpp:174</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_ab84b7094800ffe32d34b33085dcef9aa"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#ab84b7094800ffe32d34b33085dcef9aa">mastodonpp::answer_type::headers</a></div><div class="ttdeci">string headers</div><div class="ttdoc">The headers of the response from the server.</div><div class="ttdef"><b>Definition:</b> types.hpp:112</div></div>
<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>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a7c5582c4500034c0ea36ab1694944139"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a7c5582c4500034c0ea36ab1694944139">mastodonpp::answer_type::curl_error_code</a></div><div class="ttdeci">uint8_t curl_error_code</div><div class="ttdoc">The error code returned by libcurl.</div><div class="ttdef"><b>Definition:</b> types.hpp:91</div></div>
<div class="ttc" id="anamespacemastodonpp_html"><div class="ttname"><a href="namespacemastodonpp.html">mastodonpp</a></div><div class="ttdoc">C++ wrapper for the Mastodon API.</div><div class="ttdef"><b>Definition:</b> api.hpp:24</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a9da206eb4954ff15402083379909cc38"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a9da206eb4954ff15402083379909cc38">mastodonpp::answer_type::body</a></div><div class="ttdeci">string body</div><div class="ttdoc">The response from the server, usually JSON.</div><div class="ttdef"><b>Definition:</b> types.hpp:119</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_adda74145891e444f223ccdfe623af726"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#adda74145891e444f223ccdfe623af726">mastodonpp::answer_type::error_message</a></div><div class="ttdeci">string error_message</div><div class="ttdoc">The error message.</div><div class="ttdef"><b>Definition:</b> types.hpp:98</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html">mastodonpp::answer_type</a></div><div class="ttdoc">Return type for Requests.</div><div class="ttdef"><b>Definition:</b> types.hpp:79</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a65f4ba85d95c15ebc07377a2b74959da"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a65f4ba85d95c15ebc07377a2b74959da">mastodonpp::answer_type::get_header</a></div><div class="ttdeci">string_view get_header(string_view field) const</div><div class="ttdoc">Returns the value of a header field.</div><div class="ttdef"><b>Definition:</b> types.cpp:46</div></div>
<div class="ttc" id="anamespacemastodonpp_html_a63b360bdefd56276e903619eb6a76049"><div class="ttname"><a href="namespacemastodonpp.html#a63b360bdefd56276e903619eb6a76049">mastodonpp::parameterpair</a></div><div class="ttdeci">pair&lt; string_view, variant&lt; string_view, vector&lt; string_view &gt; &gt;&gt; parameterpair</div><div class="ttdoc">A single parameter of a parametermap.</div><div class="ttdef"><b>Definition:</b> types.hpp:72</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a0716af5033e02551937187a149c3f52d"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a0716af5033e02551937187a149c3f52d">mastodonpp::answer_type::http_status</a></div><div class="ttdeci">uint16_t http_status</div><div class="ttdoc">HTTP status code.</div><div class="ttdef"><b>Definition:</b> types.hpp:105</div></div>
<div class="ttc" id="astructmastodonpp_1_1answer__type_html_a12606bd15901a56b80e3a68b6078294d"><div class="ttname"><a href="structmastodonpp_1_1answer__type.html#a12606bd15901a56b80e3a68b6078294d">mastodonpp::answer_type::next</a></div><div class="ttdeci">parametermap next() const</div><div class="ttdoc">Returns the parameters needed for the next entries.</div><div class="ttdef"><b>Definition:</b> types.hpp:161</div></div>
<!-- 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"/>
</a> 1.8.17
</small></address>
</body>
</html>