Crazy Eddie's GUI System 0.8.7
Base.h
1/***********************************************************************
2 created: 20/2/2004
3 author: Paul D Turner
4
5 purpose: Base include used within the system
6 This contains various lower level bits required
7 by other parts of the system. All other library
8 headers will include this file.
9*************************************************************************/
10/***************************************************************************
11 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 ***************************************************************************/
32#ifndef _CEGUIBase_h_
33#define _CEGUIBase_h_
34
35// bring in configuration options
36#include "CEGUI/Config.h"
37
38// add CEGUI version defines
39#include "CEGUI/Version.h"
40
41#include <cassert>
42#include <algorithm>
43
44/*************************************************************************
45 Dynamic Library import / export control conditional
46 (Define CEGUIBASE_EXPORTS to export symbols, else they are imported)
47*************************************************************************/
48#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
49# ifdef CEGUIBASE_EXPORTS
50# define CEGUIEXPORT __declspec(dllexport)
51# else
52# define CEGUIEXPORT __declspec(dllimport)
53# endif
54# define CEGUIPRIVATE
55#else
56# define CEGUIEXPORT
57# define CEGUIPRIVATE
58#endif
59
60
61// totally kill this warning (debug info truncated to 255 chars etc...) on <= VC6
62#if defined(_MSC_VER) && (_MSC_VER <= 1200)
63# pragma warning(disable : 4786)
64#endif
65
66
67// Detect macros for min / max and undefine (with a warning where possible)
68#if defined(max)
69# if defined(_MSC_VER)
70# pragma message("Macro definition of max detected - undefining")
71# elif defined (__GNUC__)
72# warning ("Macro definition of max detected - undefining")
73# endif
74# undef max
75#endif
76#if defined(min)
77# if defined(_MSC_VER)
78# pragma message("Macro definition of min detected - undefining")
79# elif defined (__GNUC__)
80# warning ("Macro definition of min detected - undefining")
81# endif
82# undef min
83#endif
84
85
86// include this to see if it defines _STLPORT_VERION
87# include <string>
88
89// fix to undefine _STLP_DEBUG if STLport is not actually being used
90// (resolves some unresolved externals concerning boost)
91#if defined(_STLP_DEBUG) && defined(_MSC_VER) && (_MSC_VER >= 1200)
92# if !defined(_STLPORT_VERSION)
93# undef _STLP_DEBUG
94# endif
95#endif
96
97// The following defines macros used within CEGUI for std::min/std::max
98// usage, and is done as a compatibility measure for VC6 with native STL.
99#if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
100# define ceguimin std::_cpp_min
101# define ceguimax std::_cpp_max
102#else
103# define ceguimin std::min
104# define ceguimax std::max
105#endif
106
107// CEGUI's Exception macros
108// This provides a mechanism to override how exception handling is used. Note
109// that in general this facility _should not be used_. Attempts to use this
110// to disable exceptions to 'make things easier' are doomed to failure. CEGUI
111// becomes less robust without exceptions (because they are used internally by
112// CEGUI). In addition, overriding the exception mechanism will also cause
113// memory leaks in various places. This is your only warning about such things,
114// if you decide to continue anyway you hereby waive any right to complain :-p
115#ifndef CEGUI_TRY
116# define CEGUI_TRY try
117#endif
118#ifndef CEGUI_CATCH
119# define CEGUI_CATCH(e) catch (e)
120#endif
121#ifndef CEGUI_THROW
122# define CEGUI_THROW(e) throw e
123#endif
124#ifndef CEGUI_RETHROW
125# define CEGUI_RETHROW throw
126#endif
127
128// CEGUI_FUNCTION_NAME - CEGUI::String containing current function name
129// in the best form we can get it
130#if defined(_MSC_VER)
131# define CEGUI_FUNCTION_NAME CEGUI::String(__FUNCSIG__)
132#elif defined(__GNUC__)
133# define CEGUI_FUNCTION_NAME CEGUI::String(__PRETTY_FUNCTION__)
134#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
135# define CEGUI_FUNCTION_NAME CEGUI::String(__func__)
136#else
137# define CEGUI_FUNCTION_NAME CEGUI::String("[Function name unavailable]")
138#endif
139
141#define CEGUI_UNUSED(var) (static_cast<void>(var))
142
143/*************************************************************************
144 Documentation for the CEGUI namespace itself
145*************************************************************************/
153namespace CEGUI
154{
155
156/*************************************************************************
157 Simplification of some 'unsigned' types
158*************************************************************************/
159typedef unsigned long ulong;
160typedef unsigned short ushort;
161typedef unsigned int uint;
162typedef unsigned char uchar;
163
164typedef long long int64;
165typedef int int32;
166typedef short int16;
167typedef signed char int8;
168
169typedef unsigned long long uint64;
170typedef unsigned int uint32;
171typedef unsigned short uint16;
172typedef unsigned char uint8;
173
174
175/*************************************************************************
176 System wide constants
177*************************************************************************/
178static const float DefaultNativeHorzRes = 640.0f;
179static const float DefaultNativeVertRes = 480.0f;
180
181
182/*************************************************************************
183 Additional typedefs
184*************************************************************************/
185typedef std::ostream OutStream;
186} // end of CEGUI namespace section
187
188// improve readability - http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.6
189#define CEGUI_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
190
191/*************************************************************************
192 Bring in forward references to all GUI base system classes
193*************************************************************************/
194#include "CEGUI/ForwardRefs.h"
195#include "CEGUI/MemoryAllocation.h"
196
197/*************************************************************************
198 Static assert
199*************************************************************************/
200#if (__cplusplus >= 201103L) || (_MSC_VER >= 1600)
201# define CEGUI_STATIC_ASSERT(e) static_assert(e, #e)
202#elif defined(_MSC_VER)
203# define CEGUI_STATIC_ASSERT(e) _STATIC_ASSERT(e)
204#else
205# define CEGUI_STATIC_ASSERT(e) {}
206#endif
207
208#endif // end of guard _CEGUIBase_h_
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
static const float DefaultNativeVertRes
Default native vertical resolution (for fonts and imagesets)
Definition: Base.h:179
static const float DefaultNativeHorzRes
Default native horizontal resolution (for fonts and imagesets)
Definition: Base.h:178
std::ostream OutStream
Output stream class.
Definition: Base.h:185