Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
// ----------------------------------------------------------------------------
// compat_workarounds : general framework for non-conformance workarounds
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// this file defines wrapper classes to hide non-conforming
// std::char_traits<> and std::allocator<> traits
// and Includes : config_macros.hpp (defines config macros
// and compiler-specific switches)
// Non-conformant Std-libs fail to supply conformant traits (std::char_traits,
// std::allocator) and/or the std::string doesnt support them.
// We don't want to have hundreds of #ifdef workarounds, so we define
// replacement traits.
// But both char_traits and allocator traits are visible in the interface,
// (inside the final string type), thus we need to keep both
// the replacement type (typedefed to 'compatible_type') for real use,
// and the original stdlib type (typedef to 'type_for_string') for interface
// visibility. This is what Compat* classes do (as well as be transparent
// when good allocator and char traits are present)
#ifndef BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
#define BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
namespace boost {
namespace io {
// gcc-2.95 char traits (non-conformantly named string_char_traits)
// lack several functions so we extend them in a replacement class.
template<class Tr>
class CompatTraits;
// std::allocator<Ch> in gcc-2.95 is ok, but basic_string only works
// with plain 'std::alloc' still, alt_stringbuf requires a functionnal
// alloc template argument, so we need a replacement allocator
template<class Alloc>
class CompatAlloc;
} // N.S. io
}// N.S. boost
#include <boost/format/detail/config_macros.hpp>
// sets-up macros and load compiler-specific workarounds headers.
#if !defined(BOOST_FORMAT_STREAMBUF_DEFINED)
// workarounds-gcc-2.95 might have defined own streambuf
#include <streambuf>
#endif
#if !defined(BOOST_FORMAT_OSTREAM_DEFINED)
// workarounds-gcc-2.95 might already have included <iostream>
#include <ostream>
#endif
namespace boost {
namespace io {
// **** CompatTraits general definitions : ----------------------------
template<class Tr>
class CompatTraits
{ // general case : be transparent
public:
typedef Tr compatible_type;
};
// **** CompatAlloc general definitions : -----------------------------
template<class Alloc>
class CompatAlloc
{ // general case : be transparent
public:
typedef Alloc compatible_type;
};
} //N.S. io
} // N.S. boost
#endif // include guard

View File

@@ -0,0 +1,97 @@
// -*- C++ -*-
// ----------------------------------------------------------------------------
// config_macros.hpp : configuration macros for the format library
// only BOOST_IO_STD is absolutely needed (it should be 'std::' in general)
// others are compiler-specific workaround macros used in #ifdef switches
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_CONFIG_MACROS_HPP
#define BOOST_FORMAT_CONFIG_MACROS_HPP
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
// make sure our local macros wont override something :
#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \
|| defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) \
|| defined(BOOST_NO_TEMPLATE_STD_STREAM) \
|| defined(BOOST_FORMAT_STREAMBUF_DEFINED) || defined(BOOST_FORMAT_OSTREAM_DEFINED)
#error "boost::format uses a local macro that is already defined."
#endif
// specific workarounds. each header can define BOOS_IO_STD if it
// needs. (e.g. because of IO_NEEDS_USING_DECLARATION)
#include <boost/format/detail/workarounds_gcc-2_95.hpp>
#include <boost/format/detail/workarounds_stlport.hpp>
#ifndef BOOST_IO_STD
# define BOOST_IO_STD ::std::
#endif
#if defined(BOOST_NO_STD_LOCALE) || \
( BOOST_WORKAROUND(__BORLANDC__, <= 0x564) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) )
// some future __BORLANDC__ >0x564 versions might not need this
// 0x570 is Borland's kylix branch
#define BOOST_NO_LOCALE_ISDIGIT
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300))
#define BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif
// gcc-2.95's native stringstream is not usable
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
#define BOOST_FORMAT_IGNORE_STRINGSTREAM
#endif
// **** Workaround for io streams, stlport and msvc.
#ifdef BOOST_IO_NEEDS_USING_DECLARATION
namespace boost {
using std::char_traits;
using std::basic_ostream;
namespace io {
using std::basic_ostream;
namespace detail {
using std::basic_ios;
using std::basic_ostream;
}
}
#if ! defined(BOOST_NO_STD_LOCALE)
using std::locale;
namespace io {
using std::locale;
namespace detail {
using std::locale;
}
}
#endif // locale
}
// -end N.S. boost
#endif // needs_using_declaration
// *** hide std::locale if it doesnt exist.
// this typedef is either std::locale or int, avoids placing ifdefs everywhere
namespace boost { namespace io { namespace detail {
#if ! defined(BOOST_NO_STD_LOCALE)
typedef BOOST_IO_STD locale locale_t;
#else
typedef int locale_t;
#endif
} } }
// ----------------------------------------------------------------------------
#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP

