Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GNASH_UTILITY_H
00021 #define GNASH_UTILITY_H
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include "gnashconfig.h"
00026 #endif
00027
00028 #include <cstdlib>
00029 #include <cassert>
00030 #include <cstring>
00031 #include <string>
00032 #include <typeinfo>
00033
00034 #if defined(__GNUC__) && __GNUC__ > 2
00035 # include <cxxabi.h>
00036 #endif
00037
00038 #if defined(_WIN32) || defined(WIN32)
00039 #ifndef NDEBUG
00040
00041
00042
00043 #ifndef __MINGW32__
00044 #undef assert
00045 #define assert(x) if (!(x)) { __asm { int 3 } }
00046 #endif
00047 #endif // not NDEBUG
00048 #endif // _WIN32
00049
00050 #ifdef __amigaos4__
00051 #include <stdio.h>
00052 #include <fcntl.h>
00053 #include <netdb.h>
00054 #include <netinet/tcp.h>
00055 #undef UNUSED //to avoid "already defined" messages
00056 #define SHUT_RDWR 0
00057
00058 namespace std
00059 {
00060 typedef std::basic_string<wchar_t> wstring;
00061 };
00062 #endif
00063
00064 #if defined(__HAIKU__)
00065 namespace std {
00066 class wstring : public std::basic_string<char>
00067 {
00068 public:
00069 wstring(const char *t)
00070 : std::basic_string<char>(t)
00071 {
00072 }
00073 wstring()
00074 {
00075 }
00076 wstring(const wstring &that)
00077 : std::basic_string<char>(that.c_str())
00078 {
00079 }
00080 wstring(const std::basic_string<char> &that)
00081 : std::basic_string<char>(that)
00082 {
00083 }
00084 };
00085 };
00086 #endif
00087
00088 namespace gnash {
00089
00092 template <class T>
00093 std::string typeName(const T& inst)
00094 {
00095 std::string typeName = typeid(inst).name();
00096 #if defined(__GNUC__) && __GNUC__ > 2
00097 int status;
00098 char* typeNameUnmangled =
00099 abi::__cxa_demangle (typeName.c_str(), NULL, NULL,
00100 &status);
00101 if (status == 0)
00102 {
00103 typeName = typeNameUnmangled;
00104 std::free(typeNameUnmangled);
00105 }
00106 #endif // __GNUC__ > 2
00107 return typeName;
00108 }
00109
00110 }
00111
00112
00113 #define UNUSED(x) static_cast<void>((x))
00114
00115 #endif
00116
00117
00118
00119
00120
00121
00122
00123