182 lines
20 KiB
HTML
182 lines
20 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.16"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>mastodonpp: include/instance.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
|
|
 <span id="projectnumber">0.1.0</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</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>
|
|
<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&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">instance.hpp</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">/* This file is part of mastodonpp.</span></div>
|
|
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright © 2020 tastytea <tastytea@tastytea.de></span></div>
|
|
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <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> <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> <span class="comment"> * the Free Software Foundation, version 3.</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"> * 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> <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> <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> <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> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <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> <span class="comment"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span></div>
|
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  </div>
|
|
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#ifndef MASTODONPP_INSTANCE_HPP</span></div>
|
|
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#define MASTODONPP_INSTANCE_HPP</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">#include "curl_wrapper.hpp"</span></div>
|
|
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  </div>
|
|
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <cstdint></span></div>
|
|
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <string></span></div>
|
|
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <string_view></span></div>
|
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <utility></span></div>
|
|
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  </div>
|
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="keyword">namespace </span><a class="code" href="namespacemastodonpp.html">mastodonpp</a></div>
|
|
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> {</div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  </div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="keyword">using</span> std::uint64_t;</div>
|
|
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">using</span> std::string;</div>
|
|
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">using</span> std::string_view;</div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="keyword">using</span> std::move;</div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  </div>
|
|
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html"> 42</a></span> <span class="keyword">class </span><a class="code" href="classmastodonpp_1_1Instance.html">Instance</a> : <span class="keyword">public</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a></div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> {</div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="keyword">public</span>:</div>
|
|
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keyword">explicit</span> <a class="code" href="classmastodonpp_1_1Instance.html#a21b859e2b9b5c6f48e8d0a194a659888">Instance</a>(string_view hostname, string_view access_token);</div>
|
|
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  </div>
|
|
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html#a24518d4603779ffc5cd89c814a687724"> 63</a></span>  <span class="keyword">inline</span> string_view <a class="code" href="classmastodonpp_1_1Instance.html#a24518d4603779ffc5cd89c814a687724">get_hostname</a>()<span class="keyword"> const</span></div>
|
|
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="keyword"> </span>{</div>
|
|
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">return</span> _hostname;</div>
|
|
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  }</div>
|
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  </div>
|
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html#aeb5e018b566f8ab1a3c50193ead6be81"> 76</a></span>  <span class="keyword">inline</span> string_view <a class="code" href="classmastodonpp_1_1Instance.html#aeb5e018b566f8ab1a3c50193ead6be81">get_baseuri</a>()<span class="keyword"> const</span></div>
|
|
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="keyword"> </span>{</div>
|
|
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">return</span> _baseuri;</div>
|
|
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div>
|
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  </div>
|
|
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html#ab59e3ce5f1d5c00110465c6f562a1574"> 87</a></span>  <span class="keyword">inline</span> string_view <a class="code" href="classmastodonpp_1_1Instance.html#ab59e3ce5f1d5c00110465c6f562a1574">get_access_token</a>()<span class="keyword"> const</span></div>
|
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="keyword"> </span>{</div>
|
|
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="keywordflow">return</span> _access_token;</div>
|
|
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</div>
|
|
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  </div>
|
|
<div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html#a1e606235a69d150b59bd90c78069de22"> 100</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1Instance.html#a1e606235a69d150b59bd90c78069de22">set_access_token</a>(<span class="keywordtype">string</span> access_token)</div>
|
|
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  {</div>
|
|
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  _access_token = move(access_token);</div>
|
|
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  }</div>
|
|
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  </div>
|
|
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  uint64_t <a class="code" href="classmastodonpp_1_1Instance.html#a2f07b2e79fc7f128f26c88c2d954ecab">get_max_chars</a>();</div>
|
|
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  </div>
|
|
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html#a4aa276f156e3a770e5fd9cbf5c7c0cd5"> 118</a></span>  <span class="keywordtype">void</span> <a class="code" href="classmastodonpp_1_1Instance.html#a4aa276f156e3a770e5fd9cbf5c7c0cd5">set_proxy</a>(<span class="keyword">const</span> string_view proxy)</div>
|
|
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  {</div>
|
|
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  _proxy = proxy;</div>
|
|
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">CURLWrapper::set_proxy</a>(proxy);</div>
|
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  }</div>
|
|
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  </div>
|
|
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  [[nodiscard]]</div>
|
|
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="classmastodonpp_1_1Instance.html#a1d84ff4ba06446a41287f90c373368bf"> 132</a></span>  string_view <a class="code" href="classmastodonpp_1_1Instance.html#a1d84ff4ba06446a41287f90c373368bf">get_proxy</a>()<span class="keyword"> const</span></div>
|
|
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="keyword"> </span>{</div>
|
|
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordflow">return</span> _proxy;</div>
|
|
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  }</div>
|
|
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  </div>
|
|
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keyword">const</span> <span class="keywordtype">string</span> _hostname;</div>
|
|
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keyword">const</span> <span class="keywordtype">string</span> _baseuri;</div>
|
|
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordtype">string</span> _access_token;</div>
|
|
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  uint64_t _max_chars;</div>
|
|
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordtype">string</span> _proxy;</div>
|
|
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span> };</div>
|
|
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  </div>
|
|
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span> } <span class="comment">// namespace mastodonpp</span></div>
|
|
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  </div>
|
|
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="preprocessor">#endif // MASTODONPP_INSTANCE_HPP</span></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a1d84ff4ba06446a41287f90c373368bf"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a1d84ff4ba06446a41287f90c373368bf">mastodonpp::Instance::get_proxy</a></div><div class="ttdeci">string_view get_proxy() const</div><div class="ttdoc">Returns the proxy string that was previously set.</div><div class="ttdef"><b>Definition:</b> instance.hpp:132</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_ab59e3ce5f1d5c00110465c6f562a1574"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#ab59e3ce5f1d5c00110465c6f562a1574">mastodonpp::Instance::get_access_token</a></div><div class="ttdeci">string_view get_access_token() const</div><div class="ttdoc">Returns the access token.</div><div class="ttdef"><b>Definition:</b> instance.hpp:87</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> answer.cpp:22</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a2f07b2e79fc7f128f26c88c2d954ecab"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a2f07b2e79fc7f128f26c88c2d954ecab">mastodonpp::Instance::get_max_chars</a></div><div class="ttdeci">uint64_t get_max_chars()</div><div class="ttdoc">Returns the maximum number of characters per post.</div><div class="ttdef"><b>Definition:</b> instance.cpp:33</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a1e606235a69d150b59bd90c78069de22"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a1e606235a69d150b59bd90c78069de22">mastodonpp::Instance::set_access_token</a></div><div class="ttdeci">void set_access_token(string access_token)</div><div class="ttdoc">Set OAuth 2.0 Bearer Access Token.</div><div class="ttdef"><b>Definition:</b> instance.hpp:100</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a21b859e2b9b5c6f48e8d0a194a659888"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a21b859e2b9b5c6f48e8d0a194a659888">mastodonpp::Instance::Instance</a></div><div class="ttdeci">Instance(string_view hostname, string_view access_token)</div><div class="ttdoc">Construct a new Instance object.</div><div class="ttdef"><b>Definition:</b> instance.cpp:26</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a1564a42794ef7a9d170b725063ef504d"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">mastodonpp::CURLWrapper::set_proxy</a></div><div class="ttdeci">void set_proxy(string_view proxy)</div><div class="ttdoc">Set the proxy to use.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:67</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a4aa276f156e3a770e5fd9cbf5c7c0cd5"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a4aa276f156e3a770e5fd9cbf5c7c0cd5">mastodonpp::Instance::set_proxy</a></div><div class="ttdeci">void set_proxy(const string_view proxy)</div><div class="ttdoc">Set the proxy to use.</div><div class="ttdef"><b>Definition:</b> instance.hpp:118</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_aeb5e018b566f8ab1a3c50193ead6be81"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#aeb5e018b566f8ab1a3c50193ead6be81">mastodonpp::Instance::get_baseuri</a></div><div class="ttdeci">string_view get_baseuri() const</div><div class="ttdoc">Returns the base URI.</div><div class="ttdef"><b>Definition:</b> instance.hpp:76</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html"><div class="ttname"><a href="classmastodonpp_1_1Instance.html">mastodonpp::Instance</a></div><div class="ttdoc">Holds the access data of an instance.</div><div class="ttdef"><b>Definition:</b> instance.hpp:42</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html">mastodonpp::CURLWrapper</a></div><div class="ttdoc">Handles the details of network connections.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.hpp:91</div></div>
|
|
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a24518d4603779ffc5cd89c814a687724"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a24518d4603779ffc5cd89c814a687724">mastodonpp::Instance::get_hostname</a></div><div class="ttdeci">string_view get_hostname() const</div><div class="ttdoc">Returns the hostname.</div><div class="ttdef"><b>Definition:</b> instance.hpp:63</div></div>
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.16
|
|
</small></address>
|
|
</body>
|
|
</html>
|