View File

@@ -0,0 +1,56 @@
// ----------------------------------------------------------------------------
// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads)
// the trick was described in boost's list by Aleksey Gurtovoy
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_MSVC_DISAMBIGUATER_HPP
#define BOOST_MSVC_DISAMBIGUATER_HPP
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \
BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// this whole header is specifically for msvc up to 7.0
#include <boost/format/group.hpp>
#include <ostream>
namespace boost {
namespace io {
namespace detail {
template< class Ch, class Tr, class T >
struct disambiguater
{
template< typename U >
static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
{
os << group_head(x.a1_);
}
static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
{
}
template< typename U >
static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
{
os << group_last(x.a1_);
}
static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
{
os << x;
}
};
} // namespace detail
} // namespace io
} // namespace boost
#endif // -BOOST_MSVC
#endif // -BOOST_MSVC_DISAMBIGUATER_HPP

View File

@@ -0,0 +1,34 @@
// ----------------------------------------------------------------------------
// unset_macros.hpp
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// *** Undefine 'local' macros :
#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST
#undef BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif
#ifdef BOOST_NO_LOCALE_ISDIGIT
#undef BOOST_NO_LOCALE_ISDIGIT
#endif
#ifdef BOOST_IO_STD
#undef BOOST_IO_STD
#endif
#ifdef BOOST_IO_NEEDS_USING_DECLARATION
#undef BOOST_IO_NEEDS_USING_DECLARATION
#endif
#ifdef BOOST_NO_TEMPLATE_STD_STREAM
#undef BOOST_NO_TEMPLATE_STD_STREAM
#endif
#ifdef BOOST_FORMAT_STREAMBUF_DEFINED
#undef BOOST_FORMAT_STREAMBUF_DEFINED
#endif
#ifdef BOOST_FORMAT_OSTREAM_DEFINED
#undef BOOST_FORMAT_OSTREAM_DEFINED
#endif

View File

