_hue_exception_8h_source.html 15.2 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/HueException.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">HueException.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_hue_exception_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_HUE_EXCEPTION_H</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define INCLUDE_HUEPLUSPLUS_HUE_EXCEPTION_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;exception&gt;</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &quot;json/json.hpp&quot;</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="namespacehueplusplus.html">hueplusplus</a></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;{</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structhueplusplus_1_1_file_info.html">   34</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;{</div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="structhueplusplus_1_1_file_info.html#a0e70a519d2b615963abf5cb2ff4bca4f">   37</a></span>&#160;    std::string <a class="code" href="structhueplusplus_1_1_file_info.html#a0e70a519d2b615963abf5cb2ff4bca4f">filename</a>;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="structhueplusplus_1_1_file_info.html#a0f10116b94c4038f6f0bb8c693c9026e">   39</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structhueplusplus_1_1_file_info.html#a0f10116b94c4038f6f0bb8c693c9026e">line</a> = -1;</div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="structhueplusplus_1_1_file_info.html#a1da7fcb189d66c18492c4678d452b0fd">   41</a></span>&#160;    std::string <a class="code" href="structhueplusplus_1_1_file_info.html#a1da7fcb189d66c18492c4678d452b0fd">func</a>;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    std::string <a class="code" href="structhueplusplus_1_1_file_info.html#a5a3d1e5f060dd5df626003504813f116">ToString</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;};</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_hue_exception.html">   49</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhueplusplus_1_1_hue_exception.html">HueException</a> : <span class="keyword">public</span> std::exception</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;{</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <a class="code" href="classhueplusplus_1_1_hue_exception.html">HueException</a>(<a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo, <span class="keyword">const</span> std::string&amp; message);</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* what() <span class="keyword">const</span> noexcept <span class="keyword">override</span>;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keyword">const</span> <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a>&amp; GetFile() <span class="keyword">const</span> noexcept;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <a class="code" href="classhueplusplus_1_1_hue_exception.html">HueException</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* exceptionName, <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo, <span class="keyword">const</span> std::string&amp; message);</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    std::string whatMessage;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;};</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_hue_a_p_i_response_exception.html">   83</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhueplusplus_1_1_hue_a_p_i_response_exception.html">HueAPIResponseException</a> : <span class="keyword">public</span> <a class="code" href="classhueplusplus_1_1_hue_exception.html">HueException</a></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;{</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <a class="code" href="classhueplusplus_1_1_hue_a_p_i_response_exception.html">HueAPIResponseException</a>(<a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo, <span class="keywordtype">int</span> error, std::string address, std::string description);</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordtype">int</span> GetErrorNumber() <span class="keyword">const</span> noexcept;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keyword">const</span> std::string&amp; GetAddress() <span class="keyword">const</span> noexcept;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keyword">const</span> std::string&amp; GetDescription() <span class="keyword">const</span> noexcept;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keyword">static</span> <a class="code" href="classhueplusplus_1_1_hue_a_p_i_response_exception.html">HueAPIResponseException</a> Create(<a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo, <span class="keyword">const</span> nlohmann::json&amp; response);</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keyword">static</span> std::string GetMessage(<span class="keywordtype">int</span> error, <span class="keyword">const</span> std::string&amp; addr, <span class="keyword">const</span> std::string&amp; description);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="keywordtype">int</span> error;</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    std::string address;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    std::string description;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;};</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;} <span class="comment">// namespace hueplusplus</span></div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="classhueplusplus_1_1_hue_exception_html"><div class="ttname"><a href="classhueplusplus_1_1_hue_exception.html">hueplusplus::HueException</a></div><div class="ttdoc">Exception class with file information. Base class of all custom exception classes. </div><div class="ttdef"><b>Definition:</b> HueException.h:49</div></div>
<div class="ttc" id="structhueplusplus_1_1_file_info_html_a1da7fcb189d66c18492c4678d452b0fd"><div class="ttname"><a href="structhueplusplus_1_1_file_info.html#a1da7fcb189d66c18492c4678d452b0fd">hueplusplus::FileInfo::func</a></div><div class="ttdeci">std::string func</div><div class="ttdoc">Current function from func. Empty if unknown. </div><div class="ttdef"><b>Definition:</b> HueException.h:41</div></div>
<div class="ttc" id="structhueplusplus_1_1_file_info_html_a5a3d1e5f060dd5df626003504813f116"><div class="ttname"><a href="structhueplusplus_1_1_file_info.html#a5a3d1e5f060dd5df626003504813f116">hueplusplus::FileInfo::ToString</a></div><div class="ttdeci">std::string ToString() const</div><div class="ttdoc">String representation of func, file and line. </div><div class="ttdef"><b>Definition:</b> HueException.cpp:104</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="structhueplusplus_1_1_file_info_html_a0e70a519d2b615963abf5cb2ff4bca4f"><div class="ttname"><a href="structhueplusplus_1_1_file_info.html#a0e70a519d2b615963abf5cb2ff4bca4f">hueplusplus::FileInfo::filename</a></div><div class="ttdeci">std::string filename</div><div class="ttdoc">Current file name from FILE. Empty if unknown. </div><div class="ttdef"><b>Definition:</b> HueException.h:37</div></div>
<div class="ttc" id="structhueplusplus_1_1_file_info_html"><div class="ttname"><a href="structhueplusplus_1_1_file_info.html">hueplusplus::FileInfo</a></div><div class="ttdoc">Contains information about error location, use CURRENT_FILE_INFO to create. </div><div class="ttdef"><b>Definition:</b> HueException.h:34</div></div>
<div class="ttc" id="structhueplusplus_1_1_file_info_html_a0f10116b94c4038f6f0bb8c693c9026e"><div class="ttname"><a href="structhueplusplus_1_1_file_info.html#a0f10116b94c4038f6f0bb8c693c9026e">hueplusplus::FileInfo::line</a></div><div class="ttdeci">int line</div><div class="ttdoc">Current line number from LINE. -1 if unknown. </div><div class="ttdef"><b>Definition:</b> HueException.h:39</div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_a_p_i_response_exception_html"><div class="ttname"><a href="classhueplusplus_1_1_hue_a_p_i_response_exception.html">hueplusplus::HueAPIResponseException</a></div><div class="ttdoc">Exception caused by a Hue API &quot;error&quot; response with additional information. </div><div class="ttdef"><b>Definition:</b> HueException.h:83</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>