boost: update to 1.42.0

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33490 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2010-02-17 20:54:47 +00:00
parent 403369edd3
commit eee966a7d8
82 changed files with 2708 additions and 843 deletions

View File

@ -24,6 +24,13 @@
#ifndef BOOST_ARRAY_HPP
#define BOOST_ARRAY_HPP
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(push)
# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
#endif
#include <cstddef>
#include <stdexcept>
#include <boost/assert.hpp>
@ -320,4 +327,9 @@ namespace boost {
} /* namespace boost */
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop)
#endif
#endif /*BOOST_ARRAY_HPP*/

View File

@ -207,6 +207,13 @@ public:
}
};
#ifdef BOOST_MSVC
// MSVC is bright enough to realise that the parameter rhs
// in operator==may be unused for some template argument types:
#pragma warning(push)
#pragma warning(disable:4100)
#endif
template< class A1 > class list1: private storage1< A1 >
{
private:
@ -846,6 +853,10 @@ public:
}
};
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
// bind_t
#ifndef BOOST_NO_VOID_RETURNS
@ -1629,7 +1640,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
// data member pointers
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|| ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, <= 0x610 ) )
|| ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) )
template<class R, class T, class A1>
_bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
@ -1654,7 +1665,14 @@ template< class M, class T > struct add_cref< M T::*, 0 >
template< class M, class T > struct add_cref< M T::*, 1 >
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4180)
#endif
typedef M const & type;
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
};
template< class R, class T > struct add_cref< R (T::*) (), 1 >

View File

@ -51,14 +51,16 @@ public:
template<class U> R operator()(U & u) const
{
BOOST_MEM_FN_RETURN call(u, &u);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u) const
{
BOOST_MEM_FN_RETURN call(u, &u);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p);
}
#endif
@ -109,7 +111,8 @@ public:
template<class U> R operator()(U const & u) const
{
BOOST_MEM_FN_RETURN call(u, &u);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p);
}
R operator()(T const & t) const
@ -164,14 +167,16 @@ public:
template<class U> R operator()(U & u, A1 a1) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1);
}
#endif
@ -223,7 +228,8 @@ public:
template<class U> R operator()(U const & u, A1 a1) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1);
}
R operator()(T const & t, A1 a1) const
@ -276,14 +282,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2);
}
#endif
@ -333,7 +341,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2);
}
R operator()(T const & t, A1 a1, A2 a2) const
@ -386,14 +395,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
}
#endif
@ -443,7 +454,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
}
R operator()(T const & t, A1 a1, A2 a2, A3 a3) const
@ -496,14 +508,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
}
#endif
@ -553,7 +567,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
}
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const
@ -606,14 +621,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
}
#endif
@ -663,7 +680,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
}
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
@ -716,14 +734,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
}
#endif
@ -773,7 +793,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
}
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
@ -826,14 +847,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
}
#endif
@ -883,7 +906,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
}
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
@ -936,14 +960,16 @@ public:
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
}
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
}
#endif
@ -998,7 +1024,8 @@ public:
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
{
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
U const * p = 0;
BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
}
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const

View File

@ -66,7 +66,6 @@
// Borland C++ Builder 6 and below:
#if (__BORLANDC__ <= 0x564)
# define BOOST_NO_INTEGRAL_INT64_T
# ifdef NDEBUG
// fix broken <cstring> so that Boost.test works:
@ -121,6 +120,7 @@
#endif
// Borland C++ Builder 2008 and below:
# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS

View File

@ -19,8 +19,8 @@
#endif
//
// versions check:
// last known and checked version is 0x610
#if (__CODEGEARC__ > 0x613)
// last known and checked version is 0x620
#if (__CODEGEARC__ > 0x620)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
@ -30,20 +30,24 @@
// CodeGear C++ Builder 2009
#if (__CODEGEARC__ <= 0x613)
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# define BOOST_NO_PRIVATE_IN_AGGREGATE
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
# define BOOST_NO_USING_TEMPLATE
// we shouldn't really need this - but too many things choke
// without it, this needs more investigation:
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
// CodeGear C++ Builder 2010
#if (__CODEGEARC__ <= 0x620)
# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
# define BOOST_NO_USING_TEMPLATE
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
// Temporary hack, until specific MPL preprocessed headers are generated
# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
@ -59,7 +63,6 @@
# endif
#endif
//
// C++0x macros:
//

View File

@ -125,7 +125,7 @@
#if (_MSC_VER >= 1200)
# define BOOST_HAS_MS_INT64
#endif
#if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS)
#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500))
# define BOOST_HAS_LONG_LONG
#else
# define BOOST_NO_LONG_LONG

View File

@ -23,10 +23,25 @@
#ifndef BOOST_CSTDINT_HPP
#define BOOST_CSTDINT_HPP
//
// Since we always define the INT#_C macros as per C++0x,
// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
// thing if possible, and so that the user knows that the macros
// are actually defined as per C99.
//
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif
#include <boost/config.hpp>
#ifdef BOOST_HAS_STDINT_H
//
// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not
// depending upon what headers happen to have been included first...
// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
//
#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))
// The following #include is an implementation artifact; not part of interface.
# ifdef __hpux
@ -220,6 +235,15 @@ namespace boost
typedef unsigned short uint_least16_t;
typedef unsigned short uint_fast16_t;
# endif
# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
// On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified
// MTA / XMT does support the following non-standard integer types
typedef __short16 int16_t;
typedef __short16 int_least16_t;
typedef __short16 int_fast16_t;
typedef unsigned __short16 uint16_t;
typedef unsigned __short16 uint_least16_t;
typedef unsigned __short16 uint_fast16_t;
# elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
// no 16-bit types on Cray:
typedef short int_least16_t;
@ -246,6 +270,14 @@ namespace boost
typedef unsigned int uint32_t;
typedef unsigned int uint_least32_t;
typedef unsigned int uint_fast32_t;
# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
// Integers are 64 bits on the MTA / XMT
typedef __int32 int32_t;
typedef __int32 int_least32_t;
typedef __int32 int_fast32_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int32 uint_least32_t;
typedef unsigned __int32 uint_fast32_t;
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
@ -326,19 +358,16 @@ namespace boost
Macro definition section:
Define various INTXX_C macros only if
__STDC_CONSTANT_MACROS is defined.
Undefine the macros if __STDC_CONSTANT_MACROS is
not defined and the macros are (cf <cassert>).
Added 23rd September 2000 (John Maddock).
Modified 11th September 2001 to be excluded when
BOOST_HAS_STDINT_H is defined (John Maddock).
Modified 11th Dec 2009 to always define the
INT#_C macros if they're not already defined (John Maddock).
******************************************************/
#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H)
#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(INT8_C)
#include <limits.h>
# define BOOST__STDC_CONSTANT_MACROS_DEFINED
# if defined(BOOST_HAS_MS_INT64)
//
@ -390,27 +419,40 @@ BOOST_HAS_STDINT_H is defined (John Maddock).
// 64-bit types + intmax_t and uintmax_t ----------------------------------//
# if defined(BOOST_HAS_LONG_LONG) && \
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX))
# if defined(__hpux)
// HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \
(defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) || \
(defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U)
// HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \
(defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \
(defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
(defined(_LLONG_MAX) && _LLONG_MAX == 18446744073709551615ULL)
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# elif ULONG_MAX != 0xffffffff
# if ULONG_MAX == 18446744073709551615 // 2**64 - 1
# if ULONG_MAX == 18446744073709551615U // 2**64 - 1
# define INT64_C(value) value##L
# define UINT64_C(value) value##uL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# elif defined(BOOST_HAS_LONG_LONG)
// Usual macros not defined, work things out for ourselves:
# if(~0uLL == 18446744073709551615ULL)
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# ifdef BOOST_NO_INT64_T
@ -423,23 +465,7 @@ BOOST_HAS_STDINT_H is defined (John Maddock).
# endif // Borland/Microsoft specific width suffixes
#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H)
//
// undef all the macros:
//
# undef INT8_C
# undef INT16_C
# undef INT32_C
# undef INT64_C
# undef UINT8_C
# undef UINT16_C
# undef UINT32_C
# undef UINT64_C
# undef INTMAX_C
# undef UINTMAX_C
#endif // __STDC_CONSTANT_MACROS_DEFINED etc.
#endif // INT#_C macros.

View File

@ -54,11 +54,23 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
#if defined( __CLRCALL_PURE_OR_CDECL )
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long );
#else
extern "C" long __cdecl _InterlockedIncrement( long volatile * );
extern "C" long __cdecl _InterlockedDecrement( long volatile * );
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
extern "C" long __cdecl _InterlockedExchange( long volatile *, long);
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long);
extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
#endif
# pragma intrinsic( _InterlockedIncrement )
# pragma intrinsic( _InterlockedDecrement )

View File