@@ -0,0 +1,162 @@
// ----------------------------------------------------------------------------
// workarounds for gcc < 3.0.
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// There's a lot to do, the stdlib shipped with gcc prior to 3.x
// was terribly non-conforming.
// . defines macros switches
// . supplies template classes basic_foo<char,Tr> where gcc only supplies foo.
// i.e :
// - basic_ios<char, Tr> from ios
// - basic_ostream<char, Tr> from ostream
// - basic_srteambuf<char, Tr> from streambuf
// these can be used transparently. (it obviously does not work for wchar_t)
// . specialise CompatAlloc and CompatTraits to wrap gcc-2.95's
// string_char_traits and std::alloc
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
// only for gcc-2.95's native stdlib
#ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H
#define BOOST_FORMAT_WORKAROUNDS_GCC295_H
// SGI STL doesnt have <ostream> and others, so we need iostream.
#include <iostream>
#define BOOST_FORMAT_OSTREAM_DEFINED
#include <streambuf.h>
#define BOOST_FORMAT_STREAMBUF_DEFINED
#define BOOST_NO_TEMPLATE_STD_STREAM
#ifndef BOOST_IO_STD
# define BOOST_IO_STD std::
#endif
// ***
// gcc's simple classes turned into standard-like template classes :
namespace std {
// gcc has string_char_traits, it's incomplete.
// we declare a std::char_traits, and specialize CompatTraits<..> on it
// to do what is required
template<class Ch>
class char_traits; // no definition here, we will just use it as a tag.
template <class Ch, class Tr>
class basic_streambuf;
template <class Tr>
class basic_streambuf<char, Tr> : public streambuf {
};
template <class Ch, class Tr=::std::char_traits<Ch> >
class basic_ios;
template <class Tr>
class basic_ios<char, Tr> : public ostream {
public:
basic_ios(streambuf * p) : ostream(p) {};
char fill() const { return ios::fill(); } // gcc returns wchar..
char fill(char c) { return ios::fill(c); } // gcc takes wchar..
char widen(char c) { return c; }
char narrow(char c, char def) { return c; }
basic_ios& copyfmt(const ios& right) {
fill(right.fill());
flags(right.flags() );
exceptions(right.exceptions());
width(right.width());
precision(right.precision());
return *this;
}
};
typedef ios ios_base;
template <class Ch, class Tr>
class basic_ostream;
template <class Tr>
class basic_ostream<char, Tr> : public basic_ios<char, Tr>
{
public:
basic_ostream(streambuf * p) : basic_ios<char,Tr> (p) {}
};
} // namespace std
namespace boost {
namespace io {
// ** CompatTraits gcc2.95 specialisations ----------------------------
template<class Ch>
class CompatTraits< ::std::string_char_traits<Ch> >
: public ::std::string_char_traits<Ch>
{
public:
typedef CompatTraits compatible_type;
typedef Ch char_type;
typedef int int_type;
typedef ::std::streampos pos_type;
typedef ::std::streamoff off_type;
static char_type
to_char_type(const int_type& meta) {
return static_cast<char_type>(meta); }
static int_type
to_int_type(const char_type& ch) {
return static_cast<int_type>(static_cast<unsigned char>(ch) );}
static bool
eq_int_type(const int_type& left, const int_type& right) {
return left == right; }
static int_type
eof() {
return static_cast<int_type>(EOF);
}
static int_type
not_eof(const int_type& meta) {
return (meta == eof()) ? 0 : meta;
}
};
template<class Ch>
class CompatTraits< ::std::char_traits<Ch> > {
public:
typedef CompatTraits< ::std::string_char_traits<Ch> > compatible_type;
};
// ** CompatAlloc gcc-2.95 specialisations ---------------------------
template<>
class CompatAlloc< ::std::alloc>
{
public:
typedef ::std::allocator<char> compatible_type;
};
} // N.S. io
} // N.S. boost
#endif // include guard
#endif // if workaround

View File

@@ -0,0 +1,42 @@
// ----------------------------------------------------------------------------
// workarounds_stlport.hpp : workaround STLport issues
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_MACROS_STLPORT_HPP
#define BOOST_MACROS_STLPORT_HPP
#if defined(_STLPORT_VERSION) && BOOST_WORKAROUND( BOOST_MSVC, <= 1300)
// msvc-6-stlport fails to find basic_string::append( iterator, iterator) when linking
// might affect other MSwindows compilers
#define BOOST_NO_STRING_APPEND
#endif
// *** This should go to "boost/config/stdlib/stlport.hpp".
// If the streams are not native and there are problems with using templates
// accross namespaces, we define some macros to enable a workaround for this.
// STLport 4.5
#if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE)
# define BOOST_IO_STD
# define BOOST_IO_NEEDS_USING_DECLARATION
#endif
// STLport 4.0
#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE)
# define BOOST_IO_STD
# define BOOST_IO_NEEDS_USING_DECLARATION
#endif
// ----------------------------------------------------------------------------
#endif // BOOST_MACROS_STLPORT_HPP