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-2004, 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 PQXX_HAVE_PTRDIFF_T
00025 typedef long ptrdiff_t;
00026 #endif
00027 
00028 
00029 #ifdef PQXX_BROKEN_ITERATOR
00030 #include <cstddef>
00031 #include <cstdlib>
00033 
00041 namespace PGSTD
00042 {
00044 template<typename Cat, 
00045          typename T, 
00046          typename Dist, 
00047          typename Ptr=T*,
00048          typename Ref=T&> struct iterator
00049 {
00050   typedef Cat iterator_category;
00051   typedef T value_type;
00052   typedef Dist difference_type;
00053   typedef Ptr pointer;
00054   typedef Ref reference;
00055 };
00056 }
00057 #else
00058 #include <iterator>
00059 #endif // PQXX_BROKEN_ITERATOR
00060 
00061 #ifndef PQXX_HAVE_CHAR_TRAITS
00062 #include <cstddef>
00063 namespace PGSTD
00064 {
00066 template<typename CHAR> struct char_traits {};
00068 template<> struct char_traits<char>
00069 {
00070   typedef int int_type;
00071   typedef size_t pos_type;
00072   typedef ptrdiff_t off_type;
00073   typedef char char_type;
00074 
00075   static int_type eof() { return -1; }
00076 };
00078 template<> struct char_traits<unsigned char>
00079 {
00080   typedef int int_type;
00081   typedef size_t pos_type;
00082   typedef ptrdiff_t off_type;
00083   typedef unsigned char char_type;
00084 
00085   static int_type eof() { return -1; }
00086 };
00087 }
00088 #endif
00089 
00090 // Workarounds for SUN Workshop 6
00091 #if defined(__SUNPRO_CC)
00092 #if __SUNPRO_CC_COMPAT < 5
00093 #error "This compiler version is not capable of building libpqxx."
00094 #endif  // __SUNPRO_CC_COMPAT < 5
00095 
00096 #define PQXX_BROKEN_MEMBER_TEMPLATE_DEFAULT_ARG
00097 
00098 #endif  // __SUNPRO_CC
00099 
00100 // Workarounds for Windows
00101 #ifdef _WIN32
00102 
00103 #ifdef _MSC_VER
00104 #if _MSC_VER < 1300
00105 #error If you're using Visual C++, you'll need at least version 7 (VC.NET)
00106 #endif  // _MSC_VER < 1300
00107 
00108 // Workarounds for Visual C++.NET (2003 version does seem to work)
00109 #if _MSC_VER < 1310
00110 #define PQXX_WORKAROUND_VC7
00111 #undef PQXX_HAVE_REVERSE_ITERATOR
00112 #define PQXX_NO_PARTIAL_CLASS_TEMPLATE_SPECIALISATION
00113 #define PQXX_TYPENAME
00114 #endif  // _MSC_VER < 1310
00115 #pragma warning (disable: 4290)
00116 #pragma warning (disable: 4786)
00117 #pragma warning (disable: 4251 4275 4273)
00118 #pragma comment(lib, "libpqdll")
00119 #if !defined(PQXX_LIBEXPORT) && !defined(_LIB)
00120 #define PQXX_LIBEXPORT __declspec(dllimport)
00121 #endif  // PQXX_LIBEXPORT _LIB
00122 #endif  // _MSC_VER
00123 #endif  // _WIN32
00124 
00125 // Used for Windows DLL
00126 #ifndef PQXX_LIBEXPORT
00127 #define PQXX_LIBEXPORT
00128 #endif
00129 
00130 // Some compilers (well, VC) stumble over some required cases of "typename"
00131 #ifndef PQXX_TYPENAME
00132 #define PQXX_TYPENAME typename
00133 #endif
00134 
00135 #endif
00136 

Generated on Thu Mar 18 21:25:47 2004 for libpqxx by doxygen 1.3.6-20040222