-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassSDL2pp_1_1Exception.html
235 lines (222 loc) · 14.5 KB
/
classSDL2pp_1_1Exception.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!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" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libSDL2pp: SDL2pp::Exception Class 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 id="projectrow">
<td id="projectalign">
<div id="projectname">libSDL2pp
</div>
<div id="projectbrief">C++ bindings/wrapper for SDL2</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>SDL2pp</b></li><li class="navelem"><a class="el" href="classSDL2pp_1_1Exception.html">Exception</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classSDL2pp_1_1Exception-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">SDL2pp::Exception Class Reference<div class="ingroups"><a class="el" href="group__general.html">General</a></div></div></div>
</div><!--header-->
<div class="contents">
<p>Exception object representing SDL2 error
<a href="classSDL2pp_1_1Exception.html#details">More...</a></p>
<p><code>#include <<a class="el" href="Exception_8hh_source.html">SDL2pp/Exception.hh</a>></code></p>
<div class="dynheader">
Inheritance diagram for SDL2pp::Exception:</div>
<div class="dyncontent">
<div class="center"><img src="classSDL2pp_1_1Exception__inherit__graph.png" border="0" usemap="#aSDL2pp_1_1Exception_inherit__map" alt="Inheritance graph"/></div>
<map name="aSDL2pp_1_1Exception_inherit__map" id="aSDL2pp_1_1Exception_inherit__map">
<area shape="rect" title="Exception object representing SDL2 error" alt="" coords="5,79,148,104"/>
<area shape="rect" title=" " alt="" coords="7,5,146,31"/>
<area shape="poly" title=" " alt="" coords="79,44,79,79,74,79,74,44"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for SDL2pp::Exception:</div>
<div class="dyncontent">
<div class="center"><img src="classSDL2pp_1_1Exception__coll__graph.png" border="0" usemap="#aSDL2pp_1_1Exception_coll__map" alt="Collaboration graph"/></div>
<map name="aSDL2pp_1_1Exception_coll__map" id="aSDL2pp_1_1Exception_coll__map">
<area shape="rect" title="Exception object representing SDL2 error" alt="" coords="5,79,148,104"/>
<area shape="rect" title=" " alt="" coords="7,5,146,31"/>
<area shape="poly" title=" " alt="" coords="79,44,79,79,74,79,74,44"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a54d05ff4e990a4bcaa330d4318803a1b" id="r_a54d05ff4e990a4bcaa330d4318803a1b"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classSDL2pp_1_1Exception.html#a54d05ff4e990a4bcaa330d4318803a1b">Exception</a> (const char *function)</td></tr>
<tr class="memdesc:a54d05ff4e990a4bcaa330d4318803a1b"><td class="mdescLeft"> </td><td class="mdescRight">Construct exception, storing result of SDL_GetError() <br /></td></tr>
<tr class="separator:a54d05ff4e990a4bcaa330d4318803a1b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab977527bd3dc83850f3b80ededfd7900" id="r_ab977527bd3dc83850f3b80ededfd7900"><td class="memItemLeft" align="right" valign="top"><a id="ab977527bd3dc83850f3b80ededfd7900" name="ab977527bd3dc83850f3b80ededfd7900"></a>
 </td><td class="memItemRight" valign="bottom"><b>Exception</b> (const <a class="el" href="classSDL2pp_1_1Exception.html">Exception</a> &)=default</td></tr>
