_base_http_handler_8h_source.html 20.4 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>hueplusplus: include/hueplusplus/BaseHttpHandler.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="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">hueplusplus
   &#160;<span id="projectnumber">1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</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><li class="navelem"><a class="el" href="dir_e05b4b7707bd5f9fd045e8be02b17d0a.html">hueplusplus</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">BaseHttpHandler.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_base_http_handler_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#ifndef INCLUDE_HUEPLUSPLUS_BASE_HTTP_HANDLER_H</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define INCLUDE_HUEPLUSPLUS_BASE_HTTP_HANDLER_H</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;string&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="preprocessor">#include &quot;<a class="code" href="_i_http_handler_8h.html">IHttpHandler.h</a>&quot;</span></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;<span class="preprocessor">#include &quot;json/json.hpp&quot;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehueplusplus.html">hueplusplus</a></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;{</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_base_http_handler.html">   38</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhueplusplus_1_1_base_http_handler.html">BaseHttpHandler</a> : <span class="keyword">public</span> <a class="code" href="classhueplusplus_1_1_i_http_handler.html">IHttpHandler</a></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;{</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a0e1250a1537f7e7f05cab75af4b9c82f">~BaseHttpHandler</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    std::string <a class="code" href="classhueplusplus_1_1_base_http_handler.html#ad5f51b25770345641c871f6efbc579aa">sendGetHTTPBody</a>(<span class="keyword">const</span> std::string&amp; msg, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    std::string <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a8a10fabfc57e4c60612bc279fae25050">sendHTTPRequest</a>(<span class="keyword">const</span> std::string&amp; method, <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType,</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        <span class="keyword">const</span> std::string&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    std::string <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a601f2e4dfec195a094e30c2f22263cf9">GETString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    std::string <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a896da865ceb520bd9797948395fa203d">POSTString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    std::string <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a72f4a78eea5c4b1c8f23b074ee3648bf">PUTString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    std::string <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a139cbb13a19d3f12b8242bbe7e18b850">DELETEString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    nlohmann::json <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a059678ec7136be20fc5e8ca242929fe9">GETJson</a>(</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    nlohmann::json <a class="code" href="classhueplusplus_1_1_base_http_handler.html#ad43b42bf599a59fdd89a4195ec891a02">POSTJson</a>(</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    nlohmann::json <a class="code" href="classhueplusplus_1_1_base_http_handler.html#a602b5ea73d5788e2bb79a654906e5de0">PUTJson</a>(</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    nlohmann::json <a class="code" href="classhueplusplus_1_1_base_http_handler.html#abf5e5d6c49851f3a10c6b6378b835226">DELETEJson</a>(</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const override</span>;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;};</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;} <span class="comment">// namespace hueplusplus</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;<span class="preprocessor">#endif</span></div><div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a139cbb13a19d3f12b8242bbe7e18b850"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a139cbb13a19d3f12b8242bbe7e18b850">hueplusplus::BaseHttpHandler::DELETEString</a></div><div class="ttdeci">std::string DELETEString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP DELETE request to the specified host and return the body of the response. </div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:97</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a0e1250a1537f7e7f05cab75af4b9c82f"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a0e1250a1537f7e7f05cab75af4b9c82f">hueplusplus::BaseHttpHandler::~BaseHttpHandler</a></div><div class="ttdeci">virtual ~BaseHttpHandler()=default</div><div class="ttdoc">Virtual dtor. </div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a896da865ceb520bd9797948395fa203d"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a896da865ceb520bd9797948395fa203d">hueplusplus::BaseHttpHandler::POSTString</a></div><div class="ttdeci">std::string POSTString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP POST request to the specified host and return the body of the response. </div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:85</div></div>
<div class="ttc" id="namespacehueplusplus_html"><div class="ttname"><a href="namespacehueplusplus.html">hueplusplus</a></div><div class="ttdoc">Namespace for the hueplusplus library. </div><div class="ttdef"><b>Definition:</b> Action.h:27</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_ad43b42bf599a59fdd89a4195ec891a02"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#ad43b42bf599a59fdd89a4195ec891a02">hueplusplus::BaseHttpHandler::POSTJson</a></div><div class="ttdeci">nlohmann::json POSTJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP POST request to the specified host and return the body of the response parsed as JSON...</div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:109</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html">hueplusplus::IHttpHandler</a></div><div class="ttdoc">Abstract class for classes that handle http requests and multicast requests. </div><div class="ttdef"><b>Definition:</b> IHttpHandler.h:37</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a059678ec7136be20fc5e8ca242929fe9"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a059678ec7136be20fc5e8ca242929fe9">hueplusplus::BaseHttpHandler::GETJson</a></div><div class="ttdeci">nlohmann::json GETJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP GET request to the specified host and return the body of the response parsed as JSON...</div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:103</div></div>
<div class="ttc" id="_i_http_handler_8h_html"><div class="ttname"><a href="_i_http_handler_8h.html">IHttpHandler.h</a></div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a601f2e4dfec195a094e30c2f22263cf9"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a601f2e4dfec195a094e30c2f22263cf9">hueplusplus::BaseHttpHandler::GETString</a></div><div class="ttdeci">std::string GETString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP GET request to the specified host and return the body of the response. </div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:79</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a602b5ea73d5788e2bb79a654906e5de0"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a602b5ea73d5788e2bb79a654906e5de0">hueplusplus::BaseHttpHandler::PUTJson</a></div><div class="ttdeci">nlohmann::json PUTJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP PUT request to the specified host and return the body of the response parsed as JSON...</div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:115</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a8a10fabfc57e4c60612bc279fae25050"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a8a10fabfc57e4c60612bc279fae25050">hueplusplus::BaseHttpHandler::sendHTTPRequest</a></div><div class="ttdeci">std::string sendHTTPRequest(const std::string &amp;method, const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP request with the given method to the specified host and return the body of the response...</div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:46</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_ad5f51b25770345641c871f6efbc579aa"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#ad5f51b25770345641c871f6efbc579aa">hueplusplus::BaseHttpHandler::sendGetHTTPBody</a></div><div class="ttdeci">std::string sendGetHTTPBody(const std::string &amp;msg, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a message to a specified host and return the body of the response. </div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:29</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_abf5e5d6c49851f3a10c6b6378b835226"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#abf5e5d6c49851f3a10c6b6378b835226">hueplusplus::BaseHttpHandler::DELETEJson</a></div><div class="ttdeci">nlohmann::json DELETEJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP DELETE request to the specified host and return the body of the response parsed as JSON...</div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:121</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html_a72f4a78eea5c4b1c8f23b074ee3648bf"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html#a72f4a78eea5c4b1c8f23b074ee3648bf">hueplusplus::BaseHttpHandler::PUTString</a></div><div class="ttdeci">std::string PUTString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const override</div><div class="ttdoc">Send a HTTP PUT request to the specified host and return the body of the response. </div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.cpp:91</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_http_handler_html"><div class="ttname"><a href="classhueplusplus_1_1_base_http_handler.html">hueplusplus::BaseHttpHandler</a></div><div class="ttdoc">Base class for classes that handle http requests and multicast requests. </div><div class="ttdef"><b>Definition:</b> BaseHttpHandler.h:38</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- 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.13
</small></address>
</body>
</html>