log4sendpp.h

Go to the documentation of this file.
00001 
00009 /**************************************************************************
00010 
00011    begin                : Sat Sep 09 2007
00012    copyright            : (C) 2007 by Ewald Arnold
00013    email                : log4sendpp at ewald-arnold dot de
00014 
00015    This program is free software; you can redistribute it and/or modify
00016    it under the terms of the GNU Lesser General Public License as
00017    published by the Free Software Foundation; either version 2 of the License,
00018    or (at your option) any later version.
00019 
00020    This program is distributed in the hope that it will be useful,
00021    but WITHOUT ANY WARRANTY; without even the implied warranty of
00022    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023    GNU General Public License for more details.
00024 
00025    You should have received a copy of the GNU Lesser General Public License
00026    along with this program; if not, write to the Free Software
00027    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00028 
00029  **/
00030 
00038 #ifndef LOG4SENDPP_H
00039 #define LOG4SENDPP_H
00040 
00041 #ifdef _WIN32
00042 # ifndef __WIN32__
00043 #  define __WIN32__
00044 # endif
00045 #endif
00046 
00047 #ifdef __WIN32__
00048 # ifndef _WIN32
00049 #  define _WIN32
00050 # endif
00051 #define  WIN32_LEAN_AND_MEAN   
00052 //#define  NOGDI
00053 //#define  NOUSER
00054 //#define  NOKERNEL
00055 //#define  NOSOUND
00056 #endif
00057 
00058 #include <string>
00059 
00060 # ifdef _MSC_VER
00061 // Compilation Warning remover
00062 #  pragma warning (disable:4800)  // conversion int - bool
00063 #  pragma warning (disable:4786)  // identifier was truncated to 'number' characters in the debug information
00064 #  pragma warning (disable:4251)  // class 'type' needs to have dll-interface to be used by clients of class 'type2'
00065 #  pragma warning (disable:4180)  // qualifier applied to function type has no meaning
00066 #  pragma warning (disable:4355)  // 'this' : used in base member initializer list
00067 #  pragma warning (disable:4512)  // assignment operator could not be generated
00068 #  pragma warning (disable:4511)  // copy constructor could not be generated
00069 #  pragma warning (disable:4018)  // signed/unsigned mismatch
00070 #  pragma warning (disable:4100)  // unreferenced formal parameter
00071 #  pragma warning (disable:4663)  // C++ language change: to explicitly specialize class template 'identifier' use the following syntax
00072 #  pragma warning (disable:4146)  // unary minus operator applied to unsigned type, result still unsigned
00073 #  pragma warning (disable:4244)  // conversion from 'type1' to 'type2', possible loss of data
00074 #  pragma warning (disable:4138)  // '*/' found outside of comment
00075 #  pragma warning (disable:4516)  // access-declarations are deprecated; member using-declarations provide a better alternative
00076 #  pragma warning (disable:4097)  // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
00077 #  pragma warning (disable:4702)  // unreachable code
00078 #  pragma warning (disable:4127)  // conditional is const
00079 #  pragma warning (disable:4996)  // deprecatedposix name
00080 # endif // _MSC_VER
00081 
00082 
00083 // msvc71   is 1310
00084 // msvc2005 is 1400
00085 #ifdef _MSC_VER
00086 #  include <log4sendpp/log4sendpp_config-msvc_71.h>
00087 
00088 #elif defined(__BORLANDC__)
00089 # include <log4sendpp/log4sendpp_config-bcb5.h>
00090 
00091 #elif defined(__CYGWIN__)
00092 # ifdef HAVE_CONFIG_H
00093 #  include <config.h>
00094 # else
00095 #  include <log4sendpp/log4sendpp_config.h>
00096 # endif
00097 
00098 #else
00099 # ifdef HAVE_CONFIG_H
00100 #  include <config.h>
00101 # else
00102 #  include <log4sendpp/log4sendpp_config.h>
00103 # endif
00104 #endif
00105 
00107 //
00108 
00109 /*
00110 #if defined(LOG4SENDPP_UNICODE)
00111 # ifndef _UNICODE
00112 #  define _UNICODE
00113 # endif
00114 # ifndef UNICODE
00115 #  define UNICODE
00116 # endif
00117 #endif
00118 */
00119 
00120 #if defined(LOG4SENDPP_UNICODE) && defined(__CYGWIN__) // probably ugly hack
00121 # define _GLIBCPP_USE_WSTRING 1
00122 //# define _GLIBCPP_USE_WCHAR_T 1
00123 //# define _GLIBCPP_HAVE_WCHAR_H
00124 #endif
00125 
00126 
00128 // Catch Macros from MACOS
00129 
00130 #ifdef verify
00131 #error "<verify> must not be #defined within log4sendpp sources"
00132 #endif
00133 
00134 #ifdef check
00135 #error "<check> must not be #defined within log4sendpp sources"
00136 #endif
00137 
00138 #ifdef require
00139 #error "<require> must not be #defined within log4sendpp sources"
00140 #endif
00141 
00143 //
00144 
00145 #ifdef __BORLANDC__
00146 #define LOG4SENDPP_INT64 INT64
00147 #elif _MSC_VER
00148 #define LOG4SENDPP_INT64 __int64
00149 #else
00150 #define LOG4SENDPP_INT64 __int64_t
00151 #endif
00152 
00154 //
00155 
00156 #ifndef LOG4SENDPP_NO_RTTI
00157 # include <typeinfo>
00158 #else
00159 # undef CPPUNIT_USE_TYPEINFO_NAME
00160 # define CPPUNIT_USE_TYPEINFO_NAME 0
00161 #endif
00162 
00164 //
00165 
00166 #ifdef LOG4SENDPP_NO_NAMESPACE
00167 
00168 # define LOG4SENDPP_ANON_NS_START    /* nothing */
00169 # define LOG4SENDPP_NS               /* nothing */
00170 # define LOG4SENDPP_NS_START         /* nothing */
00171 # define LOG4SENDPP_NS_END           /* nothing */
00172 # define USING_NAMESPACE_LOG4SENDPP  /* nothing */
00173 
00174 #else
00175 
00176 # define LOG4SENDPP_ANON_NS_START    namespace {
00177 # define LOG4SENDPP_NS               l4snd
00178 # define LOG4SENDPP_NS_START         namespace l4snd {
00179 # define LOG4SENDPP_NS_END           }
00180 # define USING_NAMESPACE_LOG4SENDPP  using namespace l4snd;
00181 
00182 #endif
00183 
00185 //
00186 
00187 #ifdef LOG4SENDPP_NO_STD_NS
00188 # define LOG4SENDPP_STD_NS           /* nothing */
00189 #else
00190 # define LOG4SENDPP_STD_NS           std
00191 #endif
00192 
00194 //
00195 
00196 #ifndef LOG4SENDPP_NO_EXCEPTIONS
00197 
00198 #define LOG4SENDPP_THROW(x)   throw (x)
00199 #define LOG4SENDPP_RETHROW    throw
00200 #define LOG4SENDPP_TRY        try
00201 #define LOG4SENDPP_CATCH(x)   catch(x)
00202 #define LOG4SENDPP_CATCH_ALL  catch(...)
00203 
00204 #else
00205 
00206 #define CPPUNIT_DISABLE_EXCEPTIONS // ea-hack not available in official cppunit
00207 
00208 # ifndef LOG4SENDPP_THROW
00209 #  define LOG4SENDPP_THROW(x) LOG4SENDPP_NS::handleFailure(__LINE__, __FILE__, (x).what())
00210 # endif
00211 
00212 # ifndef LOG4SENDPP_RETHROW
00213 #  define LOG4SENDPP_RETHROW /* nothing */
00214 # endif
00215 
00216 # ifndef LOG4SENDPP_TRY
00217 #  define LOG4SENDPP_TRY  /* nothing */
00218 # endif
00219 
00220 # ifndef LOG4SENDPP_CATCH
00221 #  define LOG4SENDPP_CATCH(x)  if(false) /* usage limited */
00222 # endif
00223 
00224 # ifndef LOG4SENDPP_CATCH_ALL
00225 #  define LOG4SENDPP_CATCH_ALL  if(false) /* usage limited */
00226 # endif
00227 
00228 #endif
00229 
00231 //
00232 
00233 #ifdef __BORLANDC__
00234 # define LOG4SENDPP_FUNC_MACRO  __FUNC__
00235 #elif defined(_MSC_VER)
00236 # if _MSC_VER <= 1200
00237 #  define LOG4SENDPP_FUNC_MACRO  (LOG4SENDPP_STD_NS::string(__FILE__)  + "_" + LOG4SENDPP_NS::number((long unsigned)__LINE__)) // needs #include <log4sendpp/arguments.h>
00238 # else
00239 #  define LOG4SENDPP_FUNC_MACRO  __FUNCSIG__
00240 # endif
00241 #else
00242 # define LOG4SENDPP_FUNC_MACRO  __func__
00243 #endif
00244 
00250 
00251 //
00252 
00258 #ifndef LOG4SENDPP_UNUSED
00259 #define LOG4SENDPP_UNUSED(x)
00260 #endif
00261 
00264 #define LOG4SENDPP_USE_STD_EXCEPTION 1
00265 
00267 //
00268 
00271 #define LOG4SENDPP_MAKE_CHAR_READABLE 1
00272 
00273 #undef HAVE_MULTITHREAD  // obsolete and error prone
00274 
00276 //
00277 
00278 #if defined(_WIN32) || defined(_WIN64)
00279 # ifndef __WIN32__
00280 #  define __WIN32__
00281 # endif
00282 #endif
00283 
00284 #if defined(__BORLANDC__) || defined (_MSC_VER)
00285 
00286 # ifndef __WIN32__
00287 #  define __WIN32__
00288 # endif //__WIN32__
00289 
00290 # ifdef __BORLANDC__
00291 #  include <io.h>
00292 
00293 //# ifndef __MT__
00294 //# error MultiThreaded compilation is HIGHLY recommended, change at own risk
00295 //# endif
00296 
00297 //# ifndef _RTLDLL
00298 //# error Linking with dynamic RTL is HIGHLY recommended, change at own risk
00299 //# endif
00300 
00301 # endif
00302 
00304 //
00305 
00306 # ifdef _MSC_VER
00307 // STATIC
00308 #  if defined(LOG4SENDPP_STATIC_LIB)
00309 #   define LOG4SENDPP_API_DECL(type) type
00310 #   define LOG4SENDPP_API_DECL0
00311 #   define LOG4SENDPP_API_IMPL(type) type
00312 #   define LOG4SENDPP_API_IMPL0
00313 #   pragma message("*** log4sendpp: Static ***")
00314 #  else //LOG4SENDPP_STATIC_LIB
00315 
00316 #  if defined(LOG4SENDPP_NEED_EXPORTS)
00317 #   define LOG4SENDPP_API_DECL(type)  __declspec(dllexport)  type
00318 #   define LOG4SENDPP_API_DECL0       __declspec(dllexport)
00319 #   define LOG4SENDPP_API_IMPL(type)  __declspec(dllexport)  type
00320 #   define LOG4SENDPP_API_IMPL0       __declspec(dllexport)
00321 #   pragma message("*** log4sendpp: DllExport ***")
00322 
00323 #  else // LOG4SENDPP_NEED_EXPORTS
00324 
00325 #   define LOG4SENDPP_API_DECL(type)  __declspec(dllimport) type
00326 #   define LOG4SENDPP_API_DECL0       __declspec(dllimport)
00327 #   define LOG4SENDPP_API_IMPL(type)  __declspec(dllimport) type
00328 #   define LOG4SENDPP_API_IMPL0       __declspec(dllimport)
00329 #   pragma message("*** log4sendpp: DllImport ***")
00330 #  endif // LOG4SENDPP_NEED_EXPORTS
00331 
00332 #  endif //LOG4SENDPP_STATIC_LIB
00333 
00334 # else // __BORLANDC__
00335 
00336 # if defined(LOG4SENDPP_NEED_EXPORTS)
00337 #  define LOG4SENDPP_API_DECL0      __declspec(dllexport)
00338 #  define LOG4SENDPP_API_IMPL0      __declspec(dllexport)
00339 #  define LOG4SENDPP_API_DECL(type) __declspec(dllexport) type
00340 #  define LOG4SENDPP_API_IMPL(type) __declspec(dllexport) type
00341 # else
00342 #  define LOG4SENDPP_API_DECL0      __declspec(dllimport)
00343 #  define LOG4SENDPP_API_IMPL0
00344 #  define LOG4SENDPP_API_DECL(type) __declspec(dllimport) type
00345 #  define LOG4SENDPP_API_IMPL(type)  type
00346 # endif
00347 
00348 # endif
00349 
00350 #else // __BORLANDC__ || _MSC_VER
00351 
00352 # include <unistd.h>
00353 # define LOG4SENDPP_API_DECL0
00354 # define LOG4SENDPP_API_IMPL0
00355 # define LOG4SENDPP_API_DECL(type) type
00356 # define LOG4SENDPP_API_IMPL(type) type
00357 
00358 #endif
00359 
00361 //
00362 
00364 LOG4SENDPP_NS_START
00365 
00373   LOG4SENDPP_API_DECL(void) getVersion (int &major, int &minor, int &patch,
00374                                         bool &debug, LOG4SENDPP_STD_NS::string &info);
00375 
00381     typedef void (*FailureHandler)(unsigned srcline,
00382                                    const LOG4SENDPP_STD_NS::string &srcfile,
00383                                    const LOG4SENDPP_STD_NS::string &message);
00384 
00389     LOG4SENDPP_API_DECL(FailureHandler) setFailureHandler(FailureHandler handler);
00390 
00396     LOG4SENDPP_API_DECL(void)
00397          handleFailure(unsigned srcline,
00398                        const LOG4SENDPP_STD_NS::string &srcfile,
00399                        const LOG4SENDPP_STD_NS::string &message);
00400 
00401 LOG4SENDPP_NS_END
00402 
00403 
00404 #ifdef DOXYGEN_SHOULD_INCLUDE_THIS  // make doxygen happily include docs
00405 #define LOG4SENDPP_UNICODE
00406 #define LOG4SENDPP_NO_NAMESPACE
00407 #define LOG4SENDPP_API_DECL0
00408 #define LOG4SENDPP_API_DECL
00409 #define LOG4SENDPP_API_IMPL0
00410 #define LOG4SENDPP_API_IMPL
00411 #endif
00412 
00490 #endif // LOG4SENDPP_H

Generated on Sat Nov 24 14:41:22 2007 for log4sendpp by  doxygen 1.5.3