@ -19,20 +19,66 @@
#if defined( BOOST_NO_TYPEID )
#include <boost/current_function.hpp>
#include <functional>
namespace boost
{
namespace detail
{
typedef void* sp_typeinfo;
class sp_typeinfo
{
private:
sp_typeinfo( sp_typeinfo const& );
sp_typeinfo& operator=( sp_typeinfo const& );
char const * name_;
public:
explicit sp_typeinfo( char const * name ): name_( name )
{
}
bool operator==( sp_typeinfo const& rhs ) const
{
return this == &rhs;
}
bool operator!=( sp_typeinfo const& rhs ) const
{
return this != &rhs;
}
bool before( sp_typeinfo const& rhs ) const
{
return std::less< sp_typeinfo const* >()( this, &rhs );
}
char const* name() const
{
return name_;
}
};
template<class T> struct sp_typeid_
{
static char v_;
static sp_typeinfo ti_;
static char const * name()
{
return BOOST_CURRENT_FUNCTION;
}
};
template<class T> char sp_typeid_< T >::v_;
template<class T> sp_typeinfo sp_typeid_< T >::ti_( sp_typeid_< T >::name() );
template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
{
};
template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
{
@ -50,7 +96,7 @@ template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
} // namespace boost
#define BOOST_SP_TYPEID(T) (&boost::detail::sp_typeid_<T>::v_)
#define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_)
#else

View File

@ -5,6 +5,12 @@
#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
#define UUID_316FDA946C0D11DEA9CBAE5255D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/error_info.hpp>
@ -24,4 +30,7 @@
#include <boost/exception_ptr.hpp>
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_7E83C166200811DE885E826156D89593
#define UUID_7E83C166200811DE885E826156D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
namespace
boost
@ -31,4 +37,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -6,9 +6,7 @@
#ifndef UUID_61531AB0680611DEADD5846855D89593
#define UUID_61531AB0680611DEADD5846855D89593
#include <boost/config.hpp>
#if defined(BOOST_MSVC)
#if defined(_MSC_VER)
#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
#elif defined(__GNUC__)
#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))

View File

@ -5,6 +5,12 @@
#ifndef UUID_CE6983AC753411DDA764247956D89593
#define UUID_CE6983AC753411DDA764247956D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <string>
@ -24,7 +30,6 @@ boost
protected:
virtual
~error_info_base() throw()
{
}
@ -64,4 +69,7 @@ boost
};
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,490 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under 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)
#ifndef UUID_618474C2DE1511DEB74A388C56D89593
#define UUID_618474C2DE1511DEB74A388C56D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/config.hpp>
#ifdef BOOST_NO_EXCEPTIONS
#error This header requires exception handling to be enabled.
#endif
#include <boost/exception/exception.hpp>
#include <boost/exception/info.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/detail/type_info.hpp>
#include <boost/shared_ptr.hpp>
#include <stdexcept>
#include <new>
#include <ios>
namespace
boost
{
#ifndef BOOST_NO_RTTI
typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
inline
std::string
to_string( original_exception_type const & x )
{
return x.value()->name();
}
#endif
class exception_ptr;
exception_ptr current_exception();
void rethrow_exception( exception_ptr const & );
class
exception_ptr
{
typedef bool exception_ptr::*unspecified_bool_type;
friend exception_ptr current_exception();
friend void rethrow_exception( exception_ptr const & );
shared_ptr<exception_detail::clone_base const> c_;
bool bad_alloc_;
struct
bad_alloc_tag
{
};
explicit
exception_ptr( bad_alloc_tag ):
bad_alloc_(true)
{
}
explicit
exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ):
c_(c),
bad_alloc_(false)
{
BOOST_ASSERT(c);
}
void
rethrow() const
{
BOOST_ASSERT(*this);
if( bad_alloc_ )
throw enable_current_exception(std::bad_alloc());
else
c_->rethrow();
}
bool
empty() const
{
return !bad_alloc_ && !c_;
}
public:
exception_ptr():
bad_alloc_(false)
{
}
~exception_ptr() throw()
{
}
operator unspecified_bool_type() const
{
return empty() ? 0 : &exception_ptr::bad_alloc_;
}
friend
bool
operator==( exception_ptr const & a, exception_ptr const & b )
{
return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_;
}
friend
bool
operator!=( exception_ptr const & a, exception_ptr const & b )
{
return !(a==b);
}
};
class
unknown_exception:
public exception,
public std::exception,
public exception_detail::clone_base
{
public:
unknown_exception()
{
}
explicit
unknown_exception( std::exception const & e )
{
add_original_type(e);
}
explicit
unknown_exception( boost::exception const & e ):
boost::exception(e)
{
add_original_type(e);
}
~unknown_exception() throw()
{
}
private:
exception_detail::clone_base const *
clone() const
{
return new unknown_exception(*this);
}
void
rethrow() const
{
throw*this;
}
template <class E>
void
add_original_type( E const & e )
{
#ifndef BOOST_NO_RTTI
(*this) << original_exception_type(&typeid(e));
#endif
}
};
namespace
exception_detail
{
template <class T>
class
current_exception_std_exception_wrapper:
public T,
public boost::exception,
public clone_base
{
public:
explicit
current_exception_std_exception_wrapper( T const & e1 ):
T(e1)
{
add_original_type(e1);
}
current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ):
T(e1),
boost::exception(e2)
{
add_original_type(e1);
}
~current_exception_std_exception_wrapper() throw()
{
}
private:
clone_base const *
clone() const
{
return new current_exception_std_exception_wrapper(*this);
}
void
rethrow() const
{
throw *this;
}
template <class E>
void
add_original_type( E const & e )
{
#ifndef BOOST_NO_RTTI
(*this) << original_exception_type(&typeid(e));
#endif
}
};
#ifdef BOOST_NO_RTTI
template <class T>
exception const *
get_boost_exception( T const * )
{
try
{
throw;
}
catch(
exception & x )
{
return &x;
}
catch(...)
{
return 0;
}
}
#else
template <class T>
exception const *
get_boost_exception( T const * x )
{
return dynamic_cast<exception const *>(x);
}
#endif
template <class T>
inline
shared_ptr<clone_base const>
current_exception_std_exception( T const & e1 )
{
if( boost::exception const * e2 = get_boost_exception(&e1) )
return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
else
return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1));
}
inline
shared_ptr<clone_base const>
current_exception_unknown_exception()
{
return shared_ptr<unknown_exception const>(new unknown_exception());
}
inline
shared_ptr<clone_base const>
current_exception_unknown_boost_exception( boost::exception const & e )
{
return shared_ptr<unknown_exception const>(new unknown_exception(e));
}
inline
shared_ptr<clone_base const>
current_exception_unknown_std_exception( std::exception const & e )
{
if( boost::exception const * be = get_boost_exception(&e) )
return current_exception_unknown_boost_exception(*be);
else
return shared_ptr<unknown_exception const>(new unknown_exception(e));
}
inline
shared_ptr<clone_base const>
current_exception_impl()
{
try
{
throw;
}
catch(
exception_detail::clone_base & e )
{
return shared_ptr<exception_detail::clone_base const>(e.clone());
}
catch(
std::domain_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::invalid_argument & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::length_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::out_of_range & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::logic_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::range_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::overflow_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::underflow_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::ios_base::failure & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::runtime_error & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::bad_alloc & e )
{
return exception_detail::current_exception_std_exception(e);
}
#ifndef BOOST_NO_TYPEID
catch(
std::bad_cast & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::bad_typeid & e )
{
return exception_detail::current_exception_std_exception(e);
}
#endif
catch(
std::bad_exception & e )
{
return exception_detail::current_exception_std_exception(e);
}
catch(
std::exception & e )
{
return exception_detail::current_exception_unknown_std_exception(e);
}
catch(
boost::exception & e )
{
return exception_detail::current_exception_unknown_boost_exception(e);
}
catch(
... )
{
return exception_detail::current_exception_unknown_exception();
}
}
}
inline
exception_ptr
current_exception()
{
try
{
return exception_ptr(exception_detail::current_exception_impl());
}
catch(
std::bad_alloc & )
{
}
catch(
... )
{
try
{
return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception()));
}
catch(
std::bad_alloc & )
{
}
catch(
... )
{
BOOST_ASSERT(0);
}
}
return exception_ptr(exception_ptr::bad_alloc_tag());
}
template <class T>
inline
exception_ptr
copy_exception( T const & e )
{
try
{
throw enable_current_exception(e);
}
catch(
... )
{
return current_exception();
}
}
inline
void
rethrow_exception( exception_ptr const & p )
{
p.rethrow();
}
inline
std::string
diagnostic_information( exception_ptr const & p )
{
if( p )
try
{
rethrow_exception(p);
}
catch(
... )
{
return current_exception_diagnostic_information();
}
return "<empty>";
}
inline
std::string
to_string( exception_ptr const & p )
{
std::string s='\n'+diagnostic_information(p);
std::string padding(" ");
std::string r;
bool f=false;
for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i )
{
if( f )
r+=padding;
char c=*i;
r+=c;
f=(c=='\n');
}
return r;
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_898984B4076411DD973EDFA055D89593
#define UUID_898984B4076411DD973EDFA055D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <ostream>
@ -35,4 +41,7 @@ boost
};
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,12 +5,19 @@
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
#define UUID_6F463AC838DF11DDA3E6909F56D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/detail/type_info.hpp>
#include <iomanip>
#include <ios>
#include <string>
#include <sstream>
#include <cstdlib>
namespace
boost
@ -21,11 +28,11 @@ boost
template <class T>
inline
std::string
object_hex_dump( T const & x, size_t max_size=16 )
object_hex_dump( T const & x, std::size_t max_size=16 )
{
std::ostringstream s;
s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: ";
size_t n=sizeof(T)>max_size?max_size:sizeof(T);
std::size_t n=sizeof(T)>max_size?max_size:sizeof(T);
s.fill('0');
s.width(2);
unsigned char const * b=reinterpret_cast<unsigned char const *>(&x);
@ -37,4 +44,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,9 +5,16 @@
#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
#define UUID_C3E1741C754311DDB2834CCA55D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/current_function.hpp>
#include <boost/config.hpp>
namespace
boost
@ -39,92 +46,34 @@ boost
namespace
exception_detail
{
#ifdef BOOST_NO_TYPEID
struct
type_info_
{
detail::sp_typeinfo type_;
char const * name_;
explicit
type_info_( detail::sp_typeinfo type, char const * name ):
type_(type),
name_(name)
{
}
friend
bool
operator==( type_info_ const & a, type_info_ const & b )
{
return a.type_==b.type_;
}
friend
bool
operator<( type_info_ const & a, type_info_ const & b )
{
return a.type_<b.type_;
}
char const *
name() const
{
return name_;
}
};
#else
struct
type_info_
{
detail::sp_typeinfo const * type_;
detail::sp_typeinfo const & type_;
explicit
type_info_( detail::sp_typeinfo const & type ):
type_(&type)
type_(type)
{
}
type_info_( detail::sp_typeinfo const & type, char const * ):
type_(&type)
{
}
friend
bool
operator==( type_info_ const & a, type_info_ const & b )
{
return (*a.type_)==(*b.type_);
}
friend
bool
operator<( type_info_ const & a, type_info_ const & b )
{
return 0!=(a.type_->before(*b.type_));
}
char const *
name() const
{
return type_->name();
return 0!=(a.type_.before(b.type_));
}
};
#endif
inline
bool
operator!=( type_info_ const & a, type_info_ const & b )
{
return !(a==b);
}
}
}
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name<T>())
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
#ifndef BOOST_NO_RTTI
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,42 +5,79 @@
#ifndef UUID_0552D49838DD11DD90146B8956D89593
#define UUID_0552D49838DD11DD90146B8956D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/config.hpp>
#include <boost/exception/get_error_info.hpp>
#include <boost/exception/detail/exception_ptr_base.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/config.hpp>
#include <exception>
#include <sstream>
#include <string>
#ifndef BOOST_NO_EXCEPTIONS
#include <boost/exception/current_exception_cast.hpp>
namespace
boost
{
namespace
exception_detail
{
std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool );
}
inline
std::string
current_exception_diagnostic_information()
{
boost::exception const * be=current_exception_cast<boost::exception const>();
std::exception const * se=current_exception_cast<std::exception const>();
if( be || se )
return exception_detail::diagnostic_information_impl(be,se,true);
else
return "No diagnostic information available.";
}
}
#endif
namespace
boost
{
namespace
exception_detail
{
template <class T>
struct
enable_boost_exception_overload
inline
exception const *
get_boost_exception( exception const * e )
{
struct yes { char q[100]; };
typedef char no;
static yes check(exception const *);
static no check(...);
enum e { value=sizeof(check((T*)0))==sizeof(yes) };
};
return e;
}
template <class T>
struct
enable_std_exception_overload
inline
exception const *
get_boost_exception( ... )
{
struct yes { char q[100]; };
typedef char no;
static yes check(std::exception const *);
static no check(...);
enum e { value = !enable_boost_exception_overload<T>::value && sizeof(check((T*)0))==sizeof(yes) };
};
return 0;
}
inline
std::exception const *
get_std_exception( std::exception const * e )
{
return e;
}
inline
std::exception const *
get_std_exception( ... )
{
return 0;
}
inline
char const *
@ -65,12 +102,13 @@ boost
std::string
diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
{
BOOST_ASSERT(be||se);
if( !be && !se )
return "Unknown exception.";
#ifndef BOOST_NO_RTTI
if( !se )
se = dynamic_cast<std::exception const *>(be);
if( !be )
be = dynamic_cast<boost::exception const *>(se);
be=dynamic_cast<boost::exception const *>(se);
if( !se )
se=dynamic_cast<std::exception const *>(be);
#endif
char const * wh=0;
if( with_what && se )
@ -97,7 +135,7 @@ boost
}
#ifndef BOOST_NO_RTTI
tmp << std::string("Dynamic exception type: ") <<
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n';
#endif
if( with_what && se )
tmp << "std::exception::what: " << wh << '\n';
@ -110,19 +148,10 @@ boost
}
template <class T>
inline
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
std::string
diagnostic_information( T const & e )
{
return exception_detail::diagnostic_information_impl(&e,0,true);
}
template <class T>
inline
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
diagnostic_information( T const & e )
{
return exception_detail::diagnostic_information_impl(0,&e,true);
return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true);
}
inline
@ -147,40 +176,7 @@ boost
}
}
#ifndef BOOST_NO_EXCEPTIONS
#include <boost/exception/current_exception_cast.hpp>
namespace
boost
{
inline
std::string
current_exception_diagnostic_information()
{
boost::exception const * be=current_exception_cast<boost::exception const>();
std::exception const * se=current_exception_cast<std::exception const>();
if( be || se )
return exception_detail::diagnostic_information_impl(be,se,true);
else
return "No diagnostic information available.";
}
inline
std::string
diagnostic_information( exception_detail::exception_ptr_base const & p )
{
if( !p._empty() )
try
{
p._rethrow();
}
catch(
... )
{
return current_exception_diagnostic_information();
}
return "<empty>";
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
#define UUID_F0EE17BE6C1211DE87FF459155D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include "boost/exception/info.hpp"
#include <errno.h>
@ -32,4 +38,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,17 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under 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)
#ifndef UUID_45CC9A82B77511DEB330FC4956D89593
#define UUID_45CC9A82B77511DEB330FC4956D89593
namespace
boost
{
template <class Tag,class T> class error_info;
class exception_ptr;
typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception;
}
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
#define UUID_274DA366004E11DCB1DDFE2E56D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
namespace
boost
@ -129,6 +135,15 @@ boost
template <class E,class Tag,class T>
E const & operator<<( E const &, error_info<Tag,T> const & );
template <class E>
E const & operator<<( E const &, throw_function const & );
template <class E>
E const & operator<<( E const &, throw_file const & );
template <class E>
E const & operator<<( E const &, throw_line const & );
class exception;
template <class>
@ -151,7 +166,6 @@ boost
protected:
virtual
~error_info_container() throw()
{
}
@ -202,34 +216,19 @@ boost
#endif
;
#if defined(__MWERKS__) && __MWERKS__<=0x3207
public:
#else
private:
template <class E>
friend
E const &
operator<<( E const & x, throw_function const & y )
{
x.throw_function_=y.v_;
return x;
}
friend E const & operator<<( E const &, throw_function const & );
template <class E>
friend
E const &
operator<<( E const & x, throw_file const & y )
{
x.throw_file_=y.v_;
return x;
}
friend E const & operator<<( E const &, throw_file const & );
template <class E>
friend
E const &
operator<<( E const & x, throw_line const & y )
{
x.throw_line_=y.v_;
return x;
}
friend E const & operator<<( E const &, throw_line const & );
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
@ -241,7 +240,7 @@ boost
friend struct exception_detail::get_info<throw_function>;
friend struct exception_detail::get_info<throw_file>;
friend struct exception_detail::get_info<throw_line>;
#endif
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
mutable char const * throw_function_;
mutable char const * throw_file_;
@ -254,6 +253,30 @@ boost
{
}
template <class E>
E const &
operator<<( E const & x, throw_function const & y )
{
x.throw_function_=y.v_;
return x;
}
template <class E>
E const &
operator<<( E const & x, throw_file const & y )
{
x.throw_file_=y.v_;
return x;
}
template <class E>
E const &
operator<<( E const & x, throw_line const & y )
{
x.throw_line_=y.v_;
return x;
}
////////////////////////////////////////////////////////////////////////
namespace
@ -303,7 +326,7 @@ boost
struct
enable_error_info_return_type
{
typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch((T*)0))>::type type;
};
}
@ -393,4 +416,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_1A590226753311DD9E4CCF6156D89593
#define UUID_1A590226753311DD9E4CCF6156D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/exception.hpp>
#include <boost/exception/detail/error_info_impl.hpp>
@ -118,4 +124,7 @@ boost
#endif
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,11 +5,18 @@
#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
#define UUID_8D22C4CA9CC811DCAA9133D256D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/exception.hpp>
#include <boost/exception/to_string_stub.hpp>
#include <boost/exception/detail/error_info_impl.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/config.hpp>
#include <map>
namespace
@ -90,7 +97,7 @@ boost
{
shared_ptr<error_info_base> const & p = i->second;
#ifndef BOOST_NO_RTTI
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
#endif
return p;
}
@ -146,12 +153,15 @@ boost
{
typedef error_info<Tag,T> error_info_tag_t;
shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
exception_detail::error_info_container * c;
if( !(c=x.data_.get()) )
exception_detail::error_info_container * c=x.data_.get();
if( !c )
x.data_.adopt(c=new exception_detail::error_info_container_impl);
c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
return x;
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_63EE924290FB11DC87BB856555D89593
#define UUID_63EE924290FB11DC87BB856555D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/info.hpp>
#include <boost/tuple/tuple.hpp>
@ -64,4 +70,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_7E48761AD92811DC9011477D56D89593
#define UUID_7E48761AD92811DC9011477D56D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/utility/enable_if.hpp>
#include <boost/exception/detail/is_output_streamable.hpp>
@ -71,4 +77,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -5,6 +5,12 @@
#ifndef UUID_E788439ED9F011DCB181F25B55D89593
#define UUID_E788439ED9F011DCB181F25B55D89593
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/to_string.hpp>
#include <boost/exception/detail/object_hex_dump.hpp>
@ -97,4 +103,7 @@ boost
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif

View File

@ -15,8 +15,8 @@
#include <string>
#include <memory>
#include <new>
#include <typeinfo>
#include <boost/config.hpp>
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/assert.hpp>
#include <boost/integer.hpp>
#include <boost/type_traits/has_trivial_copy.hpp>
@ -54,7 +54,9 @@
// Borrowed from Boost.Python library: determines the cases where we
// need to use std::type_info::name to compare instead of operator==.
# if (defined(__GNUC__) && __GNUC__ >= 3) \
#if defined( BOOST_NO_TYPEID )
# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y))
#elif (defined(__GNUC__) && __GNUC__ >= 3) \
|| defined(_AIX) \
|| ( defined(__sgi) && defined(__host_mips))
# include <cstring>
@ -103,7 +105,7 @@ namespace boost {
// For pointers to std::type_info objects
struct type_t {
// (get_functor_type_tag, check_functor_type_tag).
const BOOST_FUNCTION_STD_NS::type_info* type;
const detail::sp_typeinfo* type;
// Whether the type is const-qualified.
bool const_qualified;
@ -215,12 +217,12 @@ namespace boost {
case check_functor_type_tag:
{
const BOOST_FUNCTION_STD_NS::type_info& check_type
const detail::sp_typeinfo& check_type
= *out_buffer.type.type;
// Check whether we have the same type. We can add
// cv-qualifiers, but we can't take them away.
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F))
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(F))
&& (!in_buffer.obj_ref.is_const_qualified
|| out_buffer.type.const_qualified)
&& (!in_buffer.obj_ref.is_volatile_qualified
@ -232,7 +234,7 @@ namespace boost {
return;
case get_functor_type_tag:
out_buffer.type.type = &typeid(F);
out_buffer.type.type = &BOOST_SP_TYPEID(F);
out_buffer.type.const_qualified = in_buffer.obj_ref.is_const_qualified;
out_buffer.type.volatile_qualified = in_buffer.obj_ref.is_volatile_qualified;
return;
@ -292,14 +294,14 @@ namespace boost {
} else if (op == destroy_functor_tag)
out_buffer.func_ptr = 0;
else if (op == check_functor_type_tag) {
const BOOST_FUNCTION_STD_NS::type_info& check_type
const detail::sp_typeinfo& check_type
= *out_buffer.type.type;
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
out_buffer.obj_ptr = &in_buffer.func_ptr;
else
out_buffer.obj_ptr = 0;
} else /* op == get_functor_type_tag */ {
out_buffer.type.type = &typeid(Functor);
out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
out_buffer.type.const_qualified = false;
out_buffer.type.volatile_qualified = false;
}
@ -322,14 +324,14 @@ namespace boost {
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();
} else if (op == check_functor_type_tag) {
const BOOST_FUNCTION_STD_NS::type_info& check_type
const detail::sp_typeinfo& check_type
= *out_buffer.type.type;
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
out_buffer.obj_ptr = &in_buffer.data;
else
out_buffer.obj_ptr = 0;
} else /* op == get_functor_type_tag */ {
out_buffer.type.type = &typeid(Functor);
out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
out_buffer.type.const_qualified = false;
out_buffer.type.volatile_qualified = false;
}
@ -381,14 +383,14 @@ namespace boost {
delete f;
out_buffer.obj_ptr = 0;
} else if (op == check_functor_type_tag) {
const BOOST_FUNCTION_STD_NS::type_info& check_type
const detail::sp_typeinfo& check_type
= *out_buffer.type.type;
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
out_buffer.obj_ptr = in_buffer.obj_ptr;
else
out_buffer.obj_ptr = 0;
} else /* op == get_functor_type_tag */ {
out_buffer.type.type = &typeid(Functor);
out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
out_buffer.type.const_qualified = false;
out_buffer.type.volatile_qualified = false;
}
@ -423,7 +425,7 @@ namespace boost {
typedef typename get_function_tag<functor_type>::type tag_type;
switch (op) {
case get_functor_type_tag:
out_buffer.type.type = &typeid(functor_type);
out_buffer.type.type = &BOOST_SP_TYPEID(functor_type);
out_buffer.type.const_qualified = false;
out_buffer.type.volatile_qualified = false;
return;
@ -492,14 +494,14 @@ namespace boost {
wrapper_allocator.deallocate(victim,1);
out_buffer.obj_ptr = 0;
} else if (op == check_functor_type_tag) {
const BOOST_FUNCTION_STD_NS::type_info& check_type
const detail::sp_typeinfo& check_type
= *out_buffer.type.type;
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
out_buffer.obj_ptr = in_buffer.obj_ptr;
else
out_buffer.obj_ptr = 0;
} else /* op == get_functor_type_tag */ {
out_buffer.type.type = &typeid(Functor);
out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
out_buffer.type.const_qualified = false;
out_buffer.type.volatile_qualified = false;
}
@ -526,7 +528,7 @@ namespace boost {
typedef typename get_function_tag<functor_type>::type tag_type;
switch (op) {
case get_functor_type_tag:
out_buffer.type.type = &typeid(functor_type);
out_buffer.type.type = &BOOST_SP_TYPEID(functor_type);
out_buffer.type.const_qualified = false;
out_buffer.type.volatile_qualified = false;
return;
@ -627,11 +629,11 @@ public:
/** Determine if the function is empty (i.e., has no target). */
bool empty() const { return !vtable; }
/** Retrieve the type of the stored function object, or typeid(void)
/** Retrieve the type of the stored function object, or BOOST_SP_TYPEID(void)
if this is empty. */
const BOOST_FUNCTION_STD_NS::type_info& target_type() const
const detail::sp_typeinfo& target_type() const
{
if (!vtable) return typeid(void);
if (!vtable) return BOOST_SP_TYPEID(void);
detail::function::function_buffer type;
get_vtable()->manager(functor, type, detail::function::get_functor_type_tag);
@ -644,7 +646,7 @@ public:
if (!vtable) return 0;
detail::function::function_buffer type_result;
type_result.type.type = &typeid(Functor);
type_result.type.type = &BOOST_SP_TYPEID(Functor);
type_result.type.const_qualified = is_const<Functor>::value;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
get_vtable()->manager(functor, type_result,
@ -662,7 +664,7 @@ public:
if (!vtable) return 0;
detail::function::function_buffer type_result;
type_result.type.type = &typeid(Functor);
type_result.type.type = &BOOST_SP_TYPEID(Functor);
type_result.type.const_qualified = true;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
get_vtable()->manager(functor, type_result,

View File

@ -84,7 +84,7 @@ namespace boost {
// the boost namespace they'll always be preferable to any other function
// (since the arguments are built in types, ADL can't be used).
namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {
namespace boost_hash_detect_float_functions {
template <class Float> boost::hash_detail::not_found ldexp(Float, int);
template <class Float> boost::hash_detail::not_found frexp(Float, int*);
}
@ -103,7 +103,7 @@ namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {
// happen mainly when there's a template in the same namesapce.
#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \
namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { \
namespace boost_hash_detect_float_functions { \
template <class Float> \
boost::hash_detail::not_found c99_func(Float, type2); \
} \
@ -112,7 +112,7 @@ namespace boost { \
namespace hash_detail { \
namespace c99_func##_detect { \
using namespace std; \
using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS; \
using namespace boost_hash_detect_float_functions; \
\
struct check { \
static type1 x; \

View File

@ -20,7 +20,8 @@
#include <boost/type_traits/is_pointer.hpp>
#endif
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
#if BOOST_WORKAROUND(__GNUC__, < 3) \
&& !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
#define BOOST_HASH_CHAR_TRAITS string_char_traits
#else
#define BOOST_HASH_CHAR_TRAITS char_traits
@ -67,7 +68,8 @@ namespace boost
std::size_t hash_value(long double v);
template <class Ch, class A>
std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
std::size_t hash_value(
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
// Implementation
@ -197,6 +199,16 @@ namespace boost
return x + (x >> 3);
}
#if defined(BOOST_MSVC)
#pragma warning(push)
#if BOOST_MSVC <= 1400
#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to
// 'unsigned int', possible loss of data
// A misguided attempt to detect 64-bit
// incompatability.
#endif
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T>
inline void hash_combine(std::size_t& seed, T& v)
@ -209,6 +221,10 @@ namespace boost
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
template <class It>
inline std::size_t hash_range(It first, It last)
{
@ -272,7 +288,8 @@ namespace boost
#endif
template <class Ch, class A>
inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
inline std::size_t hash_value(
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
{
return hash_range(v.begin(), v.end());
}
@ -297,8 +314,8 @@ namespace boost
//
// Define the specializations required by the standard. The general purpose
// boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS
// is not defined.
// boost::hash is defined later in extensions.hpp if
// BOOST_HASH_NO_EXTENSIONS is not defined.
// BOOST_HASH_SPECIALIZE - define a specialization for a type which is
// passed by copy.

View File

@ -17,8 +17,21 @@
#include <boost/integer_fwd.hpp> // self include
#include <boost/integer_traits.hpp> // for boost::integer_traits
#include <boost/limits.hpp> // for std::numeric_limits
#include <boost/integer_traits.hpp> // for boost::::boost::integer_traits
#include <boost/limits.hpp> // for ::std::numeric_limits
#include <boost/cstdint.hpp> // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T
//
// We simply cannot include this header on gcc without getting copious warnings of the kind:
//
// boost/integer.hpp:77:30: warning: use of C99 long long integer constant
//
// And yet there is no other reasonable implementation, so we declare this a system header
// to suppress these warnings.
//
#if defined(__GNUC__) && (__GNUC__ >= 4)
#pragma GCC system_header
#endif
namespace boost
{
@ -28,7 +41,13 @@ namespace boost
// fast integers from least integers
// int_fast_t<> works correctly for unsigned too, in spite of the name.
template< typename LeastInt >
struct int_fast_t { typedef LeastInt fast; }; // imps may specialize
struct int_fast_t
{
typedef LeastInt fast;
typedef fast type;
}; // imps may specialize
namespace detail{
// convert category to type
template< int Category > struct int_least_helper {}; // default is empty
@ -36,89 +55,196 @@ namespace boost
// specializatons: 1=long, 2=int, 3=short, 4=signed char,
// 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char
// no specializations for 0 and 5: requests for a type > long are in error
template<> struct int_least_helper<1> { typedef long least; };
template<> struct int_least_helper<2> { typedef int least; };
template<> struct int_least_helper<3> { typedef short least; };
template<> struct int_least_helper<4> { typedef signed char least; };
template<> struct int_least_helper<6> { typedef unsigned long least; };
template<> struct int_least_helper<7> { typedef unsigned int least; };
template<> struct int_least_helper<8> { typedef unsigned short least; };
template<> struct int_least_helper<9> { typedef unsigned char least; };
#ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<1> { typedef boost::long_long_type least; };
#endif
template<> struct int_least_helper<2> { typedef long least; };
template<> struct int_least_helper<3> { typedef int least; };
template<> struct int_least_helper<4> { typedef short least; };
template<> struct int_least_helper<5> { typedef signed char least; };
#ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; };
#endif
template<> struct int_least_helper<7> { typedef unsigned long least; };
template<> struct int_least_helper<8> { typedef unsigned int least; };
template<> struct int_least_helper<9> { typedef unsigned short least; };
template<> struct int_least_helper<10> { typedef unsigned char least; };
template <int Bits>
struct exact_signed_base_helper{};
template <int Bits>
struct exact_unsigned_base_helper{};
template <> struct exact_signed_base_helper<sizeof(signed char)* CHAR_BIT> { typedef signed char exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned char)* CHAR_BIT> { typedef unsigned char exact; };
#if USHRT_MAX != UCHAR_MAX
template <> struct exact_signed_base_helper<sizeof(short)* CHAR_BIT> { typedef short exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned short)* CHAR_BIT> { typedef unsigned short exact; };
#endif
#if UINT_MAX != USHRT_MAX
template <> struct exact_signed_base_helper<sizeof(int)* CHAR_BIT> { typedef int exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned int)* CHAR_BIT> { typedef unsigned int exact; };
#endif
#if ULONG_MAX != UINT_MAX
template <> struct exact_signed_base_helper<sizeof(long)* CHAR_BIT> { typedef long exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned long)* CHAR_BIT> { typedef unsigned long exact; };
#endif
#if defined(BOOST_HAS_LONG_LONG) &&\
((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\
(defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\
(defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\
(defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX)))
template <> struct exact_signed_base_helper<sizeof(boost::long_long_type)* CHAR_BIT> { typedef boost::long_long_type exact; };
template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
#endif
} // namespace detail
// integer templates specifying number of bits ---------------------------//
// signed
template< int Bits > // bits (including sign) required
struct int_t
struct int_t : public detail::exact_signed_base_helper<Bits>
{
typedef typename int_least_helper
typedef typename detail::int_least_helper
<
(Bits-1 <= std::numeric_limits<long>::digits) +
(Bits-1 <= std::numeric_limits<int>::digits) +
(Bits-1 <= std::numeric_limits<short>::digits) +
(Bits-1 <= std::numeric_limits<signed char>::digits)
#ifdef BOOST_HAS_LONG_LONG
(Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
#else
1 +
#endif
(Bits-1 <= ::std::numeric_limits<long>::digits) +
(Bits-1 <= ::std::numeric_limits<int>::digits) +
(Bits-1 <= ::std::numeric_limits<short>::digits) +
(Bits-1 <= ::std::numeric_limits<signed char>::digits)
>::least least;
typedef typename int_fast_t<least>::fast fast;
typedef typename int_fast_t<least>::type fast;
};
// unsigned
template< int Bits > // bits required
struct uint_t
struct uint_t : public detail::exact_unsigned_base_helper<Bits>
{
typedef typename int_least_helper
#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T)
// It's really not clear why this workaround should be needed... shrug I guess! JM
BOOST_STATIC_CONSTANT(int, s =
6 +
(Bits <= ::std::numeric_limits<unsigned long>::digits) +
(Bits <= ::std::numeric_limits<unsigned int>::digits) +
(Bits <= ::std::numeric_limits<unsigned short>::digits) +
(Bits <= ::std::numeric_limits<unsigned char>::digits));
typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least;
#else
typedef typename detail::int_least_helper
<
5 +
(Bits <= std::numeric_limits<unsigned long>::digits) +
(Bits <= std::numeric_limits<unsigned int>::digits) +
(Bits <= std::numeric_limits<unsigned short>::digits) +
(Bits <= std::numeric_limits<unsigned char>::digits)
#ifdef BOOST_HAS_LONG_LONG
(Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
#else
1 +
#endif
(Bits <= ::std::numeric_limits<unsigned long>::digits) +
(Bits <= ::std::numeric_limits<unsigned int>::digits) +
(Bits <= ::std::numeric_limits<unsigned short>::digits) +
(Bits <= ::std::numeric_limits<unsigned char>::digits)
>::least least;
typedef typename int_fast_t<least>::fast fast;
#endif
typedef typename int_fast_t<least>::type fast;
// int_fast_t<> works correctly for unsigned too, in spite of the name.
};
// integer templates specifying extreme value ----------------------------//
// signed
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MaxValue > // maximum value to require support
#else
template< long MaxValue > // maximum value to require support
#endif
struct int_max_value_t
{
typedef typename int_least_helper
typedef typename detail::int_least_helper
<
(MaxValue <= integer_traits<long>::const_max) +
(MaxValue <= integer_traits<int>::const_max) +
(MaxValue <= integer_traits<short>::const_max) +
(MaxValue <= integer_traits<signed char>::const_max)
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MaxValue <= ::boost::integer_traits<boost::long_long_type>::const_max) +
#else
1 +
#endif
(MaxValue <= ::boost::integer_traits<long>::const_max) +
(MaxValue <= ::boost::integer_traits<int>::const_max) +
(MaxValue <= ::boost::integer_traits<short>::const_max) +
(MaxValue <= ::boost::integer_traits<signed char>::const_max)
>::least least;
typedef typename int_fast_t<least>::fast fast;
typedef typename int_fast_t<least>::type fast;
};
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MinValue > // minimum value to require support
#else
template< long MinValue > // minimum value to require support
#endif
struct int_min_value_t
{
typedef typename int_least_helper
typedef typename detail::int_least_helper
<
(MinValue >= integer_traits<long>::const_min) +
(MinValue >= integer_traits<int>::const_min) +
(MinValue >= integer_traits<short>::const_min) +
(MinValue >= integer_traits<signed char>::const_min)
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MinValue >= ::boost::integer_traits<boost::long_long_type>::const_min) +
#else
1 +
#endif
(MinValue >= ::boost::integer_traits<long>::const_min) +
(MinValue >= ::boost::integer_traits<int>::const_min) +
(MinValue >= ::boost::integer_traits<short>::const_min) +
(MinValue >= ::boost::integer_traits<signed char>::const_min)
>::least least;
typedef typename int_fast_t<least>::fast fast;
typedef typename int_fast_t<least>::type fast;
};
// unsigned
template< unsigned long Value > // maximum value to require support
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::ulong_long_type MaxValue > // minimum value to require support
#else
template< unsigned long MaxValue > // minimum value to require support
#endif
struct uint_value_t
{
typedef typename int_least_helper
#if (defined(__BORLANDC__) || defined(__CODEGEAR__))
// It's really not clear why this workaround should be needed... shrug I guess! JM
#if defined(BOOST_NO_INTEGRAL_INT64_T)
BOOST_STATIC_CONSTANT(unsigned, which =
6 +
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
#else // BOOST_NO_INTEGRAL_INT64_T
BOOST_STATIC_CONSTANT(unsigned, which =
5 +
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
#endif // BOOST_NO_INTEGRAL_INT64_T
#else
typedef typename detail::int_least_helper
<
5 +
(Value <= integer_traits<unsigned long>::const_max) +
(Value <= integer_traits<unsigned int>::const_max) +
(Value <= integer_traits<unsigned short>::const_max) +
(Value <= integer_traits<unsigned char>::const_max)
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
#else
1 +
#endif
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max)
>::least least;
typedef typename int_fast_t<least>::fast fast;
#endif
typedef typename int_fast_t<least>::type fast;
};

View File

@ -70,6 +70,11 @@ struct low_bits_mask_t
BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \
}
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4245) // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch
#endif
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char );
#if USHRT_MAX > UCHAR_MAX
@ -84,6 +89,10 @@ BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int );
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long );
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#undef BOOST_LOW_BITS_MASK_SPECIALIZE

View File

@ -16,7 +16,7 @@
#ifndef BOOST_INTEGER_STATIC_LOG2_HPP
#define BOOST_INTEGER_STATIC_LOG2_HPP
#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
#include "boost/integer_fwd.hpp" // for boost::intmax_t
namespace boost {
@ -41,9 +41,8 @@ namespace boost {
// terminates with x = 1 and n = 0 (see the algorithm's
// invariant).
typedef unsigned long argument_type;
typedef int result_type;
typedef boost::static_log2_argument_type argument_type;
typedef boost::static_log2_result_type result_type;
template <result_type n>
struct choose_initial_n {
@ -107,10 +106,6 @@ namespace boost {
// static_log2<x>
// ----------------------------------------
typedef detail::static_log2_impl::argument_type static_log2_argument_type;
typedef detail::static_log2_impl::result_type static_log2_result_type;
template <static_log2_argument_type x>
struct static_log2 {

View File

@ -12,39 +12,35 @@
#include <boost/integer_fwd.hpp> // self include
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
namespace boost
{
// Compile-time extrema class declarations ---------------------------------//
// Get the minimum or maximum of two values, signed or unsigned.
template < long Value1, long Value2 >
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_min
{
BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 > Value2) ? Value2 : Value1 );
};
template < long Value1, long Value2 >
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_max
{
BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 < Value2) ? Value2 : Value1 );
};
template < unsigned long Value1, unsigned long Value2 >
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_min
{
BOOST_STATIC_CONSTANT( unsigned long, value
BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
= (Value1 > Value2) ? Value2 : Value1 );
};
template < unsigned long Value1, unsigned long Value2 >
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_max
{
BOOST_STATIC_CONSTANT( unsigned long, value
BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
= (Value1 < Value2) ? Value2 : Value1 );
};

View File

@ -14,11 +14,23 @@
#include <boost/config.hpp> // for BOOST_NO_INTRINSIC_WCHAR_T
#include <boost/limits.hpp> // for std::numeric_limits
#include <boost/cstdint.hpp> // For intmax_t
namespace boost
{
#ifdef BOOST_NO_INTEGRAL_INT64_T
typedef unsigned long static_log2_argument_type;
typedef int static_log2_result_type;
typedef long static_min_max_signed_type;
typedef unsigned long static_min_max_unsigned_type;
#else
typedef boost::uintmax_t static_min_max_unsigned_type;
typedef boost::intmax_t static_min_max_signed_type;
typedef boost::uintmax_t static_log2_argument_type;
typedef int static_log2_result_type;
#endif
// From <boost/cstdint.hpp> ------------------------------------------------//
@ -65,7 +77,7 @@ template < >
template < >
class integer_traits< unsigned long >;
#ifdef ULLONG_MAX
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64))
template < >
class integer_traits< ::boost::long_long_type>;
@ -85,13 +97,25 @@ template< int Bits >
template< int Bits >
struct uint_t;
template< long MaxValue >
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MaxValue > // maximum value to require support
#else
template< long MaxValue > // maximum value to require support
#endif
struct int_max_value_t;
template< long MinValue >
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MinValue > // minimum value to require support
#else
template< long MinValue > // minimum value to require support
#endif
struct int_min_value_t;
template< unsigned long Value >
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::ulong_long_type MaxValue > // maximum value to require support
#else
template< unsigned long MaxValue > // maximum value to require support
#endif
struct uint_value_t;
@ -124,28 +148,26 @@ template < >
// From <boost/integer/static_log2.hpp> ------------------------------------//
template < unsigned long Value >
template <static_log2_argument_type Value >
struct static_log2;
template < >
struct static_log2< 0ul >;
template <> struct static_log2<0u>;
// From <boost/integer/static_min_max.hpp> ---------------------------------//
template < long Value1, long Value2 >
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_min;
template < long Value1, long Value2 >
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_max;
template < unsigned long Value1, unsigned long Value2 >
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_min;
template < unsigned long Value1, unsigned long Value2 >
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_max;
} // namespace boost

View File

@ -5,7 +5,7 @@
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* $Id: integer_traits.hpp 32576 2006-02-05 10:19:42Z johnmaddock $
* $Id: integer_traits.hpp 58381 2009-12-14 18:14:48Z johnmaddock $
*
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
*/
@ -27,6 +27,17 @@
#include <wchar.h>
#endif
//
// We simply cannot include this header on gcc without getting copious warnings of the kind:
//
// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant
//
// And yet there is no other reasonable implementation, so we declare this a system header
// to suppress these warnings.
//
#if defined(__GNUC__) && (__GNUC__ >= 4)
#pragma GCC system_header
#endif
namespace boost {
template<class T>
@ -225,6 +236,20 @@ class integer_traits< ::boost::ulong_long_type>
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL>
{ };
#elif defined(BOOST_HAS_MS_INT64)
template<>
class integer_traits< __int64>
: public std::numeric_limits< __int64>,
public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX>
{ };
template<>
class integer_traits< unsigned __int64>
: public std::numeric_limits< unsigned __int64>,
public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX>
{ };
#endif
#endif

View File

@ -11,7 +11,7 @@
//
// Defines enum boost::memory_order per the C++0x working draft
//
// Copyright (c) 2008 Peter Dimov
// Copyright (c) 2008, 2009 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
@ -21,13 +21,31 @@
namespace boost
{
//
// Enum values are chosen so that code that needs to insert
// a trailing fence for acquire semantics can use a single
// test such as:
//
// if( mo & memory_order_acquire ) { ...fence... }
//
// For leading fences one can use:
//
// if( mo & memory_order_release ) { ...fence... }
//
// Architectures such as Alpha that need a fence on consume
// can use:
//
// if( mo & ( memory_order_acquire | memory_order_consume ) ) { ...fence... }
//
enum memory_order
{
memory_order_relaxed = 0,
memory_order_acquire = 1,
memory_order_release = 2,
memory_order_acq_rel = 3, // acquire | release
memory_order_seq_cst = 7 // acq_rel | 4
memory_order_seq_cst = 7, // acq_rel | 4
memory_order_consume = 8
};
} // namespace boost

View File

@ -747,6 +747,46 @@ struct RegexConcept
};
#ifndef BOOST_REGEX_TEST_STD
template <class M>
struct functor1
{
typedef typename M::char_type char_type;
const char_type* operator()(const M&)
{
static const char_type c = static_cast<char_type>(0);
return &c;
}
};
template <class M>
struct functor1b
{
typedef typename M::char_type char_type;
std::vector<char_type> operator()(const M&)
{
static const std::vector<char_type> c;
return c;
}
};
template <class M>
struct functor2
{
template <class O>
O operator()(const M& /*m*/, O i)
{
return i;
}
};
template <class M>
struct functor3
{
template <class O>
O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)
{
return i;
}
};
//
// BoostRegexConcept:
// Test every interface in the Boost implementation:
@ -764,6 +804,7 @@ struct BoostRegexConcept
typedef std::basic_string<value_type> string_type;
typedef typename Regex::const_iterator const_iterator;
typedef bidirectional_iterator_archetype<value_type> BidiIterator;
typedef output_iterator_archetype<value_type> OutputIterator;
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
@ -884,6 +925,58 @@ struct BoostRegexConcept
m_stream << m_sub;
m_stream << m_cresults;
#endif
//
// Extended formatting with a functor:
//
regex_constants::match_flag_type f = regex_constants::match_default;
OutputIterator out = static_object<OutputIterator>::get();
functor3<match_results_type> func3;
out = regex_format(out, m_cresults, func3, f);
out = regex_format(out, m_cresults, func3);
functor2<match_results_type> func2;
out = regex_format(out, m_cresults, func2, f);
out = regex_format(out, m_cresults, func2);
functor1<match_results_type> func1;
out = regex_format(out, m_cresults, func1, f);
out = regex_format(out, m_cresults, func1);
m_string += regex_format(m_cresults, func3, f);
m_string += regex_format(m_cresults, func3);
m_string += regex_format(m_cresults, func2, f);
m_string += regex_format(m_cresults, func2);
m_string += regex_format(m_cresults, func1, f);
m_string += regex_format(m_cresults, func1);
out = m_cresults.format(out, func3, f);
out = m_cresults.format(out, func3);
out = m_cresults.format(out, func2, f);
out = m_cresults.format(out, func2);
out = m_cresults.format(out, func1, f);
out = m_cresults.format(out, func1);
m_string += m_cresults.format(func3, f);
m_string += m_cresults.format(func3);
m_string += m_cresults.format(func2, f);
m_string += m_cresults.format(func2);
m_string += m_cresults.format(func1, f);
m_string += m_cresults.format(func1);
out = regex_replace(out, m_in, m_in, ce, func3, f);
out = regex_replace(out, m_in, m_in, ce, func3);
out = regex_replace(out, m_in, m_in, ce, func2, f);
out = regex_replace(out, m_in, m_in, ce, func2);
out = regex_replace(out, m_in, m_in, ce, func1, f);
out = regex_replace(out, m_in, m_in, ce, func1);
functor3<match_results<typename string_type::const_iterator> > func3s;
functor2<match_results<typename string_type::const_iterator> > func2s;
functor1<match_results<typename string_type::const_iterator> > func1s;
m_string += regex_replace(m_string, ce, func3s, f);
m_string += regex_replace(m_string, ce, func3s);
m_string += regex_replace(m_string, ce, func2s, f);
m_string += regex_replace(m_string, ce, func2s);
m_string += regex_replace(m_string, ce, func1s, f);
m_string += regex_replace(m_string, ce, func1s);
}
std::basic_ostream<value_type> m_stream;
@ -893,6 +986,7 @@ struct BoostRegexConcept
const value_type m_char;
match_results_type m_results;
const match_results_type m_cresults;
BidiIterator m_in;
BoostRegexConcept();
BoostRegexConcept(const BoostRegexConcept&);

View File

@ -92,6 +92,12 @@
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
#endif
/*
* Shared regex lib will crash without this, frankly it looks a lot like a gcc bug:
*/
#if defined(__MINGW32__)
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
#endif
/*
* If there isn't good enough wide character support then there will

View File

@ -376,7 +376,7 @@ inline u32regex make_u32regex(const std::basic_string<C, T, A>& s, boost::regex_
//
// Construction from ICU string type:
//
inline u32regex make_u32regex(const UnicodeString& s, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
inline u32regex make_u32regex(const U_NAMESPACE_QUALIFIER UnicodeString& s, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
{
return re_detail::do_make_u32regex(s.getBuffer(), s.getBuffer() + s.length(), opt, static_cast<boost::mpl::int_<2> const*>(0));
}
@ -498,7 +498,7 @@ inline bool u32regex_match(const std::wstring& s,
return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_match(const UnicodeString& s,
inline bool u32regex_match(const U_NAMESPACE_QUALIFIER UnicodeString& s,
match_results<const UChar*>& m,
const u32regex& e,
match_flag_type flags = match_default)
@ -562,7 +562,7 @@ inline bool u32regex_match(const std::wstring& s,
return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_match(const UnicodeString& s,
inline bool u32regex_match(const U_NAMESPACE_QUALIFIER UnicodeString& s,
const u32regex& e,
match_flag_type flags = match_default)
{
@ -683,7 +683,7 @@ inline bool u32regex_search(const std::wstring& s,
return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_search(const UnicodeString& s,
inline bool u32regex_search(const U_NAMESPACE_QUALIFIER UnicodeString& s,
match_results<const UChar*>& m,
const u32regex& e,
match_flag_type flags = match_default)
@ -744,7 +744,7 @@ inline bool u32regex_search(const std::wstring& s,
return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
}
#endif
inline bool u32regex_search(const UnicodeString& s,
inline bool u32regex_search(const U_NAMESPACE_QUALIFIER UnicodeString& s,
const u32regex& e,
match_flag_type flags = match_default)
{
@ -921,7 +921,7 @@ inline OutputIterator u32regex_replace(OutputIterator out,
Iterator first,
Iterator last,
const u32regex& e,
const UnicodeString& fmt,
const U_NAMESPACE_QUALIFIER UnicodeString& fmt,
match_flag_type flags = match_default)
{
return re_detail::extract_output_base
@ -966,9 +966,9 @@ namespace re_detail{
class unicode_string_out_iterator
{
UnicodeString* out;
U_NAMESPACE_QUALIFIER UnicodeString* out;
public:
unicode_string_out_iterator(UnicodeString& s) : out(&s) {}
unicode_string_out_iterator(U_NAMESPACE_QUALIFIER UnicodeString& s) : out(&s) {}
unicode_string_out_iterator& operator++() { return *this; }
unicode_string_out_iterator& operator++(int) { return *this; }
unicode_string_out_iterator& operator*() { return *this; }
@ -986,23 +986,23 @@ public:
}
inline UnicodeString u32regex_replace(const UnicodeString& s,
inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QUALIFIER UnicodeString& s,
const u32regex& e,
const UChar* fmt,
match_flag_type flags = match_default)
{
UnicodeString result;
U_NAMESPACE_QUALIFIER UnicodeString result;
re_detail::unicode_string_out_iterator i(result);
u32regex_replace(i, s.getBuffer(), s.getBuffer()+s.length(), e, fmt, flags);
return result;
}
inline UnicodeString u32regex_replace(const UnicodeString& s,
inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QUALIFIER UnicodeString& s,
const u32regex& e,
const UnicodeString& fmt,
const U_NAMESPACE_QUALIFIER UnicodeString& fmt,
match_flag_type flags = match_default)
{
UnicodeString result;
U_NAMESPACE_QUALIFIER UnicodeString result;
re_detail::unicode_string_out_iterator i(result);
re_detail::do_regex_replace(
re_detail::make_utf32_out(i, static_cast<mpl::int_<2> const*>(0)),

View File

@ -73,7 +73,9 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
// for now just throw, but we should never really get here...
//
::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock"));
#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
return boost::shared_ptr<Object>();
#endif
#else
return do_get(k, max_cache_size);
#endif

View File

@ -140,7 +140,7 @@ inline bool scoped_static_mutex_lock::locked()const
namespace boost{
class BOOST_REGEX_DECL scoped_static_mutex_lock;
extern "C" BOOST_REGEX_DECL void free_static_mutex();
extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex();
class BOOST_REGEX_DECL static_mutex
{

View File

@ -677,6 +677,8 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
template <class charT, class traits>
void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT* p2)
{
if(this->m_pdata->m_status)
return;
// we've added all the states we need, now finish things off.
// start by adding a terminating state:
append_state(syntax_element_match);
@ -698,6 +700,8 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT*
{
m_pdata->m_has_recursions = true;
fixup_recursions(m_pdata->m_first_state);
if(this->m_pdata->m_status)
return;
}
else
m_pdata->m_has_recursions = false;
@ -787,7 +791,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
//
if(0 == (this->flags() & regex_constants::no_except))
{
std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
std::string message = "Encountered a forward reference to a marked sub-expression that does not exist.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
@ -807,8 +811,43 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
{
if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == id))
{
//
// We've found the target of the recursion, set the jump target:
//
static_cast<re_jump*>(state)->alt.p = p;
ok = true;
//
// Now scan the target for nested repeats:
//
p = p->next.p;
int next_rep_id = 0;
while(p)
{
switch(p->type)
{
case syntax_element_rep:
case syntax_element_dot_rep:
case syntax_element_char_rep:
case syntax_element_short_set_rep:
case syntax_element_long_set_rep:
next_rep_id = static_cast<re_repeat*>(p)->state_id;
break;
case syntax_element_endmark:
if(static_cast<const re_brace*>(p)->index == id)
next_rep_id = -1;
break;
default:
break;
}
if(next_rep_id)
break;
p = p->next.p;
}
if(next_rep_id > 0)
{
static_cast<re_recurse*>(state)->state_id = next_rep_id - 1;
}
break;
}
p = p->next.p;
@ -828,7 +867,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
//
if(0 == (this->flags() & regex_constants::no_except))
{
std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
std::string message = "Encountered a forward reference to a recursive sub-expression that does not exist.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
@ -893,7 +932,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
//
if(0 == (this->flags() & regex_constants::no_except))
{
std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
std::string message = "Invalid lookbehind assertion encountered in the regular expression.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
@ -1012,6 +1051,9 @@ template <class charT, class traits>
void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask)
{
int not_last_jump = 1;
re_syntax_base* recursion_start = 0;
int recursion_sub = 0;
re_syntax_base* recursion_restart = 0;
// track case sensitivity:
bool l_icase = m_icase;
@ -1057,6 +1099,40 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
return;
}
case syntax_element_recurse:
{
if(recursion_start == state)
{
// Infinite recursion!!
if(0 == this->m_pdata->m_status) // update the error code if not already set
this->m_pdata->m_status = boost::regex_constants::error_bad_pattern;
//
// clear the expression, we should be empty:
//
this->m_pdata->m_expression = 0;
this->m_pdata->m_expression_len = 0;
//
// and throw if required:
//
if(0 == (this->flags() & regex_constants::no_except))
{
std::string message = "Encountered an infinite recursion.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
}
else if(recursion_start == 0)
{
recursion_start = state;
recursion_restart = state->next.p;
state = static_cast<re_jump*>(state)->alt.p;
if(state->type == syntax_element_startmark)
recursion_sub = static_cast<re_brace*>(state)->index;
else
recursion_sub = 0;
break;
}
// fall through, can't handle nested recursion here...
}
case syntax_element_backref:
// can be null, and any character can match:
if(pnull)
@ -1215,12 +1291,45 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
*pnull |= mask;
return;
}
else
else if(recursion_start && (recursion_sub != 0) && (recursion_sub == static_cast<re_brace*>(state)->index))
{
state = state->next.p;
// recursion termination:
recursion_start = 0;
state = recursion_restart;
break;
}
//
// Normally we just go to the next state... but if this sub-expression is
// the target of a recursion, then we might be ending a recursion, in which
// case we should check whatever follows that recursion, as well as whatever
// follows this state:
//
if(m_pdata->m_has_recursions && static_cast<re_brace*>(state)->index)
{
bool ok = false;
re_syntax_base* p = m_pdata->m_first_state;
while(p)
{
if((p->type == syntax_element_recurse))
{
re_brace* p2 = static_cast<re_brace*>(static_cast<re_jump*>(p)->alt.p);
if((p2->type == syntax_element_startmark) && (p2->index == static_cast<re_brace*>(state)->index))
{
ok = true;
break;
}
}
p = p->next.p;
}
if(ok)
{
create_startmap(p->next.p, l_map, pnull, mask);
}
}
state = state->next.p;
break;
case syntax_element_startmark:
// need to handle independent subs as a special case:
if(static_cast<re_brace*>(state)->index == -3)

File diff suppressed because it is too large Load Diff

View File

@ -187,6 +187,7 @@ struct cpp_regex_traits_base
#ifndef BOOST_NO_STD_MESSAGES
if(m_pmessages == b.m_pmessages)
{
return m_pcollate < b.m_pcollate;
}
return m_pmessages < b.m_pmessages;
#else
@ -212,7 +213,7 @@ std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l)
m_locale = l;
m_pctype = &BOOST_USE_FACET(std::ctype<charT>, l);
#ifndef BOOST_NO_STD_MESSAGES
m_pmessages = &BOOST_USE_FACET(std::messages<charT>, l);
m_pmessages = BOOST_HAS_FACET(std::messages<charT>, l) ? &BOOST_USE_FACET(std::messages<charT>, l) : 0;
#endif
m_pcollate = &BOOST_USE_FACET(std::collate<charT>, l);
return result;
@ -276,7 +277,7 @@ void cpp_regex_traits_char_layer<charT>::init()
typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
#endif
std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
if(cat_name.size())
if(cat_name.size() && (this->m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,
@ -309,7 +310,8 @@ void cpp_regex_traits_char_layer<charT>::init()
}
catch(...)
{
this->m_pmessages->close(cat);
if(this->m_pmessages)
this->m_pmessages->close(cat);
throw;
}
#endif
@ -653,7 +655,7 @@ void cpp_regex_traits_implementation<charT>::init()
typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
#endif
std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
if(cat_name.size())
if(cat_name.size() && (this->m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,
@ -716,7 +718,7 @@ void cpp_regex_traits_implementation<charT>::init()
cpp_regex_traits_implementation<charT>::mask_unicode,
};
#else
static const char_class_type masks[14] =
static const char_class_type masks[16] =
{
::boost::re_detail::char_class_alnum,
::boost::re_detail::char_class_alpha,
@ -837,8 +839,8 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t
|| ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c))
|| ((mask & ::boost::re_detail::char_class_word) && (c == '_'))
|| ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c))
|| ((mask & ::boost::re_detail::char_class_vertical) && (is_separator(c) || (c == '\v')))
|| ((mask & ::boost::re_detail::char_class_horizontal) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
|| ((mask & ::boost::re_detail::char_class_vertical_space) && (is_separator(c) || (c == '\v')))
|| ((mask & ::boost::re_detail::char_class_horizontal_space) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
}
#endif

View File

@ -124,11 +124,11 @@ typedef enum{
REG_STARTEND = 00004
} reg_exec_flags;
//
// POSIX error codes:
//
/*
* POSIX error codes:
*/
typedef unsigned reg_error_t;
typedef reg_error_t reg_errcode_t; // backwards compatibility
typedef reg_error_t reg_errcode_t; /* backwards compatibility */
static const reg_error_t REG_NOERROR = 0; /* Success. */
static const reg_error_t REG_NOMATCH = 1; /* Didn't find a match (for regexec). */
@ -154,8 +154,9 @@ static const reg_error_t REG_EMPTY = 17; /* empty expression */
static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
static const reg_error_t REG_ESTACK = 19; /* out of stack space */
static const reg_error_t REG_E_UNKNOWN = 20; /* unknown error */
static const reg_error_t REG_ENOSYS = 20; /* = REG_E_UNKNOWN : Reserved. */
static const reg_error_t REG_E_PERL = 20; /* Perl (?...) error */
static const reg_error_t REG_E_UNKNOWN = 21; /* unknown error */
static const reg_error_t REG_ENOSYS = 21; /* = REG_E_UNKNOWN : Reserved. */
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
@ -195,14 +196,14 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
#endif
#ifdef __cplusplus
} // extern "C"
} // namespace
} /* extern "C" */
} /* namespace */
#endif
//
// C++ high level wrapper goes here:
//
#if defined(__cplusplus)
/*
* C++ high level wrapper goes here:
*/
#include <string>
#include <vector>
namespace boost{
@ -228,7 +229,7 @@ struct pred2;
struct pred3;
struct pred4;
} // namespace re_detail
} /* namespace re_detail */
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
@ -257,9 +258,9 @@ public:
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
std::string Expression()const;
unsigned int error_code()const;
//
// now matching operators:
//
/*
* now matching operators:
*/
bool Match(const char* p, match_flag_type flags = match_default);
bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
bool Search(const char* p, match_flag_type flags = match_default);
@ -283,9 +284,9 @@ public:
bool copy = true, match_flag_type flags = match_default);
std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
//
// now operators for returning what matched in more detail:
//
/*
* now operators for returning what matched in more detail:
*/
std::size_t Position(int i = 0)const;
std::size_t Length(int i = 0)const;
bool Matched(int i = 0)const;
@ -312,11 +313,11 @@ public:
#pragma warning(pop)
#endif
} // namespace boost
} /* namespace boost */
#endif
#endif /* __cplusplus */
#endif // include guard
#endif /* include guard */

View File

@ -28,8 +28,8 @@ namespace regex_constants{
enum error_type{
error_ok = 0, // not used
error_no_match = 1, // not used
error_ok = 0, /* not used */
error_no_match = 1, /* not used */
error_bad_pattern = 2,
error_collate = 3,
error_ctype = 4,
@ -42,17 +42,18 @@ enum error_type{
error_range = 11,
error_space = 12,
error_badrepeat = 13,
error_end = 14, // not used
error_end = 14, /* not used */
error_size = 15,
error_right_paren = 16, // not used
error_right_paren = 16, /* not used */
error_empty = 17,
error_complexity = 18,
error_stack = 19,
error_unknown = 20
error_perl_extension = 20,
error_unknown = 21
};
}
}
#endif // __cplusplus
#endif /* __cplusplus */
#endif

View File

@ -31,43 +31,43 @@ namespace boost{
typedef enum _match_flags
{
match_default = 0,
match_not_bol = 1, // first is not start of line
match_not_eol = match_not_bol << 1, // last is not end of line
match_not_bob = match_not_eol << 1, // first is not start of buffer
match_not_eob = match_not_bob << 1, // last is not end of buffer
match_not_bow = match_not_eob << 1, // first is not start of word
match_not_eow = match_not_bow << 1, // last is not end of word
match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.'
match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.'
match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression
match_init = match_prev_avail << 1, // internal use
match_any = match_init << 1, // don't care what we match
match_not_null = match_any << 1, // string can't be null
match_continuous = match_not_null << 1, // each grep match must continue from
// uninterupted from the previous one
match_partial = match_continuous << 1, // find partial matches
match_not_bol = 1, /* first is not start of line */
match_not_eol = match_not_bol << 1, /* last is not end of line */
match_not_bob = match_not_eol << 1, /* first is not start of buffer */
match_not_eob = match_not_bob << 1, /* last is not end of buffer */
match_not_bow = match_not_eob << 1, /* first is not start of word */
match_not_eow = match_not_bow << 1, /* last is not end of word */
match_not_dot_newline = match_not_eow << 1, /* \n is not matched by '.' */
match_not_dot_null = match_not_dot_newline << 1, /* '\0' is not matched by '.' */
match_prev_avail = match_not_dot_null << 1, /* *--first is a valid expression */
match_init = match_prev_avail << 1, /* internal use */
match_any = match_init << 1, /* don't care what we match */
match_not_null = match_any << 1, /* string can't be null */
match_continuous = match_not_null << 1, /* each grep match must continue from */
/* uninterupted from the previous one */
match_partial = match_continuous << 1, /* find partial matches */
match_stop = match_partial << 1, // stop after first match (grep) V3 only
match_not_initial_null = match_stop, // don't match initial null, V4 only
match_all = match_stop << 1, // must find the whole of input even if match_any is set
match_perl = match_all << 1, // Use perl matching rules
match_posix = match_perl << 1, // Use POSIX matching rules
match_nosubs = match_posix << 1, // don't trap marked subs
match_extra = match_nosubs << 1, // include full capture information for repeated captures
match_single_line = match_extra << 1, // treat text as single line and ignor any \n's when matching ^ and $.
match_unused1 = match_single_line << 1, // unused
match_unused2 = match_unused1 << 1, // unused
match_unused3 = match_unused2 << 1, // unused
match_stop = match_partial << 1, /* stop after first match (grep) V3 only */
match_not_initial_null = match_stop, /* don't match initial null, V4 only */
match_all = match_stop << 1, /* must find the whole of input even if match_any is set */
match_perl = match_all << 1, /* Use perl matching rules */
match_posix = match_perl << 1, /* Use POSIX matching rules */
match_nosubs = match_posix << 1, /* don't trap marked subs */
match_extra = match_nosubs << 1, /* include full capture information for repeated captures */
match_single_line = match_extra << 1, /* treat text as single line and ignor any \n's when matching ^ and $. */
match_unused1 = match_single_line << 1, /* unused */
match_unused2 = match_unused1 << 1, /* unused */
match_unused3 = match_unused2 << 1, /* unused */
match_max = match_unused3,
format_perl = 0, // perl style replacement
format_default = 0, // ditto.
format_sed = match_max << 1, // sed style replacement.
format_all = format_sed << 1, // enable all extentions to sytax.
format_no_copy = format_all << 1, // don't copy non-matching segments.
format_first_only = format_no_copy << 1, // Only replace first occurance.
format_is_if = format_first_only << 1, // internal use only.
format_literal = format_is_if << 1 // treat string as a literal
format_perl = 0, /* perl style replacement */
format_default = 0, /* ditto. */
format_sed = match_max << 1, /* sed style replacement. */
format_all = format_sed << 1, /* enable all extentions to sytax. */
format_no_copy = format_all << 1, /* don't copy non-matching segments. */
format_first_only = format_no_copy << 1, /* Only replace first occurance. */
format_is_if = format_first_only << 1, /* internal use only. */
format_literal = format_is_if << 1 /* treat string as a literal */
} match_flags;
@ -96,10 +96,10 @@ inline match_flags& operator^=(match_flags& m1, match_flags m2)
#endif
#ifdef __cplusplus
} // namespace regex_constants
//
// import names into boost for backwards compatiblity:
//
} /* namespace regex_constants */
/*
* import names into boost for backwards compatiblity:
*/
using regex_constants::match_flag_type;
using regex_constants::match_default;
using regex_constants::match_not_bol;
@ -111,28 +111,28 @@ using regex_constants::match_not_eow;
using regex_constants::match_not_dot_newline;
using regex_constants::match_not_dot_null;
using regex_constants::match_prev_avail;
//using regex_constants::match_init;
/* using regex_constants::match_init; */
using regex_constants::match_any;
using regex_constants::match_not_null;
using regex_constants::match_continuous;
using regex_constants::match_partial;
//using regex_constants::match_stop;
/*using regex_constants::match_stop; */
using regex_constants::match_all;
using regex_constants::match_perl;
using regex_constants::match_posix;
using regex_constants::match_nosubs;
using regex_constants::match_extra;
using regex_constants::match_single_line;
//using regex_constants::match_max;
/*using regex_constants::match_max; */
using regex_constants::format_all;
using regex_constants::format_sed;
using regex_constants::format_perl;
using regex_constants::format_default;
using regex_constants::format_no_copy;
using regex_constants::format_first_only;
//using regex_constants::format_is_if;
/*using regex_constants::format_is_if;*/
} // namespace boost
#endif // __cplusplus
#endif // include guard
} /* namespace boost */
#endif /* __cplusplus */
#endif /* include guard */

View File

@ -1,6 +1,6 @@
/*
*
* Copyright (c) 1998-2002
* Copyright (c) 1998-2009
* John Maddock
*
* Use, modification and distribution are subject to the
@ -74,16 +74,30 @@ public:
// construct/copy/destroy:
explicit match_results(const Allocator& a = Allocator())
#ifndef BOOST_NO_STD_ALLOCATOR
: m_subs(a), m_base(), m_last_closed_paren(0) {}
: m_subs(a), m_base(), m_last_closed_paren(0), m_is_singular(true) {}
#else
: m_subs(), m_base(), m_last_closed_paren(0) { (void)a; }
: m_subs(), m_base(), m_last_closed_paren(0), m_is_singular(true) { (void)a; }
#endif
match_results(const match_results& m)
: m_subs(m.m_subs), m_base(m.m_base) {}
: m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular)
{
if(!m_is_singular)
{
m_base = m.m_base;
m_null = m.m_null;
}
}
match_results& operator=(const match_results& m)
{
m_subs = m.m_subs;
m_base = m.m_base;
m_named_subs = m.m_named_subs;
m_last_closed_paren = m.m_last_closed_paren;
m_is_singular = m.m_is_singular;
if(!m_is_singular)
{
m_base = m.m_base;
m_null = m.m_null;
}
return *this;
}
~match_results(){}
@ -98,6 +112,8 @@ public:
// element access:
difference_type length(int sub = 0) const
{
if(m_is_singular)
raise_logic_error();
sub += 2;
if((sub < (int)m_subs.size()) && (sub > 0))
return m_subs[sub].length();
@ -105,16 +121,20 @@ public:
}
difference_type length(const char_type* sub) const
{
const char_type* end = sub;
while(*end) ++end;
return length(named_subexpression_index(sub, end));
if(m_is_singular)
raise_logic_error();
const char_type* sub_end = sub;
while(*sub_end) ++sub_end;
return length(named_subexpression_index(sub, sub_end));
}
template <class charT>
difference_type length(const charT* sub) const
{
const charT* end = sub;
while(*end) ++end;
return length(named_subexpression_index(sub, end));
if(m_is_singular)
raise_logic_error();
const charT* sub_end = sub;
while(*sub_end) ++sub_end;
return length(named_subexpression_index(sub, sub_end));
}
template <class charT, class Traits, class A>
difference_type length(const std::basic_string<charT, Traits, A>& sub) const
@ -123,6 +143,8 @@ public:
}
difference_type position(size_type sub = 0) const
{
if(m_is_singular)
raise_logic_error();
sub += 2;
if(sub < m_subs.size())
{
@ -136,16 +158,16 @@ public:
}
difference_type position(const char_type* sub) const
{
const char_type* end = sub;
while(*end) ++end;
return position(named_subexpression_index(sub, end));
const char_type* sub_end = sub;
while(*sub_end) ++sub_end;
return position(named_subexpression_index(sub, sub_end));
}
template <class charT>
difference_type position(const charT* sub) const
{
const charT* end = sub;
while(*end) ++end;
return position(named_subexpression_index(sub, end));
const charT* sub_end = sub;
while(*sub_end) ++sub_end;
return position(named_subexpression_index(sub, sub_end));
}
template <class charT, class Traits, class A>
difference_type position(const std::basic_string<charT, Traits, A>& sub) const
@ -154,6 +176,8 @@ public:
}
string_type str(int sub = 0) const
{
if(m_is_singular)
raise_logic_error();
sub += 2;
string_type result;
if(sub < (int)m_subs.size() && (sub > 0))
@ -187,6 +211,8 @@ public:
}
const_reference operator[](int sub) const
{
if(m_is_singular && m_subs.empty())
raise_logic_error();
sub += 2;
if(sub < (int)m_subs.size() && (sub >= 0))
{
@ -199,6 +225,8 @@ public:
//
const_reference named_subexpression(const char_type* i, const char_type* j) const
{
if(m_is_singular)
raise_logic_error();
int index = m_named_subs->get_id(i, j);
return index > 0 ? (*this)[index] : m_null;
}
@ -215,6 +243,8 @@ public:
}
int named_subexpression_index(const char_type* i, const char_type* j) const
{
if(m_is_singular)
raise_logic_error();
int index = m_named_subs->get_id(i, j);
return index > 0 ? index : -20;
}
@ -266,11 +296,15 @@ public:
const_reference prefix() const
{
if(m_is_singular)
raise_logic_error();
return (*this)[-1];
}
const_reference suffix() const
{
if(m_is_singular)
raise_logic_error();
return (*this)[-2];
}
const_iterator begin() const
@ -282,44 +316,67 @@ public:
return m_subs.end();
}
// format:
template <class OutputIterator>
template <class OutputIterator, class Functor>
OutputIterator format(OutputIterator out,
const string_type& fmt,
Functor fmt,
match_flag_type flags = format_default) const
{
re_detail::trivial_format_traits<char_type> traits;
return re_detail::regex_format_imp(out, *this, fmt.data(), fmt.data() + fmt.size(), flags, traits);
if(m_is_singular)
raise_logic_error();
typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, OutputIterator>::type F;
F func(fmt);
return func(*this, out, flags);
}
string_type format(const string_type& fmt,
match_flag_type flags = format_default) const
template <class Functor>
string_type format(Functor fmt, match_flag_type flags = format_default) const
{
string_type result;
re_detail::string_out_iterator<string_type> i(result);
re_detail::trivial_format_traits<char_type> traits;
re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, traits);
if(m_is_singular)
raise_logic_error();
std::basic_string<char_type> result;
re_detail::string_out_iterator<std::basic_string<char_type> > i(result);
typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, re_detail::string_out_iterator<std::basic_string<char_type> > >::type F;
F func(fmt);
func(*this, i, flags);
return result;
}
// format with locale:
template <class OutputIterator, class RegexT>
template <class OutputIterator, class Functor, class RegexT>
OutputIterator format(OutputIterator out,
const string_type& fmt,
Functor fmt,
match_flag_type flags,
const RegexT& re) const
{
return ::boost::re_detail::regex_format_imp(out, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
if(m_is_singular)
raise_logic_error();
typedef ::boost::regex_traits_wrapper<typename RegexT::traits_type> traits_type;
typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, OutputIterator, traits_type>::type F;
F func(fmt);
return func(*this, out, flags, re.get_traits());
}
template <class RegexT>
string_type format(const string_type& fmt,
template <class RegexT, class Functor>
string_type format(Functor fmt,
match_flag_type flags,
const RegexT& re) const
{
string_type result;
re_detail::string_out_iterator<string_type> i(result);
::boost::re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
if(m_is_singular)
raise_logic_error();
typedef ::boost::regex_traits_wrapper<typename RegexT::traits_type> traits_type;
std::basic_string<char_type> result;
re_detail::string_out_iterator<std::basic_string<char_type> > i(result);
typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, re_detail::string_out_iterator<std::basic_string<char_type> >, traits_type >::type F;
F func(fmt);
func(*this, i, flags, re.get_traits());
return result;
}
const_reference get_last_closed_paren()const
{
if(m_is_singular)
raise_logic_error();
return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren];
}
@ -334,11 +391,39 @@ public:
void swap(match_results& that)
{
std::swap(m_subs, that.m_subs);
std::swap(m_base, that.m_base);
std::swap(m_named_subs, that.m_named_subs);
std::swap(m_last_closed_paren, that.m_last_closed_paren);
std::swap(m_is_singular, that.m_is_singular);
if(m_is_singular)
{
if(!that.m_is_singular)
{
m_base = that.m_base;
m_null = that.m_null;
}
}
else if(that.m_is_singular)
{
that.m_base = m_base;
that.m_null = m_null;
}
else
{
std::swap(m_base, that.m_base);
std::swap(m_null, that.m_null);
}
}
bool operator==(const match_results& that)const
{
return (m_subs == that.m_subs) && (m_base == that.m_base);
if(m_is_singular)
{
return that.m_is_singular;
}
else if(that.m_is_singular)
{
return false;
}
return (m_subs == that.m_subs) && (m_base == that.m_base) && (m_last_closed_paren == that.m_last_closed_paren);
}
bool operator!=(const match_results& that)const
{ return !(*this == that); }
@ -348,6 +433,8 @@ public:
const capture_sequence_type& captures(int i)const
{
if(m_is_singular)
raise_logic_error();
return (*this)[i].captures();
}
#endif
@ -364,6 +451,7 @@ public:
m_null.first = i;
m_null.second = i;
m_null.matched = false;
m_is_singular = false;
}
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
@ -381,6 +469,7 @@ public:
m_null.first = i;
m_null.second = i;
m_null.matched = false;
m_is_singular = false;
}
}
void BOOST_REGEX_CALL set_size(size_type n, BidiIterator i, BidiIterator j)
@ -411,6 +500,7 @@ public:
}
void BOOST_REGEX_CALL set_first(BidiIterator i)
{
BOOST_ASSERT(m_subs.size() > 2);
// set up prefix:
m_subs[1].second = i;
m_subs[1].matched = (m_subs[1].first != i);
@ -446,16 +536,32 @@ public:
}
private:
vector_type m_subs; // subexpressions
BidiIterator m_base; // where the search started from
sub_match<BidiIterator> m_null; // a null match
boost::shared_ptr<named_sub_type> m_named_subs;
int m_last_closed_paren;
//
// Error handler called when an uninitialized match_results is accessed:
//
static void raise_logic_error()
{
std::logic_error e("Attempt to access an uninitialzed boost::match_results<> class.");
boost::throw_exception(e);
}
vector_type m_subs; // subexpressions
BidiIterator m_base; // where the search started from
sub_match<BidiIterator> m_null; // a null match
boost::shared_ptr<named_sub_type> m_named_subs; // Shared copy of named subs in the regex object
int m_last_closed_paren; // Last ) to be seen - used for formatting
bool m_is_singular; // True if our stored iterators are singular
};
template <class BidiIterator, class Allocator>
void BOOST_REGEX_CALL match_results<BidiIterator, Allocator>::maybe_assign(const match_results<BidiIterator, Allocator>& m)
{
if(m_is_singular)
{
*this = m;
return;
}
const_iterator p1, p2;
p1 = begin();
p2 = m.begin();

View File

@ -61,7 +61,7 @@ inline bool can_start(unsigned short c, const unsigned char* map, unsigned char
{
return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask);
}
#if !defined(__hpux) // WCHAR_MIN not usable in pp-directives.
#if !defined(__hpux) && !defined(__WINSCW__)// WCHAR_MIN not usable in pp-directives.
#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
{
@ -277,10 +277,15 @@ public:
else
{
repeater_count* p = next;
while(p->state_id != state_id)
while(p && (p->state_id != state_id))
p = p->next;
count = p->count;
start_pos = p->start_pos;
if(p)
{
count = p->count;
start_pos = p->start_pos;
}
else
count = 0;
}
}
~repeater_count()

View File

@ -188,7 +188,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
if(!(this->*proc)())
{
if(state_count > max_state_count)
raise_error(traits_inst, regex_constants::error_space);
raise_error(traits_inst, regex_constants::error_complexity);
if((m_match_flags & match_partial) && (position == last) && (position != search_base))
m_has_partial_match = true;
bool successful_unwind = unwind(false);
@ -219,7 +219,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
m_backup_state = block;
}
else
raise_error(traits_inst, regex_constants::error_size);
raise_error(traits_inst, regex_constants::error_stack);
}
template <class BidiIterator, class Allocator, class traits>
@ -904,10 +904,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
}
recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
recursion_stack[recursion_stack_position].results = *m_presult;
if(static_cast<const re_recurse*>(pstate)->state_id > 0)
{
push_repeater_count(static_cast<const re_recurse*>(pstate)->state_id, &next_count);
}
pstate = static_cast<const re_jump*>(pstate)->alt.p;
recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
++recursion_stack_position;
//BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id);
return true;
}

View File

@ -99,7 +99,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
};
if(state_count > max_state_count)
raise_error(traits_inst, regex_constants::error_space);
raise_error(traits_inst, regex_constants::error_complexity);
while(pstate)
{
matcher_proc_type proc = s_match_vtable[pstate->type];

View File

@ -1,7 +1,7 @@
/*
*
* Copyright (c) 1998-2002
* John Maddock
* Copyright (c) 1998-2009 John Maddock
* Copyright 2008 Eric Niebler.
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
@ -21,6 +21,19 @@
#ifndef BOOST_REGEX_FORMAT_HPP
#define BOOST_REGEX_FORMAT_HPP
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_function.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#ifndef BOOST_NO_SFINAE
#include <boost/mpl/has_xxx.hpp>
#endif
namespace boost{
@ -76,15 +89,15 @@ struct trivial_format_traits
}
};
template <class OutputIterator, class Results, class traits>
template <class OutputIterator, class Results, class traits, class ForwardIter>
class basic_regex_formatter
{
public:
typedef typename traits::char_type char_type;
basic_regex_formatter(OutputIterator o, const Results& r, const traits& t)
: m_traits(t), m_results(r), m_out(o), m_state(output_copy), m_restore_state(output_copy), m_have_conditional(false) {}
OutputIterator format(const char_type* p1, const char_type* p2, match_flag_type f);
OutputIterator format(const char_type* p1, match_flag_type f)
OutputIterator format(ForwardIter p1, ForwardIter p2, match_flag_type f);
OutputIterator format(ForwardIter p1, match_flag_type f)
{
return format(p1, p1 + m_traits.length(p1), f);
}
@ -109,22 +122,75 @@ private:
void format_until_scope_end();
bool handle_perl_verb(bool have_brace);
const traits& m_traits; // the traits class for localised formatting operations
const Results& m_results; // the match_results being used.
OutputIterator m_out; // where to send output.
const char_type* m_position; // format string, current position
const char_type* m_end; // format string end
match_flag_type m_flags; // format flags to use
output_state m_state; // what to do with the next character
output_state m_restore_state; // what state to restore to.
bool m_have_conditional; // we are parsing a conditional
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const mpl::false_&)
{
std::vector<char_type> v(i, j);
return (i != j) ? this->m_results.named_subexpression(&v[0], &v[0] + v.size())
: this->m_results.named_subexpression(static_cast<const char_type*>(0), static_cast<const char_type*>(0));
}
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const mpl::true_&)
{
return this->m_results.named_subexpression(i, j);
}
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j)
{
typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type;
return get_named_sub(i, j, tag_type());
}
inline int get_named_sub_index(ForwardIter i, ForwardIter j, const mpl::false_&)
{
std::vector<char_type> v(i, j);
return (i != j) ? this->m_results.named_subexpression_index(&v[0], &v[0] + v.size())
: this->m_results.named_subexpression_index(static_cast<const char_type*>(0), static_cast<const char_type*>(0));
}
inline int get_named_sub_index(ForwardIter i, ForwardIter j, const mpl::true_&)
{
return this->m_results.named_subexpression_index(i, j);
}
inline int get_named_sub_index(ForwardIter i, ForwardIter j)
{
typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type;
return get_named_sub_index(i, j, tag_type());
}
inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::false_&)
{
if(i != j)
{
std::vector<char_type> v(i, j);
const char_type* start = &v[0];
const char_type* pos = start;
int r = m_traits.toi(pos, &v[0] + v.size(), base);
std::advance(i, pos - start);
return r;
}
return -1;
}
inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::true_&)
{
return m_traits.toi(i, j, base);
}
inline int toi(ForwardIter& i, ForwardIter j, int base)
{
typedef typename boost::is_convertible<ForwardIter, const char_type*&>::type tag_type;
return toi(i, j, base, tag_type());
}
const traits& m_traits; // the traits class for localised formatting operations
const Results& m_results; // the match_results being used.
OutputIterator m_out; // where to send output.
ForwardIter m_position; // format string, current position
ForwardIter m_end; // format string end
match_flag_type m_flags; // format flags to use
output_state m_state; // what to do with the next character
output_state m_restore_state; // what state to restore to.
bool m_have_conditional; // we are parsing a conditional
private:
basic_regex_formatter(const basic_regex_formatter&);
basic_regex_formatter& operator=(const basic_regex_formatter&);
};
template <class OutputIterator, class Results, class traits>
OutputIterator basic_regex_formatter<OutputIterator, Results, traits>::format(const char_type* p1, const char_type* p2, match_flag_type f)
template <class OutputIterator, class Results, class traits, class ForwardIter>
OutputIterator basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format(ForwardIter p1, ForwardIter p2, match_flag_type f)
{
m_position = p1;
m_end = p2;
@ -133,8 +199,8 @@ OutputIterator basic_regex_formatter<OutputIterator, Results, traits>::format(co
return m_out;
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::format_all()
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_all()
{
// over and over:
while(m_position != m_end)
@ -211,8 +277,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_all()
}
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_perl()
{
//
// On entry *m_position points to a '$' character
@ -233,7 +299,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
// OK find out what kind it is:
//
bool have_brace = false;
const char_type* save_position = m_position;
ForwardIter save_position = m_position;
switch(*m_position)
{
case '&':
@ -254,12 +320,12 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
case '+':
if((++m_position != m_end) && (*m_position == '{'))
{
const char_type* base = ++m_position;
ForwardIter base = ++m_position;
while((m_position != m_end) && (*m_position != '}')) ++m_position;
if(m_position != m_end)
{
// Named sub-expression:
put(this->m_results.named_subexpression(base, m_position));
put(get_named_sub(base, m_position));
++m_position;
break;
}
@ -279,7 +345,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
{
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
//len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
int v = m_traits.toi(m_position, m_position + len, 10);
int v = this->toi(m_position, m_position + len, 10);
if((v < 0) || (have_brace && ((m_position == m_end) || (*m_position != '}'))))
{
// Look for a Perl-5.10 verb:
@ -300,8 +366,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
}
}
template <class OutputIterator, class Results, class traits>
bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bool have_brace)
template <class OutputIterator, class Results, class traits, class ForwardIter>
bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle_perl_verb(bool have_brace)
{
//
// We may have a capitalised string containing a Perl action:
@ -313,6 +379,8 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
static const char_type LAST_SUBMATCH_RESULT[] = { 'L', 'A', 'S', 'T', '_', 'S', 'U', 'B', 'M', 'A', 'T', 'C', 'H', '_', 'R', 'E', 'S', 'U', 'L', 'T' };
static const char_type LAST_SUBMATCH_RESULT_ALT[] = { '^', 'N' };
if(m_position == m_end)
return false;
if(have_brace && (*m_position == '^'))
++m_position;
@ -323,7 +391,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
m_position += 5;
if(have_brace)
{
if(*m_position == '}')
if((m_position != m_end) && (*m_position == '}'))
++m_position;
else
{
@ -339,7 +407,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
m_position += 8;
if(have_brace)
{
if(*m_position == '}')
if((m_position != m_end) && (*m_position == '}'))
++m_position;
else
{
@ -355,7 +423,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
m_position += 9;
if(have_brace)
{
if(*m_position == '}')
if((m_position != m_end) && (*m_position == '}'))
++m_position;
else
{
@ -371,7 +439,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
m_position += 16;
if(have_brace)
{
if(*m_position == '}')
if((m_position != m_end) && (*m_position == '}'))
++m_position;
else
{
@ -387,7 +455,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
m_position += 20;
if(have_brace)
{
if(*m_position == '}')
if((m_position != m_end) && (*m_position == '}'))
++m_position;
else
{
@ -403,7 +471,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
m_position += 2;
if(have_brace)
{
if(*m_position == '}')
if((m_position != m_end) && (*m_position == '}'))
++m_position;
else
{
@ -417,8 +485,8 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
return false;
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_escape()
{
// skip the escape and check for trailing escape:
if(++m_position == m_end)
@ -463,7 +531,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
if(*m_position == static_cast<char_type>('{'))
{
++m_position;
int val = m_traits.toi(m_position, m_end, 16);
int val = this->toi(m_position, m_end, 16);
if(val < 0)
{
// invalid value treat everything as literals:
@ -471,8 +539,9 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
put(static_cast<char_type>('{'));
return;
}
if(*m_position != static_cast<char_type>('}'))
if((m_position == m_end) || (*m_position != static_cast<char_type>('}')))
{
--m_position;
while(*m_position != static_cast<char_type>('\\'))
--m_position;
++m_position;
@ -487,7 +556,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
{
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
int val = m_traits.toi(m_position, m_position + len, 16);
int val = this->toi(m_position, m_position + len, 16);
if(val < 0)
{
--m_position;
@ -549,7 +618,9 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
break;
}
// see if we have a \n sed style backreference:
int v = m_traits.toi(m_position, m_position+1, 10);
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
len = (std::min)(static_cast<std::ptrdiff_t>(1), len);
int v = this->toi(m_position, m_position+len, 10);
if((v > 0) || ((v == 0) && (m_flags & ::boost::regex_constants::format_sed)))
{
put(m_results[v]);
@ -559,9 +630,9 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
{
// octal ecape sequence:
--m_position;
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
len = ::boost::re_detail::distance(m_position, m_end);
len = (std::min)(static_cast<std::ptrdiff_t>(4), len);
v = m_traits.toi(m_position, m_position + len, 8);
v = this->toi(m_position, m_position + len, 8);
BOOST_ASSERT(v >= 0);
put(static_cast<char_type>(v));
break;
@ -572,8 +643,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
}
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional()
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_conditional()
{
if(m_position == m_end)
{
@ -584,15 +655,15 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
int v;
if(*m_position == '{')
{
const char_type* base = m_position;
ForwardIter base = m_position;
++m_position;
v = m_traits.toi(m_position, m_end, 10);
v = this->toi(m_position, m_end, 10);
if(v < 0)
{
// Try a named subexpression:
while((m_position != m_end) && (*m_position != '}'))
++m_position;
v = m_results.named_subexpression_index(base + 1, m_position);
v = this->get_named_sub_index(base + 1, m_position);
}
if((v < 0) || (*m_position != '}'))
{
@ -608,7 +679,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
{
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
v = m_traits.toi(m_position, m_position + len, 10);
v = this->toi(m_position, m_position + len, 10);
}
if(v < 0)
{
@ -657,8 +728,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
}
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::format_until_scope_end()
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_until_scope_end()
{
do
{
@ -669,8 +740,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_until_scope_
}while(m_position != m_end);
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::put(char_type c)
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::put(char_type c)
{
// write a single character to output
// according to which case translation mode we are in:
@ -699,8 +770,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::put(char_type c)
++m_out;
}
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::put(const sub_match_type& sub)
template <class OutputIterator, class Results, class traits, class ForwardIter>
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::put(const sub_match_type& sub)
{
typedef typename sub_match_type::iterator iterator_type;
iterator_type i = sub.first;
@ -738,10 +809,10 @@ public:
#endif
};
template <class OutputIterator, class Iterator, class Alloc, class charT, class traits>
template <class OutputIterator, class Iterator, class Alloc, class ForwardIter, class traits>
OutputIterator regex_format_imp(OutputIterator out,
const match_results<Iterator, Alloc>& m,
const charT* p1, const charT* p2,
ForwardIter p1, ForwardIter p2,
match_flag_type flags,
const traits& t
)
@ -754,57 +825,289 @@ OutputIterator regex_format_imp(OutputIterator out,
re_detail::basic_regex_formatter<
OutputIterator,
match_results<Iterator, Alloc>,
traits > f(out, m, t);
traits, ForwardIter> f(out, m, t);
return f.format(p1, p2, flags);
}
#ifndef BOOST_NO_SFINAE
BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator)
struct any_type { any_type(...); };
typedef char no_type;
typedef char (&unary_type)[2];
typedef char (&binary_type)[3];
typedef char (&ternary_type)[4];
no_type check_is_formatter(unary_type, binary_type, ternary_type);
template<typename T>
unary_type check_is_formatter(T const &, binary_type, ternary_type);
template<typename T>
binary_type check_is_formatter(unary_type, T const &, ternary_type);
template<typename T, typename U>
binary_type check_is_formatter(T const &, U const &, ternary_type);
template<typename T>
ternary_type check_is_formatter(unary_type, binary_type, T const &);
template<typename T, typename U>
ternary_type check_is_formatter(T const &, binary_type, U const &);
template<typename T, typename U>
ternary_type check_is_formatter(unary_type, T const &, U const &);
template<typename T, typename U, typename V>
ternary_type check_is_formatter(T const &, U const &, V const &);
struct unary_binary_ternary
{
typedef unary_type (*unary_fun)(any_type);
typedef binary_type (*binary_fun)(any_type, any_type);
typedef ternary_type (*ternary_fun)(any_type, any_type, any_type);
operator unary_fun();
operator binary_fun();
operator ternary_fun();
};
template<typename Formatter, bool IsFunction = boost::is_function<Formatter>::value>
struct formatter_wrapper
: Formatter
, unary_binary_ternary
{
formatter_wrapper(){}
};
template<typename Formatter>
struct formatter_wrapper<Formatter, true>
: unary_binary_ternary
{
operator Formatter *();
};
template<typename Formatter>
struct formatter_wrapper<Formatter *, false>
: unary_binary_ternary
{
operator Formatter *();
};
template <class F, class M, class O>
struct format_traits_imp
{
private:
//
// F must be a pointer, a function, or a class with a function call operator:
//
BOOST_STATIC_ASSERT((::boost::is_pointer<F>::value || ::boost::is_function<F>::value || ::boost::is_class<F>::value));
static formatter_wrapper<F> f;
static M m;
static O out;
static boost::regex_constants::match_flag_type flags;
public:
BOOST_STATIC_CONSTANT(int, value = sizeof(check_is_formatter(f(m), f(m, out), f(m, out, flags))));
};
template <class F, class M, class O>
struct format_traits
{
public:
//
// Type is mpl::int_<N> where N is one of:
//
// 0 : F is a pointer to a presumably null-terminated string.
// 1 : F is a character-container such as a std::string.
// 2 : F is a Unary Functor.
// 3 : F is a Binary Functor.
// 4 : F is a Ternary Functor.
//
typedef typename boost::mpl::if_<
boost::mpl::and_<boost::is_pointer<F>, boost::mpl::not_<boost::is_function<typename boost::remove_pointer<F>::type> > >,
boost::mpl::int_<0>,
typename boost::mpl::if_<
has_const_iterator<F>,
boost::mpl::int_<1>,
boost::mpl::int_<format_traits_imp<F, M, O>::value>
>::type
>::type type;
//
// This static assertion will fail if the functor passed does not accept
// the same type of arguments passed.
//
BOOST_STATIC_ASSERT( boost::is_class<F>::value && !has_const_iterator<F>::value ? (type::value > 1) : true);
};
#else // BOOST_NO_SFINAE
template <class F, class M, class O>
struct format_traits
{
public:
//
// Type is mpl::int_<N> where N is one of:
//
// 0 : F is a pointer to a presumably null-terminated string.
// 1 : F is a character-container such as a std::string.
//
// Other options such as F being a Functor are not supported without
// SFINAE support.
//
typedef typename boost::mpl::if_<
boost::is_pointer<F>,
boost::mpl::int_<0>,
boost::mpl::int_<1>
>::type type;
};
#endif // BOOST_NO_SFINAE
template <class Base, class Match>
struct format_functor3
{
format_functor3(Base b) : func(b) {}
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f)
{
return func(m, i, f);
}
template <class OutputIter, class Traits>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
{
return (*this)(m, i, f);
}
private:
Base func;
format_functor3(const format_functor3&);
format_functor3& operator=(const format_functor3&);
};
template <class Base, class Match>
struct format_functor2
{
format_functor2(Base b) : func(b) {}
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
{
return func(m, i);
}
template <class OutputIter, class Traits>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
{
return (*this)(m, i, f);
}
private:
Base func;
format_functor2(const format_functor2&);
format_functor2& operator=(const format_functor2&);
};
template <class Base, class Match>
struct format_functor1
{
format_functor1(Base b) : func(b) {}
template <class S, class OutputIter>
OutputIter do_format_string(const S& s, OutputIter i)
{
return re_detail::copy(s.begin(), s.end(), i);
}
template <class S, class OutputIter>
inline OutputIter do_format_string(const S* s, OutputIter i)
{
while(s && *s)
{
*i = *s;
++i;
++s;
}
return i;
}
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
{
return do_format_string(func(m), i);
}
template <class OutputIter, class Traits>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
{
return (*this)(m, i, f);
}
private:
Base func;
format_functor1(const format_functor1&);
format_functor1& operator=(const format_functor1&);
};
template <class charT, class Match, class Traits>
struct format_functor_c_string
{
format_functor_c_string(const charT* ps) : func(ps) {}
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits())
{
typedef typename Match::char_type char_type;
const charT* end = func;
while(*end) ++end;
return regex_format_imp(i, m, func, end, f, t);
}
private:
const charT* func;
format_functor_c_string(const format_functor_c_string&);
format_functor_c_string& operator=(const format_functor_c_string&);
};
template <class Container, class Match, class Traits>
struct format_functor_container
{
format_functor_container(const Container& c) : func(c) {}
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits())
{
typedef typename Match::char_type char_type;
return re_detail::regex_format_imp(i, m, func.begin(), func.end(), f, t);
}
private:
const Container& func;
format_functor_container(const format_functor_container&);
format_functor_container& operator=(const format_functor_container&);
};
template <class Func, class Match, class OutputIterator, class Traits = re_detail::trivial_format_traits<typename Match::char_type> >
struct compute_functor_type
{
typedef typename format_traits<Func, Match, OutputIterator>::type tag;
typedef typename boost::remove_cv< typename boost::remove_pointer<Func>::type>::type maybe_char_type;
typedef typename mpl::if_<
::boost::is_same<tag, mpl::int_<0> >, format_functor_c_string<maybe_char_type, Match, Traits>,
typename mpl::if_<
::boost::is_same<tag, mpl::int_<1> >, format_functor_container<Func, Match, Traits>,
typename mpl::if_<
::boost::is_same<tag, mpl::int_<2> >, format_functor1<Func, Match>,
typename mpl::if_<
::boost::is_same<tag, mpl::int_<3> >, format_functor2<Func, Match>,
format_functor3<Func, Match>
>::type
>::type
>::type
>::type type;
};
} // namespace re_detail
template <class OutputIterator, class Iterator, class charT>
OutputIterator regex_format(OutputIterator out,
const match_results<Iterator>& m,
const charT* fmt,
template <class OutputIterator, class Iterator, class Allocator, class Functor>
inline OutputIterator regex_format(OutputIterator out,
const match_results<Iterator, Allocator>& m,
Functor fmt,
match_flag_type flags = format_all
)
{
re_detail::trivial_format_traits<charT> traits;
return re_detail::regex_format_imp(out, m, fmt, fmt + traits.length(fmt), flags, traits);
return m.format(out, fmt, flags);
}
template <class OutputIterator, class Iterator, class charT>
OutputIterator regex_format(OutputIterator out,
const match_results<Iterator>& m,
const std::basic_string<charT>& fmt,
match_flag_type flags = format_all
)
{
re_detail::trivial_format_traits<charT> traits;
return re_detail::regex_format_imp(out, m, fmt.data(), fmt.data() + fmt.size(), flags, traits);
}
template <class Iterator, class charT>
std::basic_string<charT> regex_format(const match_results<Iterator>& m,
const charT* fmt,
template <class Iterator, class Allocator, class Functor>
inline std::basic_string<typename match_results<Iterator, Allocator>::char_type> regex_format(const match_results<Iterator, Allocator>& m,
Functor fmt,
match_flag_type flags = format_all)
{
std::basic_string<charT> result;
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
re_detail::trivial_format_traits<charT> traits;
re_detail::regex_format_imp(i, m, fmt, fmt + traits.length(fmt), flags, traits);
return result;
}
template <class Iterator, class charT>
std::basic_string<charT> regex_format(const match_results<Iterator>& m,
const std::basic_string<charT>& fmt,
match_flag_type flags = format_all)
{
std::basic_string<charT> result;
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
re_detail::trivial_format_traits<charT> traits;
re_detail::regex_format_imp(i, m, fmt.data(), fmt.data() + fmt.size(), flags, traits);
return result;
return m.format(fmt, flags);
}
#ifdef BOOST_MSVC

View File

@ -1,6 +1,6 @@
/*
*
* Copyright (c) 1998-2002
* Copyright (c) 1998-2009
* John Maddock
*
* Use, modification and distribution are subject to the
@ -35,12 +35,12 @@ namespace boost{
#pragma warning(pop)
#endif
template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
template <class OutputIterator, class BidirectionalIterator, class traits, class charT, class Formatter>
OutputIterator regex_replace(OutputIterator out,
BidirectionalIterator first,
BidirectionalIterator last,
const basic_regex<charT, traits>& e,
const charT* fmt,
Formatter fmt,
match_flag_type flags = match_default)
{
regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
@ -69,21 +69,10 @@ OutputIterator regex_replace(OutputIterator out,
return out;
}
template <class OutputIterator, class Iterator, class traits, class charT>
inline OutputIterator regex_replace(OutputIterator out,
Iterator first,
Iterator last,
const basic_regex<charT, traits>& e,
const std::basic_string<charT>& fmt,
match_flag_type flags = match_default)
{
return regex_replace(out, first, last, e, fmt.c_str(), flags);
}
template <class traits, class charT>
template <class traits, class charT, class Formatter>
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
const basic_regex<charT, traits>& e,
const charT* fmt,
Formatter fmt,
match_flag_type flags = match_default)
{
std::basic_string<charT> result;
@ -92,18 +81,6 @@ std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
return result;
}
template <class traits, class charT>
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
const basic_regex<charT, traits>& e,
const std::basic_string<charT>& fmt,
match_flag_type flags = match_default)
{
std::basic_string<charT> result;
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
regex_replace(i, s.begin(), s.end(), e, fmt.c_str(), flags);
return result;
}
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)

View File

@ -84,7 +84,7 @@ inline bool is_combining<unsigned char>(unsigned char)
{
return false;
}
#ifndef __hpux // can't use WCHAR_MAX/MIN in pp-directives
#if !defined(__hpux) && !defined(__WINSCW__) // can't use WCHAR_MAX/MIN in pp-directives
#ifdef _MSC_VER
template<>
inline bool is_combining<wchar_t>(wchar_t c)
@ -322,7 +322,7 @@ inline const charT* get_escape_R_string()
{
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable:4309)
# pragma warning(disable:4309 4245)
#endif
static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}',

View File

@ -248,6 +248,14 @@ struct re_repeat : public re_alt
bool greedy; // True if this is a greedy repeat
};
/*** struct re_recurse ************************************************
Recurse to a particular subexpression.
**********************************************************************/
struct re_recurse : public re_jump
{
int state_id; // identifier of first nested repeat within the recursion.
};
/*** enum re_jump_size_type *******************************************
Provides compiled size of re_jump structure (allowing for trailing alignment).
We provide this so we know how manybytes to insert when constructing the machine

View File

@ -178,7 +178,7 @@ inline u32regex_iterator<typename std::basic_string<charT, Traits, Alloc>::const
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
return u32regex_iterator<iter_type>(p.begin(), p.end(), e, m);
}
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UnicodeString& s, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
{
return u32regex_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, m);
}

View File

@ -294,7 +294,7 @@ inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>:
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
}
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
{
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
}
@ -327,7 +327,7 @@ inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>:
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
}
template <std::size_t N>
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
{
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
}
@ -356,7 +356,7 @@ inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>:
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
}
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
{
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
}

View File

@ -17,6 +17,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/assert.hpp>
#include <pthread.h>
namespace boost
@ -42,15 +43,15 @@ public:
// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
#if defined(__hpux) && defined(_DECTHREADS_)
pthread_mutex_init(&m_, pthread_mutexattr_default);
BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 );
#else
pthread_mutex_init(&m_, 0);
BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 );
#endif
}
~lightweight_mutex()
{
pthread_mutex_destroy(&m_);
BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 );
}
class scoped_lock;
@ -69,12 +70,12 @@ public:
scoped_lock(lightweight_mutex & m): m_(m.m_)
{
pthread_mutex_lock(&m_);
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
}
~scoped_lock()
{
pthread_mutex_unlock(&m_);
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
}
};
};

View File

@ -74,8 +74,9 @@ template<unsigned size, unsigned align_> struct allocator_impl
static lightweight_mutex & mutex()
{
static lightweight_mutex m;
return m;
static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm;
static lightweight_mutex * pm = new( &fbm ) lightweight_mutex;
return *pm;
}
static lightweight_mutex * mutex_init;

View File

@ -25,7 +25,7 @@
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x610 )
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x620 )
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif

View File

@ -30,9 +30,9 @@ namespace detail
inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ )
{
__asm__ __volatile__( "cas %0, %2, %1"
: "+m" (*dest_), "+r" (swap_)
: "r" (compare_)
__asm__ __volatile__( "cas [%1], %2, %0"
: "+r" (swap_)
: "r" (dest_), "r" (compare_)
: "memory" );
return swap_;

View File

@ -40,7 +40,7 @@
#undef BOOST_SP_HAS_SYNC
#endif
#if defined( __INTEL_COMPILER ) && !defined( __ia64__ )
#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1100 )
#undef BOOST_SP_HAS_SYNC
#endif

View File

@ -77,7 +77,7 @@ public:
template<class U>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
intrusive_ptr( intrusive_ptr<U> const & rhs, typename detail::sp_enable_if_convertible<U,T>::type = detail::sp_empty() )
intrusive_ptr( intrusive_ptr<U> const & rhs, typename boost::detail::sp_enable_if_convertible<U,T>::type = boost::detail::sp_empty() )
#else
@ -122,7 +122,7 @@ public:
intrusive_ptr & operator=(intrusive_ptr && rhs)
{
this_type(std::move(rhs)).swap(*this);
this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this);
return *this;
}

View File

@ -86,10 +86,12 @@ public:
}
};
template< class T > T forward( T t )
#if defined( BOOST_HAS_RVALUE_REFS )
template< class T > T&& forward( T &&t )
{
return t;
}
#endif
} // namespace detail

View File

@ -228,7 +228,7 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
shared_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@ -353,7 +353,7 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
shared_ptr( shared_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
shared_ptr( shared_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@ -368,14 +368,14 @@ public:
shared_ptr & operator=( shared_ptr && r ) // never throws
{
this_type( std::move( r ) ).swap( *this );
this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
return *this;
}
template<class Y>
shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
{
this_type( std::move( r ) ).swap( *this );
this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
return *this;
}
@ -448,7 +448,7 @@ public:
return pn < rhs.pn;
}
void * _internal_get_deleter( detail::sp_typeinfo const & ti ) const
void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
{
return pn.get_deleter( ti );
}

View File

@ -63,7 +63,7 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
weak_ptr( weak_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@ -79,20 +79,20 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
weak_ptr( weak_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
weak_ptr( weak_ptr<Y> && r )
#endif
: px(r.lock().get()), pn(std::move(r.pn)) // never throws
: px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
{
r.px = 0;
}
// for better efficiency in the T == Y case
weak_ptr( weak_ptr && r ): px( r.px ), pn(std::move(r.pn)) // never throws
weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
{
r.px = 0;
}
@ -100,7 +100,7 @@ public:
// for better efficiency in the T == Y case
weak_ptr & operator=( weak_ptr && r ) // never throws
{
this_type( std::move( r ) ).swap( *this );
this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
return *this;
}
@ -110,7 +110,7 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
weak_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@ -134,9 +134,9 @@ public:
#if defined( BOOST_HAS_RVALUE_REFS )
template<class Y>
weak_ptr & operator=(weak_ptr<Y> && r)
weak_ptr & operator=( weak_ptr<Y> && r )
{
this_type( std::move( r ) ).swap( *this );
this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
return *this;
}

View File

@ -22,6 +22,7 @@
#include <boost/exception/detail/attribute_noreturn.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/config.hpp>
#include <exception>
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
@ -38,7 +39,7 @@
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
::boost::throw_file(__FILE__) <<\
::boost::throw_line((int)__LINE__))
::boost::throw_line(__LINE__))
#else
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
#endif

View File

@ -26,7 +26,7 @@ namespace detail {
template <typename T>
struct has_new_operator_impl {
template<class U>
static type_traits::yes_type check_sig(
static type_traits::yes_type check_sig1(
U*,
test<
void *(*)(std::size_t),
@ -34,64 +34,85 @@ namespace detail {
>* = NULL
);
template<class U>
static type_traits::yes_type check_sig(
U*,
test<
void *(*)(std::size_t, const std::nothrow_t&),
&U::operator new
>* = NULL
);
template<class U>
static type_traits::yes_type check_sig(
U*,
test<
void *(*)(std::size_t, void*),
&U::operator new
>* = NULL
);
template<class U>
static type_traits::no_type check_sig(...);
static type_traits::no_type check_sig1(...);
template<class U>
static type_traits::yes_type check_sig2(
U*,
test<
void *(*)(std::size_t),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::yes_type check_sig2(
U*,
test<
void *(*)(std::size_t, const std::nothrow_t&),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::yes_type check_sig2(
U*,
test<
void *(*)(std::size_t, void*),
&U::operator new[]
&U::operator new
>* = NULL
);
template<class U>
static type_traits::no_type check_sig2(...);
template<class U>
static type_traits::yes_type check_sig3(
U*,
test<
void *(*)(std::size_t, void*),
&U::operator new
>* = NULL
);
template<class U>
static type_traits::no_type check_sig3(...);
template<class U>
static type_traits::yes_type check_sig4(
U*,
test<
void *(*)(std::size_t),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::no_type check_sig4(...);
template<class U>
static type_traits::yes_type check_sig5(
U*,
test<
void *(*)(std::size_t, const std::nothrow_t&),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::no_type check_sig5(...);
template<class U>
static type_traits::yes_type check_sig6(
U*,
test<
void *(*)(std::size_t, void*),
&U::operator new[]
>* = NULL
);
template<class U>
static type_traits::no_type check_sig6(...);
// GCC2 won't even parse this template if we embed the computation
// of s1 in the computation of value.
#ifdef __GNUC__
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig1<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl<T>::template check_sig2<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(has_new_operator_impl<T>::template check_sig3<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(has_new_operator_impl<T>::template check_sig4<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(has_new_operator_impl<T>::template check_sig5<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(has_new_operator_impl<T>::template check_sig6<T>(0)));
#else
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(push)
#pragma warning(disable:6334)
#endif
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig1<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(check_sig3<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(check_sig4<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(check_sig5<T>(0)));
BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(check_sig6<T>(0)));
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
#pragma warning(pop)
@ -100,7 +121,11 @@ namespace detail {
BOOST_STATIC_CONSTANT(bool, value =
(::boost::type_traits::ice_or<
(s1 == sizeof(type_traits::yes_type)),
(s2 == sizeof(type_traits::yes_type))
(s2 == sizeof(type_traits::yes_type)),
(s3 == sizeof(type_traits::yes_type)),
(s4 == sizeof(type_traits::yes_type)),
(s5 == sizeof(type_traits::yes_type)),
(s6 == sizeof(type_traits::yes_type))
>::value)
);
};

View File

@ -149,7 +149,7 @@
# define BOOST_IS_CLASS(T) __is_class(T)
# define BOOST_IS_ENUM(T) __is_enum(T)
# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
# if !defined(unix) || defined(__LP64__)
# if (!defined(unix) && !defined(__unix__)) || defined(__LP64__)
// GCC sometimes lies about alignment requirements
// of type double on 32-bit unix platforms, use the
// old implementation instead in that case:

View File

@ -0,0 +1,50 @@
// (C) Copyright Rani Sharoni 2003-2005.
// 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/type_traits for most recent version including documentation.
#ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
#define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/detail/ice_or.hpp>
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost { namespace tr1{
namespace detail{
template <class B, class D>
struct is_base_of_imp
{
typedef typename remove_cv<B>::type ncvB;
typedef typename remove_cv<D>::type ncvD;
BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or<
(::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value),
(::boost::is_same<ncvB,ncvD>::value)>::value));
};
}
BOOST_TT_AUX_BOOL_TRAIT_DEF2(
is_base_of
, Base
, Derived
, (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value))
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false)
#endif
} } // namespace boost
#include <boost/type_traits/detail/bool_trait_undef.hpp>
#endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED

View File

@ -26,11 +26,19 @@ namespace detail{
#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
template <class T>
struct is_signed_values
{
typedef typename remove_cv<T>::type no_cv_t;
BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
};
template <class T>
struct is_signed_helper
{
typedef typename remove_cv<T>::type no_cv_t;
BOOST_STATIC_CONSTANT(bool, value = (!(static_cast<no_cv_t>(-1) > 0)));
BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values<T>::minus_one > boost::detail::is_signed_values<T>::zero)));
};
template <bool integral_type>

View File

@ -27,10 +27,17 @@ namespace detail{
#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
template <class T>
struct is_ununsigned_helper
struct is_unsigned_values
{
typedef typename remove_cv<T>::type no_cv_t;
BOOST_STATIC_CONSTANT(bool, value = (static_cast<no_cv_t>(-1) > 0));
BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
};
template <class T>
struct is_ununsigned_helper
{
BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values<T>::minus_one > ::boost::detail::is_unsigned_values<T>::zero));
};
template <bool integral_type>

View File

@ -114,8 +114,6 @@ class value_initialized
template<class T>
T const& get ( value_initialized<T> const& x )
{

View File

@ -19,7 +19,7 @@
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 104100
#define BOOST_VERSION 104200
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
@ -27,7 +27,7 @@
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to link to.
#define BOOST_LIB_VERSION "1_41"
#define BOOST_LIB_VERSION "1_42"
#endif

View File

@ -42,7 +42,7 @@ void cpp_regex_traits_char_layer<char>::init()
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
#endif
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
if(cat_name.size())
if(cat_name.size() && (m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,

View File

@ -563,11 +563,7 @@ std::string RegEx::What(int i)const
return result;
}
#ifdef BOOST_HAS_LONG_LONG
const std::size_t RegEx::npos = static_cast<std::size_t>(~0ULL);
#else
const std::size_t RegEx::npos = static_cast<std::size_t>(~0UL);
#endif
const std::size_t RegEx::npos = ~static_cast<std::size_t>(0);
} // namespace boost

View File

@ -258,11 +258,22 @@ void mapfile::lock(pointer* node)const
*p = 0;
*(reinterpret_cast<int*>(*node)) = 1;
}
std::fseek(hfile, (node - _first) * buf_size, SEEK_SET);
if(node == _last - 1)
std::fread(*node + sizeof(int), _size % buf_size, 1, hfile);
else
std::fread(*node + sizeof(int), buf_size, 1, hfile);
std::size_t read_size = 0;
int read_pos = std::fseek(hfile, (node - _first) * buf_size, SEEK_SET);
if(0 == read_pos && node == _last - 1)
read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile);
else
read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile);
#ifndef BOOST_NO_EXCEPTIONS
if((read_size == 0) || (std::ferror(hfile)))
{
throw std::runtime_error("Unable to read file.");
}
#else
BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0));
#endif
}
else
{

View File

@ -58,6 +58,7 @@ const char* names[] = {
"REG_EMPTY",
"REG_ECOMPLEXITY",
"REG_ESTACK",
"REG_E_PERL",
"REG_E_UNKNOWN",
};
} // namespace

View File

@ -111,30 +111,31 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants
BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n)
{
static const char* const s_default_error_messages[] = {
"Success", /* REG_NOERROR */
"No match", /* REG_NOMATCH */
"Invalid regular expression", /* REG_BADPAT */
"Invalid collation character", /* REG_ECOLLATE */
"Invalid character class name", /* REG_ECTYPE */
"Invalid or trailing backslash", /* REG_EESCAPE */
"Invalid back reference", /* REG_ESUBREG */
"Unmatched [ or [^", /* REG_EBRACK */
"Unmatched ( or \\(", /* REG_EPAREN */
"Unmatched { or \\{", /* REG_EBRACE */
"Invalid content of repeat range", /* REG_BADBR */
"Invalid range end", /* REG_ERANGE */
"Memory exhausted", /* REG_ESPACE */
"Invalid preceding regular expression", /* REG_BADRPT */
"Premature end of regular expression", /* REG_EEND */
"Regular expression too big", /* REG_ESIZE */
"Unmatched ) or \\)", /* REG_ERPAREN */
"Empty expression", /* REG_EMPTY */
"Complexity requirements exceeded", /* REG_ECOMPLEXITY */
"Out of stack space", /* REG_ESTACK */
"Unknown error", /* REG_E_UNKNOWN */
"",
"",
"",
"Success", /* REG_NOERROR 0 error_ok */
"No match", /* REG_NOMATCH 1 error_no_match */
"Invalid regular expression.", /* REG_BADPAT 2 error_bad_pattern */
"Invalid collation character.", /* REG_ECOLLATE 3 error_collate */
"Invalid character class name, collating name, or character range.", /* REG_ECTYPE 4 error_ctype */
"Invalid or unterminated escape sequence.", /* REG_EESCAPE 5 error_escape */
"Invalid back reference: specified capturing group does not exist.", /* REG_ESUBREG 6 error_backref */
"Unmatched [ or [^ in character class declaration.", /* REG_EBRACK 7 error_brack */
"Unmatched marking parenthesis ( or \\(.", /* REG_EPAREN 8 error_paren */
"Unmatched quantified repeat operator { or \\{.", /* REG_EBRACE 9 error_brace */
"Invalid content of repeat range.", /* REG_BADBR 10 error_badbrace */
"Invalid range end in character class", /* REG_ERANGE 11 error_range */
"Out of memory.", /* REG_ESPACE 12 error_space NOT USED */
"Invalid preceding regular expression prior to repetition operator.", /* REG_BADRPT 13 error_badrepeat */
"Premature end of regular expression", /* REG_EEND 14 error_end NOT USED */
"Regular expression is too large.", /* REG_ESIZE 15 error_size NOT USED */
"Unmatched ) or \\)", /* REG_ERPAREN 16 error_right_paren NOT USED */
"Empty regular expression.", /* REG_EMPTY 17 error_empty */
"The complexity of matching the regular expression exceeded predefined bounds. "
"Try refactoring the regular expression to make each choice made by the state machine unambiguous. "
"This exception is thrown to prevent \"eternal\" matches that take an "
"indefinite period time to locate.", /* REG_ECOMPLEXITY 18 error_complexity */
"Ran out of stack space trying to match the regular expression.", /* REG_ESTACK 19 error_stack */
"Invalid or unterminated Perl (?...) sequence.", /* REG_E_PERL 20 error_perl */
"Unknown error.", /* REG_E_UNKNOWN 21 error_unknown */
};
return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n];

View File

@ -124,7 +124,7 @@ void scoped_static_mutex_lock::unlock()
boost::recursive_mutex* static_mutex::m_pmutex = 0;
boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT;
extern "C" BOOST_REGEX_DECL void free_static_mutex()
extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex()
{
delete static_mutex::m_pmutex;
static_mutex::m_pmutex = 0;
@ -133,7 +133,7 @@ extern "C" BOOST_REGEX_DECL void free_static_mutex()
void static_mutex::init()
{
m_pmutex = new boost::recursive_mutex();
int r = atexit(free_static_mutex);
int r = atexit(boost_regex_free_static_mutex);
BOOST_ASSERT(0 == r);
}
@ -157,7 +157,7 @@ void scoped_static_mutex_lock::lock()
{
boost::call_once(static_mutex::m_once,&static_mutex::init);
if(0 == m_plock)
m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, false);
m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, boost::defer_lock);
m_plock->lock();
m_have_lock = true;
}

View File

@ -17,6 +17,9 @@
*/
#define BOOST_REGEX_SOURCE
#ifdef _MSC_VER
#pragma warning(disable:4506) // 'no definition for inline function'
#endif
#include <boost/detail/workaround.hpp>
#include <memory>

View File

@ -65,6 +65,7 @@ const wchar_t* wnames[] = {
L"REG_EMPTY",
L"REG_ECOMPLEXITY",
L"REG_ESTACK",
L"REG_E_PERL",
L"REG_E_UNKNOWN",
};
}