<tr class="memdesc:ab977527bd3dc83850f3b80ededfd7900"><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <br /></td></tr>
<tr class="separator:ab977527bd3dc83850f3b80ededfd7900"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac881d83e6878f881bb103d22b295d8f3" id="r_ac881d83e6878f881bb103d22b295d8f3"><td class="memItemLeft" align="right" valign="top"><a id="ac881d83e6878f881bb103d22b295d8f3" name="ac881d83e6878f881bb103d22b295d8f3"></a>
virtual </td><td class="memItemRight" valign="bottom"><b>~Exception</b> () noexcept</td></tr>
<tr class="memdesc:ac881d83e6878f881bb103d22b295d8f3"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:ac881d83e6878f881bb103d22b295d8f3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae28e766daae0e0148af178ee6a839960" id="r_ae28e766daae0e0148af178ee6a839960"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classSDL2pp_1_1Exception.html#ae28e766daae0e0148af178ee6a839960">GetSDLFunction</a> () const</td></tr>
<tr class="memdesc:ae28e766daae0e0148af178ee6a839960"><td class="mdescLeft"> </td><td class="mdescRight">Get name of <a class="el" href="classSDL2pp_1_1SDL.html" title="Helper class taking care of SDL library initialization and deinitialization.">SDL</a> function which caused an error. <br /></td></tr>
<tr class="separator:ae28e766daae0e0148af178ee6a839960"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8ad029073a14070484394a8194ccdb95" id="r_a8ad029073a14070484394a8194ccdb95"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classSDL2pp_1_1Exception.html#a8ad029073a14070484394a8194ccdb95">GetSDLError</a> () const</td></tr>
<tr class="memdesc:a8ad029073a14070484394a8194ccdb95"><td class="mdescLeft"> </td><td class="mdescRight">Get SDL2 error text. <br /></td></tr>
<tr class="separator:a8ad029073a14070484394a8194ccdb95"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Exception object representing SDL2 error </p>
<p>Internally, libSDL2pp checks return value of each SDL2 function it calls which may fail. If the function fails, <a class="el" href="classSDL2pp_1_1Exception.html" title="Exception object representing SDL2 error">SDL2pp::Exception</a> is thrown, and SDL2 error which explains cause of function failure is stored in the exception and may be extracted later.</p>
<p>what() usually contains a name of SDL2 function which failed, e.g. "SDL_Init() failed"</p>
<p>Note: this <a class="el" href="classSDL2pp_1_1Exception.html" title="Exception object representing SDL2 error">Exception</a> object is used to report errors from SDL2 satellite libraries (SDL_image, SDL_mixer, SDL_ttf) as well. Though they use their own error handling functions (IMG_GetError, Mix_GetError, TTF_GetError), those are (currently) just macros pointing to SDL_GetError. We currently rely on that. If that changes, we'll need a hierarchy of specific exceptions.</p>
<p>Usage example: </p><div class="fragment"><div class="line">{</div>
<div class="line"> <span class="keywordflow">try</span> {</div>
<div class="line"> <a class="code hl_class" href="classSDL2pp_1_1SDL.html">SDL2pp::SDL</a> sdl(SDL_INIT_VIDEO);</div>
<div class="line"> } <span class="keywordflow">catch</span> (<a class="code hl_class" href="classSDL2pp_1_1Exception.html">SDL2pp::Exception</a>& e) {</div>
<div class="line"> std::cerr << <span class="stringliteral">"Fatal error:"</span></div>
<div class="line"> << e.what() <span class="comment">// "SDL_Init failed"</span></div>
<div class="line"> << <span class="stringliteral">", SDL error: "</span></div>
<div class="line"> << e.<a class="code hl_function" href="classSDL2pp_1_1Exception.html#a8ad029073a14070484394a8194ccdb95">GetSDLError</a>() <span class="comment">// "x11 not available"</span></div>
<div class="line"> << std::endl;</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="ttc" id="aclassSDL2pp_1_1Exception_html"><div class="ttname"><a href="classSDL2pp_1_1Exception.html">SDL2pp::Exception</a></div><div class="ttdoc">Exception object representing SDL2 error</div><div class="ttdef"><b>Definition</b> Exception.hh:71</div></div>
<div class="ttc" id="aclassSDL2pp_1_1Exception_html_a8ad029073a14070484394a8194ccdb95"><div class="ttname"><a href="classSDL2pp_1_1Exception.html#a8ad029073a14070484394a8194ccdb95">SDL2pp::Exception::GetSDLError</a></div><div class="ttdeci">std::string GetSDLError() const</div><div class="ttdoc">Get SDL2 error text.</div><div class="ttdef"><b>Definition</b> Exception.cc:48</div></div>
<div class="ttc" id="aclassSDL2pp_1_1SDL_html"><div class="ttname"><a href="classSDL2pp_1_1SDL.html">SDL2pp::SDL</a></div><div class="ttdoc">Helper class taking care of SDL library initialization and deinitialization.</div><div class="ttdef"><b>Definition</b> SDL.hh:59</div></div>
</div><!-- fragment --> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="a54d05ff4e990a4bcaa330d4318803a1b" name="a54d05ff4e990a4bcaa330d4318803a1b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a54d05ff4e990a4bcaa330d4318803a1b">◆ </a></span>Exception()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">SDL2pp::Exception::Exception </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>function</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct exception, storing result of SDL_GetError() </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">function</td><td>Name of <a class="el" href="classSDL2pp_1_1SDL.html" title="Helper class taking care of SDL library initialization and deinitialization.">SDL</a> function which generated an error </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a8ad029073a14070484394a8194ccdb95" name="a8ad029073a14070484394a8194ccdb95"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ad029073a14070484394a8194ccdb95">◆ </a></span>GetSDLError()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string SDL2pp::Exception::GetSDLError </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get SDL2 error text. </p>
<dl class="section return"><dt>Returns</dt><dd>Stored result of SDL_GetError()</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a href="http://wiki.libsdl.org/SDL_GetError">http://wiki.libsdl.org/SDL_GetError</a> </dd></dl>
</div>
</div>
<a id="ae28e766daae0e0148af178ee6a839960" name="ae28e766daae0e0148af178ee6a839960"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae28e766daae0e0148af178ee6a839960">◆ </a></span>GetSDLFunction()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string SDL2pp::Exception::GetSDLFunction </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get name of <a class="el" href="classSDL2pp_1_1SDL.html" title="Helper class taking care of SDL library initialization and deinitialization.">SDL</a> function which caused an error. </p>
<dl class="section return"><dt>Returns</dt><dd>Name of function which caused an error </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>SDL2pp/<a class="el" href="Exception_8hh_source.html">Exception.hh</a></li>
<li>SDL2pp/<b>Exception.cc</b></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>