diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/common_8h-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/common_8h-source.html | 481 |
1 files changed, 481 insertions, 0 deletions
diff --git a/docs/doxygen/nel/common_8h-source.html b/docs/doxygen/nel/common_8h-source.html new file mode 100644 index 00000000..95b468d9 --- /dev/null +++ b/docs/doxygen/nel/common_8h-source.html @@ -0,0 +1,481 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>common.h</h1><a href="common_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#ifndef NL_COMMON_H</font> +00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_COMMON_H</font> +00028 <font class="preprocessor"></font> +00029 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font> +00030 +00031 <font class="preprocessor">#include <ctype.h></font> +00032 <font class="preprocessor">#include <stdio.h></font> +00033 <font class="preprocessor">#include <stdarg.h></font> +00034 <font class="preprocessor">#include <stdlib.h></font> +00035 <font class="preprocessor">#include <math.h></font> +00036 <font class="preprocessor">#include <algorithm></font> +00037 <font class="preprocessor">#include <string></font> +00038 <font class="preprocessor">#include <vector></font> +00039 <font class="preprocessor">#include <sstream></font> +00040 +00041 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00042 <font class="preprocessor"></font><font class="preprocessor"># include <process.h></font> +00043 <font class="preprocessor">#else</font> +00044 <font class="preprocessor"></font><font class="preprocessor"># include <math.h></font> +00045 <font class="preprocessor"># include <<a class="code" href="unistd_8h.html">unistd.h</a>></font> +00046 <font class="preprocessor"># include <sys/types.h></font> +00047 <font class="preprocessor">#endif</font> +00048 <font class="preprocessor"></font> +00050 <font class="keyword">namespace </font>NLMISC +00051 { +00052 +00053 <font class="comment">// Windows posix function remapping</font> +00054 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00055 <font class="preprocessor"></font><font class="preprocessor">#define vsnprintf _vsnprintf</font> +00056 <font class="preprocessor"></font><font class="preprocessor">#endif // NL_OS_WINDOWS</font> +00057 <font class="preprocessor"></font> +00058 +00059 +00066 <font class="keyword">const</font> <font class="keywordtype">int</font> <a class="code" href="namespaceNLMISC.html#a6">MaxCStringSize</a> = 1024*2; +00067 +00068 +00071 <font class="keyword">const</font> <font class="keywordtype">double</font> <a class="code" href="namespaceNLMISC.html#a7">Pi</a> = 3.1415926535897932384626433832795; +00072 +00073 +<a name="l00094"></a><a class="code" href="common_8h.html#a0">00094</a> <font class="preprocessor">#define NLMISC_CONVERT_VARGS(_dest,_format,_size) \</font> +00095 <font class="preprocessor">char _cstring[_size]; \</font> +00096 <font class="preprocessor">va_list _args; \</font> +00097 <font class="preprocessor">va_start (_args, _format); \</font> +00098 <font class="preprocessor">int _res = vsnprintf (_cstring, _size-1, _format, _args); \</font> +00099 <font class="preprocessor">if (_res == -1 || _res == _size-1) \</font> +00100 <font class="preprocessor">{ \</font> +00101 <font class="preprocessor"> _cstring[_size-1] = '\0'; \</font> +00102 <font class="preprocessor">} \</font> +00103 <font class="preprocessor">va_end (_args); \</font> +00104 <font class="preprocessor">_dest = _cstring</font> +00105 <font class="preprocessor"></font> +00106 +00107 +00115 sint <a class="code" href="namespaceNLMISC.html#a211">smprintf</a>( <font class="keywordtype">char</font> *buffer, size_t count, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ... ); +00116 +00117 +00120 <font class="keyword">inline</font> <font class="keywordtype">float</font> <a class="code" href="namespaceNLMISC.html#a212">frand</a>(<font class="keywordtype">float</font> mod) +00121 { +00122 <font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> = (double) rand(); +00123 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>/= (double) RAND_MAX; +00124 <font class="keywordflow">return</font> (float)(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> * mod); +00125 } +00126 +00127 +00130 <font class="keyword">inline</font> sint <a class="code" href="namespaceNLMISC.html#a213">fsgn</a>(<font class="keywordtype">double</font> f) +00131 { +00132 <font class="keywordflow">if</font>(f<0) +00133 <font class="keywordflow">return</font> -1; +00134 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(f>0) +00135 <font class="keywordflow">return</font> 1; +00136 <font class="keywordflow">else</font> +00137 <font class="keywordflow">return</font> 0; +00138 } +00139 +00140 +00143 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a214">sqr</a>(<font class="keyword">const</font> T &<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>) +00144 { +00145 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> * <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>; +00146 } +00147 +00148 +00151 <font class="keyword">template</font><<font class="keyword">class</font> T, <font class="keyword">class</font> U, <font class="keyword">class</font> V> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(T &<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keyword">const</font> U &<a class="code" href="bit__set_8cpp.html#a0">min</a>, <font class="keyword">const</font> V &max) +00152 { +00153 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = (<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> < <a class="code" href="bit__set_8cpp.html#a0">min</a>) ? <a class="code" href="bit__set_8cpp.html#a0">min</a> : <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>; +00154 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = (<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> > max) ? max : <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>; +00155 } +00156 +00157 +00160 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a216">minof</a>(<font class="keyword">const</font> T& a, <font class="keyword">const</font> T& b, <font class="keyword">const</font> T& c) +00161 {<font class="keywordflow">return</font> <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(std::min(a,b),c);} +00162 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a216">minof</a>(<font class="keyword">const</font> T& a, <font class="keyword">const</font> T& b, <font class="keyword">const</font> T& c, <font class="keyword">const</font> T& d) +00163 {<font class="keywordflow">return</font> <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(<a class="code" href="namespaceNLMISC.html#a216">minof</a>(a,b,c),d);} +00164 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a216">minof</a>(<font class="keyword">const</font> T& a, <font class="keyword">const</font> T& b, <font class="keyword">const</font> T& c, <font class="keyword">const</font> T& d, <font class="keyword">const</font> T& e) +00165 {<font class="keywordflow">return</font> <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(<a class="code" href="namespaceNLMISC.html#a216">minof</a>(a,b,c,d),e);} +00166 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a219">maxof</a>(<font class="keyword">const</font> T& a, <font class="keyword">const</font> T& b, <font class="keyword">const</font> T& c) +00167 {<font class="keywordflow">return</font> std::max(std::max(a,b),c);} +00168 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a219">maxof</a>(<font class="keyword">const</font> T& a, <font class="keyword">const</font> T& b, <font class="keyword">const</font> T& c, <font class="keyword">const</font> T& d) +00169 {<font class="keywordflow">return</font> std::max(<a class="code" href="namespaceNLMISC.html#a219">maxof</a>(a,b,c),d);} +00170 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> T <a class="code" href="namespaceNLMISC.html#a219">maxof</a>(<font class="keyword">const</font> T& a, <font class="keyword">const</font> T& b, <font class="keyword">const</font> T& c, <font class="keyword">const</font> T& d, <font class="keyword">const</font> T& e) +00171 {<font class="keywordflow">return</font> std::max(<a class="code" href="namespaceNLMISC.html#a219">maxof</a>(a,b,c,d),e);} +00172 +00177 <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a222">contReset</a> (T& a) +00178 { +00179 a.~T(); +00180 <font class="preprocessor">#undef new</font> +00181 <font class="preprocessor"></font> <font class="keyword">new</font> (&a) T; +00182 <font class="preprocessor">#define new NL_NEW</font> +00183 <font class="preprocessor"></font>} +00184 +00190 uint <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (uint <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00191 +00197 uint <a class="code" href="namespaceNLMISC.html#a224">getPowerOf2</a> (uint <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00198 +00201 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLMISC.html#a225">isPowerOf2</a> (sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00202 +00203 +00206 <font class="keyword">inline</font> <font class="keywordtype">float</font> <a class="code" href="namespaceNLMISC.html#a226">degToRad</a>( <font class="keywordtype">float</font> deg ) +00207 { +00208 <font class="keywordflow">return</font> deg * (float)<a class="code" href="namespaceNLMISC.html#a7">Pi</a> / 180.0f; +00209 } +00210 +00211 +00214 <font class="keyword">inline</font> <font class="keywordtype">float</font> <a class="code" href="namespaceNLMISC.html#a227">radToDeg</a>( <font class="keywordtype">float</font> rad ) +00215 { +00216 <font class="keywordflow">return</font> rad * 180.0f / (float)<a class="code" href="namespaceNLMISC.html#a7">Pi</a>; +00217 } +00218 +00219 +00222 <font class="keyword">inline</font> <font class="keywordtype">double</font> <a class="code" href="namespaceNLMISC.html#a228">isValidDouble</a> (<font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>) +00223 { +00224 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00225 <font class="preprocessor"></font> <font class="keywordflow">return</font> _finite(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>) && !_isnan(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00226 <font class="preprocessor">#else</font> +00227 <font class="preprocessor"></font> <font class="keywordflow">return</font> !isnan(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>) && !isinf(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00228 <font class="preprocessor">#endif</font> +00229 <font class="preprocessor"></font>} +00230 +00231 +00235 std::string &<a class="code" href="namespaceNLMISC.html#a229">strlwr</a> ( std::string &str ); +00236 std::string <a class="code" href="namespaceNLMISC.html#a229">strlwr</a> ( <font class="keyword">const</font> std::string &str ); +00237 +00241 <font class="keywordtype">char</font> *<a class="code" href="namespaceNLMISC.html#a229">strlwr</a> ( <font class="keywordtype">char</font> *str ); +00242 +00246 std::string &<a class="code" href="namespaceNLMISC.html#a232">strupr</a> ( std::string &str ); +00247 +00251 <font class="keywordtype">char</font> *<a class="code" href="namespaceNLMISC.html#a232">strupr</a> ( <font class="keywordtype">char</font> *str ); +00252 +00256 sint <a class="code" href="namespaceNLMISC.html#a234">nlstricmp</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *lhs, <font class="keyword">const</font> <font class="keywordtype">char</font> *rhs); +00257 +00260 sint <a class="code" href="namespaceNLMISC.html#a234">nlstricmp</a>(<font class="keyword">const</font> std::string &lhs, <font class="keyword">const</font> std::string &rhs); +00261 +00262 +00263 +<a name="l00268"></a><a class="code" href="classNLMISC_1_1Exception.html">00268</a> <font class="keyword">class </font>Exception : <font class="keyword">public</font> std::exception +00269 { +00270 <font class="keyword">protected</font>: +<a name="l00271"></a><a class="code" href="classNLMISC_1_1Exception.html#n0">00271</a> std::string <a class="code" href="classNLMISC_1_1Exception.html#n0">_Reason</a>; +00272 <font class="keyword">public</font>: +00273 <a class="code" href="classNLMISC_1_1Exception.html#a0">Exception</a>(); +00274 <a class="code" href="classNLMISC_1_1Exception.html#a0">Exception</a>(<font class="keyword">const</font> std::string &reason); +00275 <a class="code" href="classNLMISC_1_1Exception.html#a0">Exception</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ...); +<a name="l00276"></a><a class="code" href="classNLMISC_1_1Exception.html#a3">00276</a> <font class="keyword">virtual</font> <a class="code" href="classNLMISC_1_1Exception.html#a3">~Exception</a>() <font class="keywordflow">throw</font>() {}; +00277 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="classNLMISC_1_1Exception.html#a4">what</a>() <font class="keyword">const</font> <font class="keywordflow">throw</font>(); +00278 }; +00279 +00280 +00285 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a>( uint32 ms ); +00286 +00287 +00289 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00290 <font class="preprocessor"></font><font class="preprocessor"># define getpid _getpid</font> +00291 <font class="preprocessor"></font><font class="preprocessor">#endif</font> +00292 <font class="preprocessor"></font> +00294 uint <a class="code" href="namespaceNLMISC.html#a237">getThreadId</a>(); +00295 +00297 std::string <a class="code" href="namespaceNLMISC.html#a238">stringFromVector</a>( <font class="keyword">const</font> std::vector<uint8>& <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keywordtype">bool</font> limited = <font class="keyword">true</font> ); +00298 +00299 +00301 sint64 <a class="code" href="namespaceNLMISC.html#a239">atoiInt64</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *ident, sint64 base = 10); +00302 +00304 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a240">itoaInt64</a> (sint64 number, <font class="keywordtype">char</font> *str, sint64 base = 10); +00305 +00306 +00308 std::string <a class="code" href="namespaceNLMISC.html#a241">bytesToHumanReadable</a> (uint32 bytes); +00309 +00310 +00313 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLMISC.html#a242">launchProgram</a> (<font class="keyword">const</font> std::string &programName, <font class="keyword">const</font> std::string &arguments); +00314 +00315 +00316 +00317 +00318 +00323 <font class="keyword">template</font><<font class="keyword">class</font> T> std::string <a class="code" href="namespaceNLMISC.html#a243">toString</a> (<font class="keyword">const</font> T &<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>) +00324 { +00325 std::stringstream ss; +00326 ss << <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>; +00327 <font class="keywordflow">return</font> ss.str(); +00328 } +00329 +00330 +00335 <font class="keyword">inline</font> std::string <a class="code" href="namespaceNLMISC.html#a243">toString</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ...) +00336 { +00337 std::string Result; +00338 <a class="code" href="common_8h.html#a0">NLMISC_CONVERT_VARGS</a> (Result, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, NLMISC::MaxCStringSize); +00339 <font class="keywordflow">return</font> Result; +00340 } +00341 +00342 +00343 <font class="comment">/* All the code above is used to add our types (uint8, ...) in the stringstream (used by the toString() function).</font> +00344 <font class="comment"> * So we can use stringstream operator << and >> with all NeL simple types (except for ucchar and ucstring)</font> +00345 <font class="comment"> */</font> +00346 +00347 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00348 <font class="preprocessor"></font> +00349 <font class="preprocessor">#if _MSC_VER < 1300 // visual or older (on visual .NET, we don't need to do that)</font> +00350 <font class="preprocessor"></font> +00351 <font class="preprocessor">#define NLMISC_ADD_BASIC_ISTREAM_OPERATOR(__type,__casttype) \</font> +00352 <font class="preprocessor">template <class _CharT, class _Traits> \</font> +00353 <font class="preprocessor">std::basic_istream<_CharT, _Traits>& __cdecl \</font> +00354 <font class="preprocessor">operator>>(std::basic_istream<_CharT, _Traits>& __is, __type& __z) \</font> +00355 <font class="preprocessor">{ \</font> +00356 <font class="preprocessor"> __casttype __z2 = (__casttype) __z; \</font> +00357 <font class="preprocessor"> __is.operator>>(__z2); \</font> +00358 <font class="preprocessor"> __z = (__type) __z2; \</font> +00359 <font class="preprocessor"> return __is; \</font> +00360 <font class="preprocessor">} \</font> +00361 <font class="preprocessor"> \</font> +00362 <font class="preprocessor">template <class _CharT, class _Traits> \</font> +00363 <font class="preprocessor">std::basic_ostream<_CharT, _Traits>& __cdecl \</font> +00364 <font class="preprocessor">operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __type& __z) \</font> +00365 <font class="preprocessor">{ \</font> +00366 <font class="preprocessor"> std::basic_ostringstream<_CharT, _Traits, std::allocator<_CharT> > __tmp; \</font> +00367 <font class="preprocessor"> __tmp << (__casttype) __z; \</font> +00368 <font class="preprocessor"> return __os << __tmp.str(); \</font> +00369 <font class="preprocessor">}</font> +00370 <font class="preprocessor"></font> +00371 NLMISC_ADD_BASIC_ISTREAM_OPERATOR(uint8, <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>); +00372 NLMISC_ADD_BASIC_ISTREAM_OPERATOR(sint8, <font class="keywordtype">signed</font> <font class="keywordtype">int</font>); +00373 NLMISC_ADD_BASIC_ISTREAM_OPERATOR(uint16, <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>); +00374 NLMISC_ADD_BASIC_ISTREAM_OPERATOR(sint16, <font class="keywordtype">signed</font> <font class="keywordtype">int</font>); +00375 NLMISC_ADD_BASIC_ISTREAM_OPERATOR(uint32, <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>); +00376 NLMISC_ADD_BASIC_ISTREAM_OPERATOR(sint32, <font class="keywordtype">signed</font> <font class="keywordtype">int</font>); +00377 +00378 <font class="preprocessor">#endif // _MSC_VER < 1300</font> +00379 <font class="preprocessor"></font> +00380 +00381 <font class="keyword">template</font> <<font class="keyword">class</font> _CharT, <font class="keyword">class</font> _Traits> +00382 std::basic_istream<_CharT, _Traits>& __cdecl +00383 operator>>(std::basic_istream<_CharT, _Traits>& __is, uint64& __z) +00384 { +00385 __z = 0; +00386 <font class="keywordtype">bool</font> neg = <font class="keyword">false</font>; +00387 <font class="keywordtype">char</font> c; +00388 <font class="keywordflow">do</font> +00389 { +00390 __is >> c; +00391 } +00392 <font class="keywordflow">while</font> (isspace(c)); +00393 +00394 <font class="keywordflow">if</font> (c == <font class="charliteral">'-'</font>) +00395 { +00396 neg = <font class="keyword">true</font>; +00397 __is >> c; +00398 } +00399 +00400 <font class="keywordflow">while</font> (isdigit(c)) +00401 { +00402 __z *= 10; +00403 __z += c-<font class="charliteral">'0'</font>; +00404 __is >> c; +00405 <font class="keywordflow">if</font> (__is.fail()) +00406 <font class="keywordflow">break</font>; +00407 } +00408 +00409 <font class="keywordflow">if</font> (neg) __z = 0; +00410 +00411 <font class="keywordflow">return</font> __is; +00412 } +00413 +00414 <font class="keyword">template</font> <<font class="keyword">class</font> _CharT, <font class="keyword">class</font> _Traits> +00415 std::basic_ostream<_CharT, _Traits>& __cdecl +00416 operator<<(std::basic_ostream<_CharT, _Traits>& __os, <font class="keyword">const</font> uint64& __z) +00417 { +00418 std::basic_ostringstream<_CharT, _Traits, std::allocator<_CharT> > __res; +00419 +00420 <font class="keywordflow">if</font> (__z == 0) +00421 { +00422 __res << <font class="charliteral">'0'</font>; +00423 } +00424 <font class="keywordflow">else</font> +00425 { +00426 std::basic_ostringstream<_CharT, _Traits, std::allocator<_CharT> > __tmp; +00427 uint64 __z2 = __z; +00428 <font class="keywordflow">while</font> (__z2 != 0) +00429 { +00430 __tmp << (char)((__z2%10)+<font class="charliteral">'0'</font>); +00431 __z2 /= 10; +00432 } +00433 +00434 uint __s = __tmp.str().size(); +00435 <font class="keywordflow">for</font> (uint i = 0; i < __s; i++) +00436 __res << __tmp.str()[__s - 1 - i]; +00437 } +00438 <font class="keywordflow">return</font> __os << __res.str(); +00439 } +00440 +00441 <font class="keyword">template</font> <<font class="keyword">class</font> _CharT, <font class="keyword">class</font> _Traits> +00442 std::basic_istream<_CharT, _Traits>& __cdecl +00443 operator>>(std::basic_istream<_CharT, _Traits>& __is, sint64& __z) +00444 { +00445 __z = 0; +00446 <font class="keywordtype">bool</font> neg = <font class="keyword">false</font>; +00447 <font class="keywordtype">char</font> c; +00448 <font class="keywordflow">do</font> +00449 { +00450 __is >> c; +00451 } +00452 <font class="keywordflow">while</font> (isspace(c)); +00453 +00454 <font class="keywordflow">if</font> (c == <font class="charliteral">'-'</font>) +00455 { +00456 neg = <font class="keyword">true</font>; +00457 __is >> c; +00458 } +00459 +00460 <font class="keywordflow">while</font> (isdigit(c)) +00461 { +00462 __z *= 10; +00463 __z += c-<font class="charliteral">'0'</font>; +00464 __is >> c; +00465 <font class="keywordflow">if</font> (__is.fail()) +00466 <font class="keywordflow">break</font>; +00467 } +00468 +00469 <font class="keywordflow">if</font> (neg) __z = -__z; +00470 +00471 <font class="keywordflow">return</font> __is; +00472 } +00473 +00474 <font class="keyword">template</font> <<font class="keyword">class</font> _CharT, <font class="keyword">class</font> _Traits> +00475 std::basic_ostream<_CharT, _Traits>& __cdecl +00476 operator<<(std::basic_ostream<_CharT, _Traits>& __os, <font class="keyword">const</font> sint64& __z) +00477 { +00478 std::basic_ostringstream<_CharT, _Traits, std::allocator<_CharT> > __res; +00479 +00480 <font class="keywordflow">if</font> (__z == 0) +00481 { +00482 __res << <font class="charliteral">'0'</font>; +00483 } +00484 <font class="keywordflow">else</font> +00485 { +00486 sint64 __z2 = __z; +00487 +00488 <font class="keywordflow">if</font> (__z2 < 0) +00489 { +00490 __res << <font class="charliteral">'-'</font>; +00491 } +00492 +00493 std::basic_ostringstream<_CharT, _Traits, std::allocator<_CharT> > __tmp; +00494 <font class="keywordflow">while</font> (__z2 != 0) +00495 { +00496 <font class="keywordflow">if</font> (__z2 < 0) +00497 { +00498 __tmp << (char)((-(__z2%10))+<font class="charliteral">'0'</font>); +00499 } +00500 <font class="keywordflow">else</font> +00501 { +00502 __tmp << (char)((__z2%10)+<font class="charliteral">'0'</font>); +00503 } +00504 __z2 /= 10; +00505 } +00506 +00507 uint __s = __tmp.str().size(); +00508 <font class="keywordflow">for</font> (uint i = 0; i < __s; i++) +00509 __res << __tmp.str()[__s - 1 - i]; +00510 } +00511 <font class="keywordflow">return</font> __os << __res.str(); +00512 } +00513 +00514 <font class="preprocessor">#endif // NL_OS_WINDOWS</font> +00515 <font class="preprocessor"></font> +00516 +00517 +00518 +00519 } <font class="comment">// NLMISC</font> +00520 +00521 <font class="preprocessor">#endif // NL_COMMON_H</font> +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |