Crazy Eddie's GUI System  0.8.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Base.h
1 /***********************************************************************
2  filename: CEGUIBase.h
3  created: 20/2/2004
4  author: Paul D Turner
5 
6  purpose: Base include used within the system
7  This contains various lower level bits required
8  by other parts of the system. All other library
9  headers will include this file.
10 *************************************************************************/
11 /***************************************************************************
12  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining
15  * a copy of this software and associated documentation files (the
16  * "Software"), to deal in the Software without restriction, including
17  * without limitation the rights to use, copy, modify, merge, publish,
18  * distribute, sublicense, and/or sell copies of the Software, and to
19  * permit persons to whom the Software is furnished to do so, subject to
20  * the following conditions:
21  *
22  * The above copyright notice and this permission notice shall be
23  * included in all copies or substantial portions of the Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
29  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31  * OTHER DEALINGS IN THE SOFTWARE.
32  ***************************************************************************/
33 #ifndef _CEGUIBase_h_
34 #define _CEGUIBase_h_
35 
36 #include <cassert>
37 
38 // bring in configuration options
39 #include "CEGUI/Config.h"
40 
41 // add CEGUI version defines
42 #include "CEGUI/Version.h"
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 
98 // The following defines macros used within CEGUI for std::min/std::max
99 // usage, and is done as a compatibility measure for VC6 with native STL.
100 #if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
101 # define ceguimin std::_cpp_min
102 # define ceguimax std::_cpp_max
103 #else
104 # define ceguimin std::min
105 # define ceguimax std::max
106 #endif
107 
108 // CEGUI's Exception macros
109 // This provides a mechanism to override how exception handling is used. Note
110 // that in general this facility _should not be used_. Attempts to use this
111 // to disable exceptions to 'make things easier' are doomed to failure. CEGUI
112 // becomes less robust without exceptions (because they are used internally by
113 // CEGUI). In addition, overriding the exception mechanism will also cause
114 // memory leaks in various places. This is your only warning about such things,
115 // if you decide to continue anyway you hereby waive any right to complain :-p
116 #ifndef CEGUI_TRY
117 # define CEGUI_TRY try
118 #endif
119 #ifndef CEGUI_CATCH
120 # define CEGUI_CATCH(e) catch (e)
121 #endif
122 #ifndef CEGUI_THROW
123 # define CEGUI_THROW(e) throw e
124 #endif
125 #ifndef CEGUI_RETHROW
126 # define CEGUI_RETHROW throw
127 #endif
128 
129 // CEGUI_FUNCTION_NAME - CEGUI::String containing current function name
130 // in the best form we can get it
131 #if defined(_MSC_VER)
132 # define CEGUI_FUNCTION_NAME CEGUI::String(__FUNCSIG__)
133 #elif defined(__GNUC__)
134 # define CEGUI_FUNCTION_NAME CEGUI::String(__PRETTY_FUNCTION__)
135 #elif __STDC_VERSION__ >= 199901L
136 # define CEGUI_FUNCTION_NAME CEGUI::String(__func__)
137 #else
138 # define CEGUI_FUNCTION_NAME CEGUI::String("[Function name unavailable]")
139 #endif
140 
141 /*************************************************************************
142  Documentation for the CEGUI namespace itself
143 *************************************************************************/
151 namespace CEGUI
152 {
153 
154 /*************************************************************************
155  Simplification of some 'unsigned' types
156 *************************************************************************/
157 typedef unsigned long ulong;
158 typedef unsigned short ushort;
159 typedef unsigned int uint;
160 typedef unsigned char uchar;
161 
162 typedef long long int64;
163 typedef int int32;
164 typedef short int16;
165 typedef char int8;
166 
167 typedef unsigned long long uint64;
168 typedef unsigned int uint32;
169 typedef unsigned short uint16;
170 typedef unsigned char uint8;
171 
172 
173 /*************************************************************************
174  System wide constants
175 *************************************************************************/
176 static const float DefaultNativeHorzRes = 640.0f;
177 static const float DefaultNativeVertRes = 480.0f;
178 
179 
180 /*************************************************************************
181  Additional typedefs
182 *************************************************************************/
183 typedef std::ostream OutStream;
184 } // end of CEGUI namespace section
185 
186 // improve readability - http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.6
187 #define CEGUI_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
188 
189 /*************************************************************************
190  Bring in forward references to all GUI base system classes
191 *************************************************************************/
192 #include "CEGUI/ForwardRefs.h"
193 #include "CEGUI/MemoryAllocation.h"
194 
195 #endif // end of guard _CEGUIBase_h_