00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00022
00023
00024
00025 #ifndef _F_UTILS_H_
00026 #define _F_UTILS_H_
00027
00028
00029 #ifdef _WIN32
00030 #ifndef _CRT_SECURE_NO_DEPRECATE
00031 #define _CRT_SECURE_NO_DEPRECATE 1 // MSVS 2005 support.
00032 #endif // _CRT_SECURE_NO_DEPRECATE
00033 #pragma warning(disable:4702)
00034 #endif // _WIN32
00035
00036 #define NOMINMAX
00037 #ifdef max
00038 #undef max
00039 #endif // max
00040 #ifdef min
00041 #undef min
00042 #endif // min
00043
00044 #ifndef FCOLLADA_NOMINMAX
00045
00046 template<class T>
00047 inline T& max(T& x, T& y) { return (x > y) ? x : y; }
00048 template<class T>
00049 inline const T& max(const T& x, const T& y) { return (x > y) ? x : y; }
00052 template <class T>
00053 inline T& min(T& x, T& y) { return (x < y) ? x : y; }
00054 template <class T>
00055 inline const T& min(const T& x,const T& y) { return (x < y) ? x : y; }
00056 #endif // FCOLLADA_NOMINMAX
00057
00058 #ifdef _WIN32
00059 #pragma warning(default:4702)
00060 #endif
00061
00062
00063 #define UNUSED(a)
00064 #ifdef _DEBUG
00065 #define UNUSED_NDEBUG(a) a
00066 #else
00067 #define UNUSED_NDEBUG(a)
00068 #endif // _DEBUG
00069
00070
00071 #ifndef _FU_PLATFORMS_H_
00072 #include "FUtils/Platforms.h"
00073 #endif // _FU_PLATFORMS_H_
00074 #ifndef _FU_ASSERT_H_
00075 #include "FUtils/FUAssert.h"
00076 #endif // _FU_ASSERT_H_
00077
00078
00079 #define HAS_VECTORTYPES
00080 #ifndef _F_MATH_H_
00081 #include "FMath/FMath.h"
00082 #endif // _F_MATH_H_
00083
00084
00085 #ifndef NO_LIBXML
00086 #define HAS_LIBXML
00087 #if !defined(FCOLLADA_DLL) || defined(FCOLLADA_INTERNAL)
00088 #define LIBXML_STATIC
00089 #endif // !FCOLLADA_DLL || !FCOLLADA_INTERNAL
00090 #ifndef __XML_TREE_H__
00091 #include <libxml/tree.h>
00092 #endif // __XML_TREE_H__
00093 #else // NO_LIBXML
00094 typedef struct _xmlNode xmlNode;
00095 #endif // NO_LIBXML
00096
00097
00098 #define SAFE_DELETE(ptr) if ((ptr) != NULL) { delete (ptr); (ptr) = NULL; }
00099 #define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; }
00100 #define SAFE_FREE(ptr) if (ptr != NULL) { free(ptr); ptr = NULL; }
00101 #define SAFE_RELEASE(ptr) { if ((ptr) != NULL) { (ptr)->Release(); (ptr) = NULL; } }
00102 #define CLEAR_POINTER_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE((a)[i]); (a).clear(); }
00103 #define CLEAR_ARRAY_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE_ARRAY((a)[i]); (a).clear(); }
00104 #define CLEAR_POINTER_STD_PAIR_CONT(cont, a){ for (cont::iterator it = (a).begin(); it != (a).end(); ++it) SAFE_DELETE((*it).second); (a).clear(); }
00105 #define CLEAR_POINTER_STD_CONT(cont, a){ for (cont::iterator it = (a).begin(); it != (a).end(); ++it) SAFE_DELETE((*it)); (a).clear(); }
00107 // Base RTTI object and object container class
00108 #ifndef _FU_OBJECT_TYPE_H_
00109 #include "FUtils/FUObjectType.h"
00110 #endif //_FU_OBJECT_TYPE_H_
00111 #ifndef _FU_OBJECT_H_
00112 #include "FUtils/FUObject.h"
00113 #endif // _FU_OBJECT_H_
00114 #ifndef _FU_TRACKER_H_
00115 #include "FUtils/FUTracker.h"
00116 #endif // _FU_TRACKER_H_
00117
00118
00119 #ifndef _FU_STRING_H_
00120 #include "FUtils/FUString.h"
00121 #endif // _FU_STRING_H_
00122 #ifndef _FU_CRC32_H_
00123 #include "FUtils/FUCrc32.h"
00124 #endif // _FU_CRC32_H_
00125 #ifndef _FU_DEBUG_H_
00126 #include "FUtils/FUDebug.h"
00127 #endif // _FU_DEBUG_H_
00128 #ifndef _FU_ERROR_H_
00129 #include "FUtils/FUError.h"
00130 #endif // _FU_ERROR_H_
00131
00132 #ifndef RETAIL
00133 #define ENABLE_TEST
00134 #endif
00135
00136 #endif // _F_UTILS_H_