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
|
//------------------------------------------------------------------------------
// utilities.hpp - this file is part of the gewoopi game engine
// (c) copyright 2008 Thomas Geymayer <tomgey@gmail.com>
// For conditions of distribution and use, see copyright notice in gewoopi.hpp
//------------------------------------------------------------------------------
/*!
* @file
* @brief
* @details
* @author Thomas Geymayer <tomgey@gmail.com>
* @date Date of Creation: 03.05.2009
*/
#ifndef GEWOOPI_UTILITIES_HPP_
#define GEWOOPI_UTILITIES_HPP_
#include <boost/lexical_cast.hpp>
#include "../core/std.hpp"
#ifdef _DEBUG_
# define THROW_CHECK_DEBUG( condition, exception ) \
{ if( condition ) throw exception; }
#else
# define THROW_CHECK_DEBUG( condition, exception ) {}
#endif
namespace gewoopi
{
namespace utilities
{
template<typename T> inline T setNewReturnOld( T& var, T new_val )
{
T old( var );
var = new_val;
return old;
}
template<typename T> core::string toStr( T val )
{
return boost::lexical_cast<core::string>(val);
}
core::string toStr( float val, unsigned int prec = 1 );
void sleep( double seconds );
} // namespace utilities
} // namespace gewoopi
#endif /* GEWOOPI_UTILITIES_HPP_ */
|