Crazy Eddie's GUI System  0.8.4
Base.h
00001 /***********************************************************************
00002         created:        20/2/2004
00003         author:         Paul D Turner
00004 
00005         purpose:        Base include used within the system
00006                                 This contains various lower level bits required
00007                                 by other parts of the system.  All other library
00008                                 headers will include this file.
00009 *************************************************************************/
00010 /***************************************************************************
00011  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00012  *
00013  *   Permission is hereby granted, free of charge, to any person obtaining
00014  *   a copy of this software and associated documentation files (the
00015  *   "Software"), to deal in the Software without restriction, including
00016  *   without limitation the rights to use, copy, modify, merge, publish,
00017  *   distribute, sublicense, and/or sell copies of the Software, and to
00018  *   permit persons to whom the Software is furnished to do so, subject to
00019  *   the following conditions:
00020  *
00021  *   The above copyright notice and this permission notice shall be
00022  *   included in all copies or substantial portions of the Software.
00023  *
00024  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00027  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00028  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00029  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00030  *   OTHER DEALINGS IN THE SOFTWARE.
00031  ***************************************************************************/
00032 #ifndef _CEGUIBase_h_
00033 #define _CEGUIBase_h_
00034 
00035 // bring in configuration options
00036 #include "CEGUI/Config.h"
00037 
00038 // add CEGUI version defines
00039 #include "CEGUI/Version.h"
00040 
00041 #include <cassert>
00042 #include <algorithm>
00043 
00044 /*************************************************************************
00045         Dynamic Library import / export control conditional
00046         (Define CEGUIBASE_EXPORTS to export symbols, else they are imported)
00047 *************************************************************************/
00048 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
00049 #   ifdef CEGUIBASE_EXPORTS
00050 #       define CEGUIEXPORT __declspec(dllexport)
00051 #   else
00052 #       define CEGUIEXPORT __declspec(dllimport)
00053 #   endif
00054 #       define CEGUIPRIVATE
00055 #else
00056 #       define CEGUIEXPORT
00057 #       define CEGUIPRIVATE
00058 #endif
00059 
00060 
00061 // totally kill this warning (debug info truncated to 255 chars etc...) on <= VC6
00062 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
00063 #   pragma warning(disable : 4786)
00064 #endif
00065 
00066 
00067 // Detect macros for min / max and undefine (with a warning where possible)
00068 #if defined(max)
00069 #   if defined(_MSC_VER)
00070 #       pragma message("Macro definition of max detected - undefining")
00071 #   elif defined (__GNUC__)
00072 #       warning ("Macro definition of max detected - undefining")
00073 #   endif
00074 #   undef max
00075 #endif
00076 #if defined(min)
00077 #   if defined(_MSC_VER)
00078 #       pragma message("Macro definition of min detected - undefining")
00079 #   elif defined (__GNUC__)
00080 #       warning ("Macro definition of min detected - undefining")
00081 #   endif
00082 #   undef min
00083 #endif
00084 
00085 
00086 // include this to see if it defines _STLPORT_VERION
00087 #       include <string>
00088 
00089 // fix to undefine _STLP_DEBUG if STLport is not actually being used
00090 // (resolves some unresolved externals concerning boost)
00091 #if defined(_STLP_DEBUG) && defined(_MSC_VER) && (_MSC_VER >= 1200)
00092 #   if !defined(_STLPORT_VERSION)
00093 #       undef _STLP_DEBUG
00094 #   endif
00095 #endif
00096 
00097 // The following defines macros used within CEGUI for std::min/std::max
00098 // usage, and is done as a compatibility measure for VC6 with native STL.
00099 #if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
00100 #    define ceguimin    std::_cpp_min
00101 #    define ceguimax    std::_cpp_max
00102 #else
00103 #    define ceguimin    std::min
00104 #    define ceguimax    std::max
00105 #endif
00106 
00107 // CEGUI's Exception macros
00108 // This provides a mechanism to override how exception handling is used.  Note
00109 // that in general this facility _should not be used_.  Attempts to use this
00110 // to disable exceptions to 'make things easier' are doomed to failure.  CEGUI
00111 // becomes less robust without exceptions (because they are used internally by
00112 // CEGUI).  In addition, overriding the exception mechanism will also cause
00113 // memory leaks in various places.  This is your only warning about such things,
00114 // if you decide to continue anyway you hereby waive any right to complain :-p
00115 #ifndef CEGUI_TRY
00116 #   define CEGUI_TRY try
00117 #endif
00118 #ifndef CEGUI_CATCH
00119 #   define CEGUI_CATCH(e) catch (e)
00120 #endif
00121 #ifndef CEGUI_THROW
00122 #   define CEGUI_THROW(e) throw e
00123 #endif
00124 #ifndef CEGUI_RETHROW
00125 #   define CEGUI_RETHROW throw
00126 #endif
00127 
00128 // CEGUI_FUNCTION_NAME - CEGUI::String containing current function name
00129 // in the best form we can get it
00130 #if defined(_MSC_VER)
00131 #   define  CEGUI_FUNCTION_NAME CEGUI::String(__FUNCSIG__)
00132 #elif defined(__GNUC__)
00133 #   define  CEGUI_FUNCTION_NAME CEGUI::String(__PRETTY_FUNCTION__)
00134 #elif __STDC_VERSION__ >= 199901L
00135 #   define  CEGUI_FUNCTION_NAME CEGUI::String(__func__)
00136 #else
00137 #   define  CEGUI_FUNCTION_NAME CEGUI::String("[Function name unavailable]")
00138 #endif
00139 
00140 /*************************************************************************
00141         Documentation for the CEGUI namespace itself
00142 *************************************************************************/
00150 namespace CEGUI
00151 {
00152 
00153 /*************************************************************************
00154         Simplification of some 'unsigned' types
00155 *************************************************************************/
00156 typedef unsigned long   ulong;
00157 typedef unsigned short  ushort;
00158 typedef unsigned int    uint;
00159 typedef unsigned char   uchar;
00160 
00161 typedef long long  int64;
00162 typedef int        int32;
00163 typedef short      int16;
00164 typedef char       int8;
00165 
00166 typedef unsigned long long  uint64;
00167 typedef unsigned int        uint32;
00168 typedef unsigned short      uint16;
00169 typedef unsigned char       uint8;
00170 
00171 
00172 /*************************************************************************
00173         System wide constants
00174 *************************************************************************/
00175 static const float              DefaultNativeHorzRes    = 640.0f;               
00176 static const float              DefaultNativeVertRes    = 480.0f;               
00177 
00178 
00179 /*************************************************************************
00180     Additional typedefs
00181 *************************************************************************/
00182 typedef std::ostream OutStream;     
00183 }  // end of CEGUI namespace section
00184 
00185 // improve readability - http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.6
00186 #define CEGUI_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember)) 
00187 
00188 /*************************************************************************
00189         Bring in forward references to all GUI base system classes
00190 *************************************************************************/
00191 #include "CEGUI/ForwardRefs.h"
00192 #include "CEGUI/MemoryAllocation.h"
00193 
00194 #endif  // end of guard _CEGUIBase_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends