Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

libcompiler.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/libcompiler.h
00005  *
00006  *   DESCRIPTION
00007  *      Compiler deficiency workarounds for libpqxx clients
00008  *
00009  * Copyright (c) 2002-2003, Jeroen T. Vermeulen <jtv@xs4all.nl>
00010  *
00011  * See COPYING for copyright license.  If you did not receive a file called
00012  * COPYING with this source code, please notify the distributor of this mistake,
00013  * or contact the author.
00014  *
00015  *-------------------------------------------------------------------------
00016  */
00017 #ifndef PQXX_LIBCOMPILER_H
00018 #define PQXX_LIBCOMPILER_H
00019 
00020 // Workarounds & definitions that need to be included even in library's headers
00021 #include "pqxx/libconfig.h"
00022 
00023 
00024 #ifndef HAVE_PTRDIFF_T
00025 typedef long ptrdiff_t;
00026 #endif
00027 
00028 
00029 #ifdef PQXX_BROKEN_ITERATOR
00030 #include <cstddef>
00031 #include <cstdlib>
00032 namespace PGSTD
00033 {
00035 template<typename Cat, 
00036          typename T, 
00037          typename Dist, 
00038          typename Ptr=T*,
00039          typename Ref=T&> struct iterator
00040 {
00041   typedef Cat iterator_category;
00042   typedef T value_type;
00043   typedef Dist difference_type;
00044   typedef Ptr pointer;
00045   typedef Ref reference;
00046 };
00047 }
00048 #else
00049 #include <iterator>
00050 #endif // PQXX_BROKEN_ITERATOR
00051 
00052 #ifndef HAVE_CHAR_TRAITS
00053 #include <cstddef>
00054 namespace PGSTD
00055 {
00057 template<typename CHAR> struct char_traits {};
00059 template<> struct char_traits<char>
00060 {
00061   typedef int int_type;
00062   typedef size_t pos_type;
00063   typedef ptrdiff_t off_type;
00064   typedef char char_type;
00065 
00066   static int_type eof() { return -1; }
00067 };
00069 template<> struct char_traits<unsigned char>
00070 {
00071   typedef int int_type;
00072   typedef size_t pos_type;
00073   typedef ptrdiff_t off_type;
00074   typedef unsigned char char_type;
00075 
00076   static int_type eof() { return -1; }
00077 };
00078 }
00079 #endif
00080 
00081 // Workarounds for Windows
00082 #ifdef _WIN32
00083 
00084 #ifdef _MSC_VER
00085 #if _MSC_VER < 1300
00086 #error If you're using Visual C++, you'll need at least version 7 (VC.NET)
00087 #endif  // _MSC_VER < 1300
00088 
00089 // Workarounds for Visual C++.NET (2003 version does seem to work)
00090 #if _MSC_VER < 1310
00091 #define PQXX_WORKAROUND_VC7
00092 #define PQXX_NO_PARTIAL_CLASS_TEMPLATE_SPECIALISATION
00093 #define PQXX_TYPENAME
00094 #endif  // _MSC_VER < 1310
00095 #pragma warning (disable: 4290)
00096 #pragma warning (disable: 4786)
00097 #pragma warning (disable: 4251 4275 4273)
00098 #pragma comment(lib, "libpqdll")
00099 #if !defined(PQXX_LIBEXPORT) && !defined(_LIB)
00100 #define PQXX_LIBEXPORT __declspec(dllimport)
00101 #endif  // PQXX_LIBEXPORT _LIB
00102 #endif  // _MSC_VER
00103 #endif  // _WIN32
00104 
00105 // Used for Windows DLL
00106 #ifndef PQXX_LIBEXPORT
00107 #define PQXX_LIBEXPORT
00108 #endif
00109 
00110 // Some compilers (well, VC) stumble over some required cases of "typename"
00111 #ifndef PQXX_TYPENAME
00112 #define PQXX_TYPENAME typename
00113 #endif
00114 
00115 #endif
00116 

Generated on Fri Nov 21 19:50:08 2003 for libpqxx by doxygen 1.3.4