update to boost 1.32.0

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9274 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-11-20 09:08:45 +00:00
parent 64df828719
commit 2349a51b12
518 changed files with 14280 additions and 16950 deletions

View File

@ -1,3 +1,7 @@
2004-11-20 Lars Gullik Bjonnes <larsbj@gullik.net>
* update boost to version 1.32.0
2004-04-03 Lars Gullik Bjonnes <larsbj@gullik.net>
* libs/filesystem/src/Makefile.am (AM_CXXFLAGS): define

23
boost/LICENSE_1_0.txt Normal file
View File

@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@ -180,10 +180,8 @@ namespace boost
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.
// 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)
#endif

View File

@ -4,26 +4,29 @@
* See
* http://www.josuttis.com/cppcode
* for details and the latest version.
* See
* http://www.boost.org/libs/array for Documentation.
* for documentation.
*
* (C) Copyright Nicolai M. Josuttis 2001.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
* 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)
*
* 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis)
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
* 05 Aug 2001 - minor update (Nico Josuttis)
* 20 Jan 2001 - STLport fix (Beman Dawes)
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
*
* Jan 29, 2004
*/
// See http://www.boost.org/libs/array for Documentation.
#ifndef BOOST_ARRAY_HPP
#define BOOST_ARRAY_HPP
#include <cstddef>
#include <stdexcept>
#include <boost/assert.hpp>
// Handles broken standard libraries better than <iterator>
#include <boost/detail/iterator.hpp>
@ -32,6 +35,7 @@
// FIXES for broken compilers
#include <boost/config.hpp>
namespace boost {
template<class T, std::size_t N>
@ -81,18 +85,42 @@ namespace boost {
}
// operator[]
reference operator[](size_type i) { return elems[i]; }
const_reference operator[](size_type i) const { return elems[i]; }
reference operator[](size_type i)
{
BOOST_ASSERT( i < N && "out of range" );
return elems[i];
}
const_reference operator[](size_type i) const
{
BOOST_ASSERT( i < N && "out of range" );
return elems[i];
}
// at() with range check
reference at(size_type i) { rangecheck(i); return elems[i]; }
const_reference at(size_type i) const { rangecheck(i); return elems[i]; }
// front() and back()
reference front() { return elems[0]; }
const_reference front() const { return elems[0]; }
reference back() { return elems[N-1]; }
const_reference back() const { return elems[N-1]; }
reference front()
{
return elems[0];
}
const_reference front() const
{
return elems[0];
}
reference back()
{
return elems[N-1];
}
const_reference back() const
{
return elems[N-1];
}
// size is constant
static size_type size() { return N; }
@ -105,9 +133,12 @@ namespace boost {
std::swap_ranges(begin(),end(),y.begin());
}
// direct access to data
// direct access to data (read-only)
const T* data() const { return elems; }
// use array as C array (direct read/write access to data)
T* c_array() { return elems; }
// assignment with type conversion
template <typename T2>
array<T,N>& operator= (const array<T2,N>& rhs) {
@ -121,12 +152,11 @@ namespace boost {
std::fill_n(begin(),size(),value);
}
#ifndef BOOST_NO_PRIVATE_IN_AGGREGATE
private:
#endif
// check range (may be private because it is static)
static void rangecheck (size_type i) {
if (i >= size()) { throw std::range_error("array"); }
if (i >= size()) {
throw std::range_error("array<>: index out of range");
}
}
};
@ -166,10 +196,3 @@ namespace boost {
} /* namespace boost */
#endif /*BOOST_ARRAY_HPP*/

View File

@ -3,10 +3,9 @@
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// Note: There are no include guards. This is intentional.
//

View File

@ -10,13 +10,12 @@
//
// bind.hpp - binds function objects to arguments
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2001 David Abrahams
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/bind.html for documentation.
//
@ -26,6 +25,7 @@
#include <boost/mem_fn.hpp>
#include <boost/type.hpp>
#include <boost/bind/arg.hpp>
#include <boost/detail/workaround.hpp>
// Borland-specific bug, visit_each() silently fails to produce code
@ -69,6 +69,18 @@ template<class F> struct result_traits< unspecified, reference_wrapper<F> >
#endif
// ref_compare
template<class T> bool ref_compare(T const & a, T const & b, long)
{
return a == b;
}
template<class T> bool ref_compare(reference_wrapper<T> const & a, reference_wrapper<T> const & b, int)
{
return a.get_pointer() == b.get_pointer();
}
// bind_t forward declaration for listN
template<class R, class F, class L> class bind_t;
@ -84,6 +96,11 @@ public:
T & get() { return t_; }
T const & get() const { return t_; }
bool operator==(value const & rhs) const
{
return t_ == rhs.t_;
}
private:
T t_;
@ -95,38 +112,41 @@ template<class T> class type {};
// unwrap
template<class F> inline F & unwrap(F & f, long)
template<class F> inline F & unwrap(F * f, long)
{
return f;
return *f;
}
template<class F> inline F & unwrap(reference_wrapper<F> & f, int)
template<class F> inline F & unwrap(reference_wrapper<F> * f, int)
{
return f;
return f->get();
}
template<class F> inline F & unwrap(reference_wrapper<F> const & f, int)
template<class F> inline F & unwrap(reference_wrapper<F> const * f, int)
{
return f;
return f->get();
}
// listN
#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3003) )
#ifdef BOOST_NO_VOID_RETURNS
template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* * pm, int)
{
return _mfi::dm<R, T>(*pm);
}
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
// IBM/VisualAge 6.0 is not able to handle this overload.
template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* const * pm, int)
{
return _mfi::dm<R, T>(*pm);
}
#endif
template <class R> struct evaluator0;
template <class R> struct evaluator1;
template <class R> struct evaluator2;
template <class R> struct evaluator3;
template <class R> struct evaluator4;
template <class R> struct evaluator5;
template <class R> struct evaluator6;
template <class R> struct evaluator7;
template <class R> struct evaluator8;
template <class R> struct evaluator9;
#endif
// listN
class list0
{
public:
@ -143,29 +163,34 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A &)
template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
{
return unwrap(f, 0)();
return unwrap(&f, 0)();
}
template<class R, class F, class A> R operator()(type<R>, F f, A &) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
{
return unwrap(f, 0)();
return unwrap(&f, 0)();
}
template<class F, class A> void operator()(type<void>, F & f, A &, int)
{
unwrap(&f, 0)();
}
template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
{
unwrap(&f, 0)();
}
template<class V> void accept(V &) const
{
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list0 const &) const
{
typedef evaluator0<R> type;
};
#endif
return true;
}
};
template<class A1> class list1
@ -188,14 +213,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_]);
return unwrap(&f, 0)(a[a1_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_]);
return unwrap(&f, 0)(a[a1_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_]);
}
template<class V> void accept(V & v) const
@ -203,19 +238,13 @@ public:
BOOST_BIND_VISIT_EACH(v, a1_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list1 const & rhs) const
{
typedef evaluator1<R> type;
};
#else
return ref_compare(a1_, rhs.a1_, 0);
}
private:
#endif
A1 a1_;
};
@ -241,14 +270,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_]);
return unwrap(&f, 0)(a[a1_], a[a2_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_]);
return unwrap(&f, 0)(a[a1_], a[a2_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_]);
}
template<class V> void accept(V & v) const
@ -257,19 +296,13 @@ public:
BOOST_BIND_VISIT_EACH(v, a2_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list2 const & rhs) const
{
typedef evaluator2<R> type;
};
#else
return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
};
@ -298,14 +331,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
}
template<class V> void accept(V & v) const
@ -315,19 +358,13 @@ public:
BOOST_BIND_VISIT_EACH(v, a3_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list3 const & rhs) const
{
typedef evaluator3<R> type;
};
#else
return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -359,14 +396,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
}
template<class V> void accept(V & v) const
@ -377,19 +424,15 @@ public:
BOOST_BIND_VISIT_EACH(v, a4_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list4 const & rhs) const
{
typedef evaluator4<R> type;
};
#else
return
ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
ref_compare(a4_, rhs.a4_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -424,14 +467,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
}
template<class V> void accept(V & v) const
@ -443,19 +496,15 @@ public:
BOOST_BIND_VISIT_EACH(v, a5_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list5 const & rhs) const
{
typedef evaluator5<R> type;
};
#else
return
ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -493,14 +542,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
}
template<class V> void accept(V & v) const
@ -513,19 +572,15 @@ public:
BOOST_BIND_VISIT_EACH(v, a6_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list6 const & rhs) const
{
typedef evaluator6<R> type;
};
#else
return
ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -566,14 +621,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
}
template<class V> void accept(V & v) const
@ -587,19 +652,16 @@ public:
BOOST_BIND_VISIT_EACH(v, a7_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list7 const & rhs) const
{
typedef evaluator7<R> type;
};
#else
return
ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) &&
ref_compare(a7_, rhs.a7_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -643,14 +705,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
}
template<class V> void accept(V & v) const
@ -665,19 +737,16 @@ public:
BOOST_BIND_VISIT_EACH(v, a8_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list8 const & rhs) const
{
typedef evaluator8<R> type;
};
#else
return
ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) &&
ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -724,14 +793,24 @@ public:
template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
template<class R, class F, class A> R operator()(type<R>, F f, A & a)
template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
}
template<class R, class F, class A> R operator()(type<R>, F f, A & a) const
template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
{
return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
}
template<class F, class A> void operator()(type<void>, F & f, A & a, int)
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
}
template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
{
unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
}
template<class V> void accept(V & v) const
@ -747,19 +826,16 @@ public:
BOOST_BIND_VISIT_EACH(v, a9_, 0);
}
#ifdef BOOST_NO_VOID_RETURNS
template<class R> struct evaluator
bool operator==(list9 const & rhs) const
{
typedef evaluator9<R> type;
};
#else
return
ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) &&
ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0) && ref_compare(a9_, rhs.a9_, 0);
}
private:
#endif
A1 a1_;
A2 a2_;
A3 a3_;
@ -771,190 +847,6 @@ private:
A9 a9_;
};
#ifdef BOOST_NO_VOID_RETURNS
template <class R> struct evaluator0
{
template<class L, class F, class A>
static R eval(L &, F f, A &)
{
return unwrap(f, 0)();
}
};
template <> struct evaluator0<void>
{
template<class L, class F, class A>
static void eval(L &, F f, A &)
{
unwrap(f, 0)();
}
};
template <class R> struct evaluator1
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_]);
}
};
template <> struct evaluator1<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_]);
}
};
template <class R> struct evaluator2
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_]);
}
};
template <> struct evaluator2<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_]);
}
};
template <class R> struct evaluator3
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_]);
}
};
template <> struct evaluator3<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_]);
}
};
template <class R> struct evaluator4
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_]);
}
};
template <> struct evaluator4<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_]);
}
};
template <class R> struct evaluator5
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_]);
}
};
template <> struct evaluator5<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_]);
}
};
template <class R> struct evaluator6
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_]);
}
};
template <> struct evaluator6<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_]);
}
};
template <class R> struct evaluator7
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_]);
}
};
template <> struct evaluator7<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_]);
}
};
template <class R> struct evaluator8
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_]);
}
};
template <> struct evaluator8<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_]);
}
};
template <class R> struct evaluator9
{
template<class L, class F, class A>
static R eval(L & l, F f, A & a)
{
return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_], a[l.a9_]);
}
};
template <> struct evaluator9<void>
{
template<class L, class F, class A>
static void eval(L & l, F f, A & a)
{
unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_], a[l.a9_]);
}
};
#endif
// bind_t
#ifndef BOOST_NO_VOID_RETURNS
@ -963,11 +855,13 @@ template<class R, class F, class L> class bind_t
{
public:
typedef bind_t this_type;
bind_t(F f, L const & l): f_(f), l_(l) {}
#define BOOST_BIND_EVALUATE return l_(type<result_type>(), f_, a)
#define BOOST_BIND_RETURN return
#include <boost/bind/bind_template.hpp>
#undef BOOST_BIND_EVALUATE
#undef BOOST_BIND_RETURN
};
@ -980,11 +874,13 @@ template<class F, class L> class implementation
{
public:
typedef implementation this_type;
implementation(F f, L const & l): f_(f), l_(l) {}
#define BOOST_BIND_EVALUATE return L::BOOST_NESTED_TEMPLATE evaluator<result_type>::type::eval(l_, f_, a);
#define BOOST_BIND_RETURN return
#include <boost/bind/bind_template.hpp>
#undef BOOST_BIND_EVALUATE
#undef BOOST_BIND_RETURN
};
@ -1001,11 +897,13 @@ private:
public:
typedef implementation this_type;
implementation(F f, L const & l): f_(f), l_(l) {}
#define BOOST_BIND_EVALUATE L::BOOST_NESTED_TEMPLATE evaluator<result_type>::type::eval(l_, f_, a);
#define BOOST_BIND_RETURN
#include <boost/bind/bind_template.hpp>
#undef BOOST_BIND_EVALUATE
#undef BOOST_BIND_RETURN
};
@ -1021,6 +919,18 @@ public:
#endif
// bind_t::operator==
template<class R, class F, class L> bool operator==(bind_t<R, F, L> const & a, bind_t<R, F, L> const & b)
{
return a.compare(b);
}
template<class R, class F, class L> bool operator!=(bind_t<R, F, L> const & a, bind_t<R, F, L> const & b)
{
return !a.compare(b);
}
// add_value
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
@ -1186,18 +1096,6 @@ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, c
typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
};
// g++ 2.95 specific helper; used by the data member overload
template<class T> struct add_cref
{
typedef T const & type;
};
template<> struct add_cref<void>
{
typedef void type;
};
} // namespace _bi
// visit_each
@ -1550,8 +1448,30 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
// data member pointers
/*
#if defined(__GNUC__) && (__GNUC__ == 2)
namespace _bi
{
template<class T> struct add_cref
{
typedef T const & type;
};
template<class T> struct add_cref< T & >
{
typedef T const & type;
};
template<> struct add_cref<void>
{
typedef void type;
};
} // namespace _bi
template<class R, class T, class A1>
_bi::bind_t< typename _bi::add_cref<R>::type, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
BOOST_BIND(R T::*f, A1 a1)
@ -1574,6 +1494,17 @@ _bi::bind_t< R const &, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
#endif
*/
template<class R, class T, class A1>
_bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
BOOST_BIND(R T::*f, A1 a1)
{
typedef _mfi::dm<R, T> F;
typedef typename _bi::list_av_1<A1>::type list_type;
return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
}
} // namespace boost
#ifndef BOOST_BIND_NO_PLACEHOLDERS

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
namespace boost

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/bind.html for documentation.
//
@ -27,6 +26,11 @@ template<int I> class arg
{
};
template<int I> bool operator==(arg<I> const &, arg<I> const &)
{
return true;
}
} // namespace boost
#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED

View File

@ -5,10 +5,9 @@
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/bind.html for documentation.
//

View File

@ -5,10 +5,9 @@
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/bind.html for documentation.
//

View File

@ -3,12 +3,11 @@
//
// Do not include this header directly.
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/bind.html for documentation.
//
@ -18,131 +17,131 @@
result_type operator()()
{
list0 a;
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
result_type operator()() const
{
list0 a;
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1> result_type operator()(A1 & a1)
{
list1<A1 &> a(a1);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1> result_type operator()(A1 & a1) const
{
list1<A1 &> a(a1);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
{
list2<A1 &, A2 &> a(a1, a2);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
{
list2<A1 &, A2 &> a(a1, a2);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
{
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
{
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
{
list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
{
list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
{
list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
{
list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
{
list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
{
list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
{
list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
{
list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
{
list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
{
list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
{
list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
{
list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A> result_type eval(A & a)
{
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class A> result_type eval(A & a) const
{
BOOST_BIND_EVALUATE;
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
}
template<class V> void accept(V & v) const
@ -151,6 +150,11 @@
l_.accept(v);
}
bool compare(this_type const & rhs) const
{
return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_;
}
private:
F f_;

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
namespace boost
@ -18,10 +17,6 @@ namespace boost
namespace _bi
{
template<class F> void instantiate(F)
{
}
template<class R, class F> class af0
{
public:
@ -37,6 +32,11 @@ public:
return f_();
}
result_type operator()() const
{
return f_();
}
private:
F f_;
@ -59,6 +59,11 @@ public:
return f_(a1);
}
result_type operator()(A1 a1) const
{
return f_(a1);
}
private:
F f_;
@ -83,6 +88,11 @@ public:
return f_(a1, a2);
}
result_type operator()(A1 a1, A2 a2) const
{
return f_(a1, a2);
}
private:
F f_;
@ -106,6 +116,11 @@ public:
return f_(a1, a2, a3);
}
result_type operator()(A1 a1, A2 a2, A3 a3) const
{
return f_(a1, a2, a3);
}
private:
F f_;
@ -130,6 +145,11 @@ public:
return f_(a1, a2, a3, a4);
}
result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const
{
return f_(a1, a2, a3, a4);
}
private:
F f_;
@ -139,31 +159,26 @@ private:
template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
{
_bi::instantiate( &_bi::af0<R, F>::operator() ); // for early error detection
return _bi::af0<R, F>(f);
}
template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
{
instantiate( &_bi::af1<R, A1, F>::operator() );
return _bi::af1<R, A1, F>(f);
}
template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
{
instantiate( &_bi::af2<R, A1, A2, F>::operator() );
return _bi::af2<R, A1, A2, F>(f);
}
template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
{
instantiate( &_bi::af3<R, A1, A2, A3, F>::operator() );
return _bi::af3<R, A1, A2, A3, F>(f);
}
template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f)
{
instantiate( &_bi::af4<R, A1, A2, A3, A4, F>::operator() );
return _bi::af4<R, A1, A2, A3, A4, F>(f);
}

View File

@ -5,10 +5,9 @@
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
//

View File

@ -5,10 +5,9 @@
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
//
@ -55,6 +54,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)();
}
bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf0
@ -94,6 +103,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)();
}
bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf1
@ -139,6 +158,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1);
}
bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf1
@ -179,6 +208,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1);
}
bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf2
@ -222,6 +261,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
}
bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf2
@ -260,6 +309,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
}
bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf3
@ -303,6 +362,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
}
bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf3
@ -341,6 +410,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
}
bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf4
@ -384,6 +463,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
}
bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf4
@ -422,6 +511,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
}
bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf5
@ -465,6 +564,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
}
bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf5
@ -503,6 +612,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
}
bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf6
@ -546,6 +665,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
}
bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf6
@ -584,6 +713,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
}
bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf7
@ -627,6 +766,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
}
bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf7
@ -665,6 +814,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
}
bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const
{
return f_ != rhs.f_;
}
};
// mf8
@ -708,6 +867,16 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
}
bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const
{
return f_ != rhs.f_;
}
};
// cmf8
@ -751,5 +920,15 @@ public:
{
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
}
bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const
{
return f_ == rhs.f_;
}
bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const
{
return f_ != rhs.f_;
}
};

View File

@ -5,10 +5,9 @@
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
//

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/bind/bind.html for documentation.
//
@ -38,7 +37,7 @@ static inline boost::arg<7> _7() { return boost::arg<7>(); }
static inline boost::arg<8> _8() { return boost::arg<8>(); }
static inline boost::arg<9> _9() { return boost::arg<9>(); }
#elif (defined(BOOST_MSVC) && BOOST_MSVC <= 1300) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__)
#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__)
static boost::arg<1> _1;
static boost::arg<2> _2;

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
namespace boost

View File

@ -1,10 +1,9 @@
// boost cast.hpp header file ----------------------------------------------//
// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright
// notice appears in all copies. This software is provided "as is" without
// express or implied warranty, and with no claim as to its suitability for
// any purpose.
// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
// 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)
// See http://www.boost.org/libs/conversion for Documentation.
@ -129,12 +128,12 @@ namespace boost
template <class T>
struct signed_numeric_limits : std::numeric_limits<T>
{
static inline T min()
static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return std::numeric_limits<T>::min() >= 0
return (std::numeric_limits<T>::min)() >= 0
// unary minus causes integral promotion, thus the static_cast<>
? static_cast<T>(-std::numeric_limits<T>::max())
: std::numeric_limits<T>::min();
? static_cast<T>(-(std::numeric_limits<T>::max)())
: (std::numeric_limits<T>::min)();
};
};
@ -157,11 +156,11 @@ namespace boost
// long / unsigned long long. Not intended to be full
// numeric_limits replacements, but good enough for numeric_cast<>
template <>
struct fixed_numeric_limits_base<long long, false>
struct fixed_numeric_limits_base< ::boost::long_long_type, false>
{
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
BOOST_STATIC_CONSTANT(bool, is_signed = true);
static long long max()
static ::boost::long_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
# ifdef LONGLONG_MAX
return LONGLONG_MAX;
@ -170,7 +169,7 @@ namespace boost
# endif
}
static long long min()
static ::boost::long_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
# ifdef LONGLONG_MIN
return LONGLONG_MIN;
@ -181,11 +180,11 @@ namespace boost
};
template <>
struct fixed_numeric_limits_base<unsigned long long, false>
struct fixed_numeric_limits_base< ::boost::ulong_long_type, false>
{
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
BOOST_STATIC_CONSTANT(bool, is_signed = false);
static unsigned long long max()
static ::boost::ulong_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
# ifdef ULONGLONG_MAX
return ULONGLONG_MAX;
@ -194,7 +193,7 @@ namespace boost
# endif
}
static unsigned long long min() { return 0; }
static ::boost::ulong_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
};
# endif
} // namespace detail
@ -314,10 +313,10 @@ namespace boost
template <class T>
struct fixed_numeric_limits : public std::numeric_limits<T>
{
static inline T min()
static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return std::numeric_limits<T>::is_signed && std::numeric_limits<T>::min() >= 0
? T(-std::numeric_limits<T>::max()) : std::numeric_limits<T>::min();
return std::numeric_limits<T>::is_signed && (std::numeric_limits<T>::min)() >= 0
? T(-(std::numeric_limits<T>::max)()) : (std::numeric_limits<T>::min)();
}
};
@ -351,8 +350,8 @@ namespace boost
const bool result_is_signed = result_traits::is_signed;
const bool same_sign = arg_is_signed == result_is_signed;
if (less_than_type_min<arg_is_signed, result_is_signed>::check(arg, result_traits::min())
|| greater_than_type_max<same_sign, arg_is_signed>::check(arg, result_traits::max())
if (less_than_type_min<arg_is_signed, result_is_signed>::check(arg, (result_traits::min)())
|| greater_than_type_max<same_sign, arg_is_signed>::check(arg, (result_traits::max)())
)
#else // We need to use #pragma hacks if available
@ -364,8 +363,8 @@ namespace boost
#pragma option push -w-8012
# endif
if ((arg < 0 && !result_traits::is_signed) // loss of negative range
|| (arg_traits::is_signed && arg < result_traits::min()) // underflow
|| arg > result_traits::max()) // overflow
|| (arg_traits::is_signed && arg < (result_traits::min)()) // underflow
|| arg > (result_traits::max)()) // overflow
# if BOOST_MSVC
# pragma warning(pop)
#elif defined(__BORLANDC__)

View File

@ -10,15 +10,13 @@
//
// boost/checked_delete.hpp
//
// Copyright (c) 1999, 2000, 2001, 2002 boost.org
// Copyright (c) 2002, 2003 Peter Dimov
// Copyright (c) 2003 Daniel Frey
// Copyright (c) 2003 Howard Hinnant
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/utility/checked_delete.html for documentation.
//

View File

@ -1,9 +1,8 @@
//
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// (C) Copyright Jeremy Siek 2000.
// 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)
//
// Revision History:
//
@ -409,7 +408,7 @@ namespace boost {
//===========================================================================
// Iterator Archetype Classes
template <class T>
template <class T, int I = 0>
class input_iterator_archetype
{
private:
@ -418,7 +417,7 @@ namespace boost {
typedef std::input_iterator_tag iterator_category;
typedef T value_type;
struct reference {
operator value_type() const { return static_object<T>::get(); }
operator const value_type&() const { return static_object<T>::get(); }
};
typedef const T* pointer;
typedef std::ptrdiff_t difference_type;

View File

@ -1,9 +1,8 @@
//
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// (C) Copyright Jeremy Siek 2000.
// 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)
//
// Revision History:
// 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
@ -180,7 +179,7 @@ struct require_same { typedef T type; };
template <> struct SignedIntegerConcept<int> { void constraints() {} };
template <> struct SignedIntegerConcept<long> { void constraints() {} };
# if defined(BOOST_HAS_LONG_LONG)
template <> struct SignedIntegerConcept<long long> { void constraints() {} };
template <> struct SignedIntegerConcept< ::boost::long_long_type> { void constraints() {} };
# endif
// etc.
#endif

View File

@ -81,7 +81,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
//
// Only include what follows for known and supported compilers:
//
#if (defined(BOOST_MSVC) && defined(_MSC_EXTENSIONS)) \
#if defined(BOOST_MSVC) \
|| defined(__BORLANDC__) \
|| (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
@ -115,11 +115,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// vc7:
# define BOOST_LIB_TOOLSET "vc7"
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1310)
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
// vc71:
# define BOOST_LIB_TOOLSET "vc71"
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
// vc80:
# define BOOST_LIB_TOOLSET "vc80"
#elif defined(__BORLANDC__)
// CBuilder 6:

View File

@ -25,6 +25,15 @@
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# define BOOST_NO_DEDUCED_TYPENAME
// workaround for missing WCHAR_MAX/WCHAR_MIN:
#include <climits>
#include <cwchar>
#ifndef WCHAR_MAX
# define WCHAR_MAX 0xffff
#endif
#ifndef WCHAR_MIN
# define WCHAR_MIN 0
#endif
#endif
#if (__BORLANDC__ <= 0x564)
@ -40,6 +49,7 @@
# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
# define BOOST_NO_TEMPLATE_TEMPLATES
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
// we shouldn't really need this - but too many things choke
// without it, this needs more investigation:
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS

View File

@ -14,14 +14,11 @@
#include "boost/config/compiler/common_edg.hpp"
#if (__COMO_VERSION__ <= 4245) || !defined(BOOST_STRICT_CONFIG)
#if (__COMO_VERSION__ <= 4245)
# ifdef _WIN32
# define BOOST_NO_SWPRINTF
# endif
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# if defined(_MSC_VER) && _MSC_VER <= 1300
# define BOOST_NO_STDC_NAMESPACE
# if _MSC_VER > 100
// only set this in non-strict mode:
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP

View File

@ -15,5 +15,6 @@
// versions check:
// Nothing to do here?
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL

View File

@ -42,10 +42,12 @@
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
#endif
#if (__HP_aCC <= 53800 )
#if (__HP_aCC >= 50000 ) && (__HP_aCC <= 53800 ) || (__HP_aCC < 31300 )
# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD
#endif
#define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
#define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC)
//

View File

@ -29,12 +29,18 @@
#define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION)
#define BOOST_INTEL BOOST_INTEL_CXX_VERSION
#if defined(_WIN32) || defined(_WIN64)
# define BOOST_INTEL_WIN BOOST_INTEL
#else
# define BOOST_INTEL_LINUX BOOST_INTEL
#endif
#if (BOOST_INTEL_CXX_VERSION <= 500) && defined(_MSC_VER)
# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
# define BOOST_NO_TEMPLATE_TEMPLATES
#endif
#if (BOOST_INTEL_CXX_VERSION <= 600) || !defined(BOOST_STRICT_CONFIG)
#if (BOOST_INTEL_CXX_VERSION <= 600)
# if defined(_MSC_VER) && (_MSC_VER <= 1300) // added check for <= VC 7 (Peter Dimov)
@ -61,17 +67,48 @@
#endif
#if (BOOST_INTEL_CXX_VERSION <= 710) && defined(_WIN32)
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
#endif
// See http://aspn.activestate.com/ASPN/Mail/Message/boost/1614864
#if BOOST_INTEL_CXX_VERSION < 700
#if BOOST_INTEL_CXX_VERSION < 600
# define BOOST_NO_INTRINSIC_WCHAR_T
#else
// _WCHAR_T_DEFINED is the Win32 spelling
// _WCHAR_T is the Linux spelling
# if !defined(_WCHAR_T_DEFINED) && !defined(_WCHAR_T)
// We should test the macro _WCHAR_T_DEFINED to check if the compiler
// supports wchar_t natively. *BUT* there is a problem here: the standard
// headers define this macro if they typedef wchar_t. Anyway, we're lucky
// because they define it without a value, while Intel C++ defines it
// to 1. So we can check its value to see if the macro was defined natively
// or not.
// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T
// is used instead.
# if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0)
# define BOOST_NO_INTRINSIC_WCHAR_T
# endif
#endif
//
// Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T
// set correctly, if we don't do this now, we will get errors later
// in type_traits code among other things, getting this correct
// for the Intel compiler is actually remarkably fragile and tricky:
//
#if defined(BOOST_NO_INTRINSIC_WCHAR_T)
#include <cwchar>
template< typename T > struct assert_no_intrinsic_wchar_t;
template<> struct assert_no_intrinsic_wchar_t<wchar_t> { typedef void type; };
// if you see an error here then you need to unset BOOST_NO_INTRINSIC_WCHAR_T
// where it is defined above:
typedef assert_no_intrinsic_wchar_t<unsigned short>::type assert_no_intrinsic_wchar_t_;
#else
template< typename T > struct assert_intrinsic_wchar_t;
template<> struct assert_intrinsic_wchar_t<wchar_t> {};
// if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line:
template<> struct assert_intrinsic_wchar_t<unsigned short> {};
#endif
#if (BOOST_INTEL_CXX_VERSION <= 800) || !defined(BOOST_STRICT_CONFIG)
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#endif
@ -100,7 +137,7 @@
#endif
//
// last known and checked version:
#if (BOOST_INTEL_CXX_VERSION > 800)
#if (BOOST_INTEL_CXX_VERSION > 810)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# elif defined(_MSC_VER)

View File

@ -3,6 +3,7 @@
// (C) Copyright Peter Dimov 2001.
// (C) Copyright David Abrahams 2001 - 2002.
// (C) Copyright Beman Dawes 2001 - 2003.
// (C) Copyright Stefan Slapeta 2004.
// 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)
@ -36,7 +37,7 @@
# define BOOST_NO_SFINAE
# endif
# if(__MWERKS__ <= 0x3202) // 9.2
# if(__MWERKS__ <= 0x3204) // 9.3
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# endif
@ -63,6 +64,8 @@
# define BOOST_COMPILER_VERSION 9.1
# elif __MWERKS__ == 0x3202
# define BOOST_COMPILER_VERSION 9.2
# elif __MWERKS__ == 0x3204
# define BOOST_COMPILER_VERSION 9.3
# else
# define BOOST_COMPILER_VERSION __MWERKS__
# endif
@ -80,7 +83,7 @@
#endif
//
// last known and checked version:
#if (__MWERKS__ > 0x3202)
#if (__MWERKS__ > 0x3204)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# endif

View File

@ -26,6 +26,8 @@
#endif
#if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG)
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
# define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES 1
#endif
//

View File

@ -17,7 +17,7 @@
// turn off the warnings before we #include anything
#pragma warning( disable : 4503 ) // warning: decorated name length exceeded
#if _MSC_VER <= 1200 // 1200 == VC++ 6.0
#if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1201 == EVC4.2
#pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
# define BOOST_NO_VOID_RETURNS
@ -54,6 +54,7 @@
# define BOOST_NO_SWPRINTF
# define BOOST_NO_TEMPLATE_TEMPLATES
# define BOOST_NO_SFINAE
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
# if (_MSC_VER > 1200)
# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
# endif
@ -64,7 +65,7 @@
# define BOOST_NO_SWPRINTF
#endif
#if _MSC_VER <= 1310
#if _MSC_VER <= 1400 // 1400 == VC++ 8.0
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
#endif
@ -72,6 +73,11 @@
# define BOOST_NO_INTRINSIC_WCHAR_T
#endif
#ifdef _WIN32_WCE
# define BOOST_NO_THREADEX
# define BOOST_NO_GETSYSTEMTIMEASFILETIME
#endif
//
// check for exception handling support:
#ifndef _CPPUNWIND
@ -115,6 +121,8 @@
# define BOOST_COMPILER_VERSION 7.0
# elif _MSC_VER == 1310
# define BOOST_COMPILER_VERSION 7.1
# elif _MSC_VER == 1400
# define BOOST_COMPILER_VERSION 8.0
# else
# define BOOST_COMPILER_VERSION _MSC_VER
# endif
@ -129,18 +137,10 @@
#endif
//
// last known and checked version is 1310:
#if (_MSC_VER > 1310)
#if (_MSC_VER > 1400)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
# pragma message("Unknown compiler version - please run the configure tests and report the results")
# endif
#endif

View File

@ -46,7 +46,9 @@
//
// The BSD <ctype.h> has macros only, no functions:
//
#define BOOST_NO_CTYPE_FUNCTIONS
#if !defined(__OpenBSD__)
# define BOOST_NO_CTYPE_FUNCTIONS
#endif
//
// thread API's not auto detected:

View File

@ -15,8 +15,6 @@
// Using the Mac OS X system BSD-style C library.
# define BOOST_NO_CTYPE_FUNCTIONS
# define BOOST_NO_CWCHAR
# ifndef BOOST_HAS_UNISTD_H
# define BOOST_HAS_UNISTD_H
# endif

View File

@ -33,6 +33,11 @@
// a consistent setting of BOOST_HAS_THREADS across
// all translation units (needed for shared_ptr etc).
//
#ifdef _WIN32_WCE
# define BOOST_NO_ANSI_APIS
#endif
#ifndef BOOST_HAS_PTHREADS
# define BOOST_HAS_WINTHREADS
#endif
@ -40,47 +45,6 @@
#ifndef BOOST_DISABLE_WIN32
// WEK: Added
#define BOOST_HAS_FTIME
#define BOOST_WINDOWS 1
#endif
//
// disable min/max macros:
//
#ifdef min
# undef min
#endif
#ifdef max
# undef max
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
#ifdef BOOST_MSVC
#include <algorithm> // for existing std::min and std::max
namespace std{
// Apparently, something in the Microsoft libraries requires the "long"
// overload, because it calls the min/max functions with arguments of
// slightly different type. (If this proves to be incorrect, this
// whole "BOOST_MSVC" section can be removed.)
inline long min(long __a, long __b) {
return __b < __a ? __b : __a;
}
inline long max(long __a, long __b) {
return __a < __b ? __b : __a;
}
// The "long double" overload is required, otherwise user code calling
// min/max for floating-point numbers will use the "long" overload.
// (SourceForge bug #495495)
inline long double min(long double __a, long double __b) {
return __b < __a ? __b : __a;
}
inline long double max(long double __a, long double __b) {
return __a < __b ? __b : __a;
}
}
using std::min;
using std::max;
# endif

View File

@ -76,7 +76,7 @@
// in issue 4, version 2 (_XOPEN_VERSION > 500).
# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
# define BOOST_HAS_GETTIMEOFDAY
# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# endif
# endif

View File

@ -33,7 +33,7 @@
// Rogue Wave library:
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp"
#elif defined(__GLIBCPP__)
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
// GNU libstdc++ 3
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp"

View File

@ -29,7 +29,7 @@
# define BOOST_NO_STD_ALLOCATOR
# endif
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
# if (defined(_MSC_VER) && (_MSC_VER < 1300)) && !defined(__BORLANDC__)
# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
// if this lib version is set up for vc6 then there is no std::use_facet:
# define BOOST_NO_STD_USE_FACET
# define BOOST_HAS_TWO_ARG_USE_FACET
@ -61,6 +61,15 @@
# endif
#endif
//
// std extension namespace is stdext for vc7.1 and later,
// the same applies to other compilers that sit on top
// of vc7.1 (Intel and Comeau):
//
#if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__)
# define BOOST_STD_EXTENSION_NAMESPACE stdext
#endif
#if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306)
// if we're using a dinkum lib that's
@ -69,7 +78,7 @@
# define BOOST_NO_STD_ITERATOR_TRAITS
#endif
#if defined(__ICL) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310)
#if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310)
// Intel C++ chokes over any non-trivial use of <locale>
// this may be an overly restrictive define, but regex fails without it:
# define BOOST_NO_STD_LOCALE
@ -94,3 +103,4 @@

View File

@ -24,6 +24,15 @@
# define BOOST_NO_STD_WSTREAMBUF
#endif
#if (__LIBCOMO_VERSION__ <= 31) && defined(_WIN32)
#define BOOST_NO_SWPRINTF
#endif
#if __LIBCOMO_VERSION__ >= 31
# define BOOST_HAS_HASH
# define BOOST_HAS_SLIST
#endif
//
// Intrinsic type_traits support.
// The SGI STL has it's own __type_traits class, which

View File

@ -9,19 +9,43 @@
// config for libstdc++ v3
// not much to go in here:
#ifdef __GLIBCXX__
#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__)
#else
#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__)
#endif
#ifndef _GLIBCPP_USE_WCHAR_T
#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T)
# define BOOST_NO_CWCHAR
# define BOOST_NO_CWCTYPE
# define BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTREAMBUF
#endif
#if defined(__osf__) && !defined(_REENTRANT) && defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
// GCC 3.4 on Tru64 forces the definition of _REENTRANT when any std lib header
// file is included, therefore for consistency we define it here as well.
# define _REENTRANT
#endif
#ifdef __GLIBCXX__ // gcc 3.4 and greater:
# ifdef _GLIBCXX_HAVE_GTHR_DEFAULT
//
// If the std lib has thread support turned on, then turn it on in Boost
// as well. We do this because some gcc-3.4 std lib headers define _REENTANT
// while others do not...
//
# define BOOST_HAS_THREADS
# else
# define BOOST_DISABLE_THREADS
# endif
#endif
#ifndef _GLIBCPP_USE_LONG_LONG
#if !defined(_GLIBCPP_USE_LONG_LONG) \
&& !defined(_GLIBCXX_USE_LONG_LONG)\
&& defined(BOOST_HAS_LONG_LONG)
// May have been set by compiler/*.hpp, but "long long" without library
// support is useless.
# undef BOOST_HAS_LONG_LONG
#endif

View File

@ -30,7 +30,9 @@
#if defined(__MSL__) && (__MSL__ >= 0x5000)
# define BOOST_HAS_STDINT_H
# define BOOST_HAS_UNISTD_H
# if !defined(__PALMOS_TRAPS__)
# define BOOST_HAS_UNISTD_H
# endif
// boilerplate code:
# include <boost/config/posix_features.hpp>
#endif

View File

@ -41,7 +41,9 @@
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#endif
#if BOOST_RWSTD_VER <= 0x020101
// Sun CC 5.5 patch 113817-07 adds long long specialization, but does not change the
// library version number (http://sunsolve6.sun.com/search/document.do?assetkey=1-21-113817):
#if BOOST_RWSTD_VER <= 0x020101 && (!defined(__SUNPRO_CC) || (__SUNPRO_CC < 0x550))
# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
# endif

View File

@ -82,6 +82,19 @@
# define BOOST_NO_STD_ALLOCATOR
#endif
//
// If STLport thinks there is no wchar_t at all, then we have to disable
// the support for the relevant specilazations of std:: templates.
//
#if !defined(_STLP_HAS_WCHAR_T) && !defined(_STLP_WCHAR_T_IS_USHORT)
# ifndef BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTRING
# endif
# ifndef BOOST_NO_STD_WSTREAMBUF
# define BOOST_NO_STD_WSTREAMBUF
# endif
#endif
//
// We always have SGI style hash_set, hash_map, and slist:
//
@ -149,6 +162,16 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy;
# define BOOST_NO_CWCTYPE
#endif
//
// If STLport for some reason was configured so that it thinks that wchar_t
// is not an intrinsic type, then we have to disable the support for it as
// well (we would be missing required specializations otherwise).
//
#if !defined( _STLP_HAS_WCHAR_T) || defined(_STLP_WCHAR_T_IS_USHORT)
# undef BOOST_NO_INTRINSIC_WCHAR_T
# define BOOST_NO_INTRINSIC_WCHAR_T
#endif
//
// Borland ships a version of STLport with C++ Builder 6 that lacks
// hashtables and the like:
@ -157,6 +180,15 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy;
# undef BOOST_HAS_HASH
#endif
//
// gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max
//
#if defined(__GNUC__) && (__GNUC__ < 3)
# include <algorithm> // for std::min and std::max
# define BOOST_USING_STD_MIN() ((void)0)
# define BOOST_USING_STD_MAX() ((void)0)
namespace boost { using std::min; using std::max; }
#endif
#define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT)

View File

@ -10,6 +10,7 @@
#endif
#define BOOST_HAS_MACRO_USE_FACET
#define BOOST_NO_STD_MESSAGES
#define BOOST_STDLIB "Visual Age default standard library"

View File

@ -285,17 +285,29 @@
namespace std { using ::ptrdiff_t; using ::size_t; }
# endif
// Workaround for the unfortunate min/max macros defined by some platform headers
#define BOOST_PREVENT_MACRO_SUBSTITUTION
#ifndef BOOST_USING_STD_MIN
# define BOOST_USING_STD_MIN() using std::min
#endif
#ifndef BOOST_USING_STD_MAX
# define BOOST_USING_STD_MAX() using std::max
#endif
// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
# ifdef BOOST_NO_STD_MIN_MAX
namespace std {
template <class _Tp>
inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
return __b < __a ? __b : __a;
}
template <class _Tp>
inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
return __a < __b ? __b : __a;
}
}
@ -314,27 +326,33 @@ namespace std {
# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
# endif
// BOOST_USE_FACET workaround ----------------------------------------------//
// BOOST_USE_FACET / HAS_FACET workaround ----------------------------------//
// When the standard library does not have a conforming std::use_facet there
// are various workarounds available, but they differ from library to library.
// This macro provides a consistent way to access a locale's facets.
// The same problem occurs with has_facet.
// These macros provide a consistent way to access a locale's facets.
// Usage:
// replace
// std::use_facet<Type>(loc);
// with
// BOOST_USE_FACET(Type, loc);
// Note do not add a std:: prefix to the front of BOOST_USE_FACET!
// Use for BOOST_HAS_FACET is analagous.
#if defined(BOOST_NO_STD_USE_FACET)
# ifdef BOOST_HAS_TWO_ARG_USE_FACET
# define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
# define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0))
# elif defined(BOOST_HAS_MACRO_USE_FACET)
# define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
# define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type)
# elif defined(BOOST_HAS_STLP_USE_FACET)
# define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
# endif
#else
# define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
#endif
// BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
@ -381,6 +399,23 @@ namespace std {
# define BOOST_DEDUCED_TYPENAME
#endif
// long long workaround ------------------------------------------//
// On gcc (and maybe other compilers?) long long is alway supported
// but it's use may generate either warnings (with -ansi), or errors
// (with -pedantic -ansi) unless it's use is prefixed by __extension__
//
#if defined(BOOST_HAS_LONG_LONG)
namespace boost{
# ifdef __GNUC__
__extension__ typedef long long long_long_type;
__extension__ typedef unsigned long long ulong_long_type;
# else
typedef long long long_long_type;
typedef unsigned long long ulong_long_type;
# endif
}
#endif
// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
//
// Some compilers have problems with function templates whose

View File

@ -1,6 +1,6 @@
// Boost CRC library crc.hpp header file -----------------------------------//
// Copyright 2001 Daryle Walker. Use, modification, and distribution are
// Copyright 2001, 2004 Daryle Walker. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
@ -527,6 +527,30 @@ namespace detail
did_init = true;
}
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// Align the msb of the remainder to a byte
template < std::size_t Bits, bool RightShift >
class remainder
{
public:
typedef typename uint_t<Bits>::fast value_type;
static unsigned char align_msb( value_type rem )
{ return rem >> (Bits - CHAR_BIT); }
};
// Specialization for the case that the remainder has less
// bits than a byte: align the remainder msb to the byte msb
template < std::size_t Bits >
class remainder< Bits, false >
{
public:
typedef typename uint_t<Bits>::fast value_type;
static unsigned char align_msb( value_type rem )
{ return rem << (CHAR_BIT - Bits); }
};
#endif
// CRC helper routines
template < std::size_t Bits, bool DoReflect >
@ -555,7 +579,9 @@ namespace detail
// Compare a byte to the remainder's highest byte
static unsigned char index( value_type rem, unsigned char x )
{ return x ^ ( rem >> (DoReflect ? 0u : Bits - CHAR_BIT) ); }
{ return x ^ ( DoReflect ? rem :
((Bits>CHAR_BIT)?( rem >> (Bits - CHAR_BIT) ) :
( rem << (CHAR_BIT - Bits) ))); }
// Shift out the remainder's highest byte
static value_type shift( value_type rem )
@ -578,7 +604,7 @@ namespace detail
// Compare a byte to the remainder's highest byte
static unsigned char index( value_type rem, unsigned char x )
{ return x ^ ( rem >> (Bits - CHAR_BIT) ); }
{ return x ^ remainder<Bits,(Bits>CHAR_BIT)>::align_msb( rem ); }
// Shift out the remainder's highest byte
static value_type shift( value_type rem )

View File

@ -30,7 +30,7 @@
#include <boost/regex/v4/cregex.hpp>
#endif
#endif // include guard
#endif /* include guard */

View File

@ -1,10 +1,11 @@
// boost cstdint.hpp header file ------------------------------------------//
// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright
// notice appears in all copies. This software is provided "as is" without
// express or implied warranty, and with no claim as to its suitability for
// any purpose.
// (C) Copyright Beman Dawes 1999.
// (C) Copyright Jens Mauer 2001
// (C) Copyright John Maddock 2001
// 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)
// See http://www.boost.org/libs/integer for documentation.
@ -81,8 +82,8 @@ namespace boost
} // namespace boost
#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4)
// FreeBSD has an <inttypes.h> that contains much of what we need
#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__)
// FreeBSD and Tru64 have an <inttypes.h> that contains much of what we need.
# include <inttypes.h>
namespace boost {
@ -222,14 +223,14 @@ namespace boost
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
typedef long long intmax_t;
typedef unsigned long long uintmax_t;
typedef long long int64_t;
typedef long long int_least64_t;
typedef long long int_fast64_t;
typedef unsigned long long uint64_t;
typedef unsigned long long uint_least64_t;
typedef unsigned long long uint_fast64_t;
typedef ::boost::long_long_type intmax_t;
typedef ::boost::ulong_long_type uintmax_t;
typedef ::boost::long_long_type int64_t;
typedef ::boost::long_long_type int_least64_t;
typedef ::boost::long_long_type int_fast64_t;
typedef ::boost::ulong_long_type uint64_t;
typedef ::boost::ulong_long_type uint_least64_t;
typedef ::boost::ulong_long_type uint_fast64_t;
# elif ULONG_MAX != 0xffffffff

View File

@ -1,7 +1,8 @@
// boost/cstdlib.hpp header ------------------------------------------------//
// Copyright Beman Dawes 2001.
// See accompanying license for terms and conditions of use.
// Copyright Beman Dawes 2001. 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)
// See http://www.boost.org/libs/utility/cstdlib.html for documentation.

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// http://www.boost.org/libs/utility/current_function.html
//

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// typedef <implementation-defined> boost::detail::atomic_count;
//

View File

@ -11,10 +11,9 @@
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2002 Lars Gullik Bjønnes <larsbj@lyx.org>
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#include <bits/atomicity.h>
@ -38,7 +37,7 @@ public:
long operator--()
{
return !__exchange_and_add(&value_, -1);
return __exchange_and_add(&value_, -1) - 1;
}
operator long() const
@ -51,7 +50,7 @@ private:
atomic_count(atomic_count const &);
atomic_count & operator=(atomic_count const &);
_Atomic_word value_;
mutable _Atomic_word value_;
};
} // namespace detail

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
//

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#include <pthread.h>

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2001, 2002, 2003 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#ifdef BOOST_USE_WINDOWS_H

View File

@ -1,8 +1,7 @@
// Copyright (c) 2000 David Abrahams. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// Copyright (c) 2000 David Abrahams.
// 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)
//
// Copyright (c) 1994
// Hewlett-Packard Company

View File

@ -1,7 +1,8 @@
// boost/catch_exceptions.hpp -----------------------------------------------//
// Copyright Beman Dawes 1995-2001.
// See accompanying license for terms and conditions of use.
// Copyright Beman Dawes 1995-2001. 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)
// See http://www.boost.org/libs/test for documentation.

View File

@ -1,8 +1,7 @@
// Copyright David Abrahams 2002. Permission to copy, use,
// modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// Copyright David Abrahams 2002.
// 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 INDIRECT_TRAITS_DWA2002131_HPP
# define INDIRECT_TRAITS_DWA2002131_HPP
# include <boost/type_traits/is_function.hpp>
@ -17,11 +16,7 @@
# include <boost/type_traits/remove_pointer.hpp>
# include <boost/type_traits/detail/ice_and.hpp>
# include <boost/detail/workaround.hpp>
# if 0 && BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
# include <boost/type_traits/is_enum.hpp>
# endif
# include <boost/mpl/if.hpp>
# include <boost/mpl/bool.hpp>
@ -30,10 +25,12 @@
# include <boost/mpl/aux_/lambda_support.hpp>
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# include <boost/python/detail/is_function_ref_tester.hpp>
# include <boost/detail/is_function_ref_tester.hpp>
# endif
namespace boost { namespace python { namespace detail {
namespace boost { namespace detail {
namespace indirect_traits {
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
@ -202,6 +199,8 @@ struct is_pointer_to_class
# else
using namespace boost::detail::is_function_ref_tester_;
typedef char (&inner_yes_type)[3];
typedef char (&inner_no_type)[2];
typedef char (&outer_no_type)[1];
@ -467,6 +466,10 @@ struct is_pointer_to_class
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}}} // namespace boost::python::detail
}
using namespace indirect_traits;
}} // namespace boost::python::detail
#endif // INDIRECT_TRAITS_DWA2002131_HPP

View File

@ -19,14 +19,28 @@ namespace boost { namespace detail {
// This namespace ensures that ADL doesn't mess things up.
namespace is_incrementable_
{
// a type returned from operator++ when no increment is found in the
// type's own namespace
struct tag {};
// any soaks up implicit conversions and makes the following
// operator++ less-preferred than any other such operator which
// operator++ less-preferred than any other such operator that
// might be found via ADL.
struct any { template <class T> any(T const&); };
tag operator++(any const&);
// This is a last-resort operator++ for when none other is found
tag operator++(any const&);
tag operator++(any const&,int);
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# define BOOST_comma(a,b) (a)
# else
// In case an operator++ is found that returns void, we'll use ++x,0
tag operator,(tag,int);
# define BOOST_comma(a,b) (a,b)
# endif
// two check overloads help us identify which operator++ was picked
char (& check(tag) )[2];
@ -35,36 +49,41 @@ namespace is_incrementable_
template <class T>
struct
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
impl
# else
is_incrementable
# endif
struct impl
{
static typename remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT(
bool
, value = sizeof(is_incrementable_::check(++x)) == 1
, value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
);
};
typedef mpl::bool_<(
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
::boost::detail::is_incrementable_::is_incrementable<T>::
# endif
value)> type;
template <class T>
struct postfix_impl
{
static typename remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT(
bool
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
);
};
}
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# undef BOOST_comma
template <class T>
struct is_incrementable : is_incrementable_::impl<T>
struct is_incrementable
: mpl::bool_< ::boost::detail::is_incrementable_::impl<T>::value>
{
};
template <class T>
struct is_postfix_incrementable
: mpl::bool_< ::boost::detail::is_incrementable_::postfix_impl<T>::value>
{
};
# else
using is_incrementable_::is_incrementable;
# endif
}} // namespace boost::detail

View File

@ -1,8 +1,7 @@
// (C) Copyright David Abrahams 2002. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// (C) Copyright David Abrahams 2002.
// 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)
// Boost versions of
//
@ -145,7 +144,7 @@ struct iterator_traits<T const*>
# endif
# include <boost/mpl/if.hpp>
# include <boost/mpl/aux_/has_xxx.hpp>
# include <boost/mpl/has_xxx.hpp>
# include <cstddef>
// should be the last #include
@ -267,7 +266,7 @@ template <class T> struct pointer_iterator_traits;
template <class T>
struct pointer_iterator_traits<T*>
{
typedef remove_const<T>::type value_type;
typedef typename remove_const<T>::type value_type;
typedef T* pointer;
typedef T& reference;
typedef std::random_access_iterator_tag iterator_category;
@ -335,8 +334,8 @@ struct msvc_stdlib_mutable_traits
: std::iterator_traits<Iterator>
{
typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef typename std::iterator_traits<Iterator>::value_type* pointer;
typedef typename std::iterator_traits<Iterator>::value_type& reference;
};
template <class Iterator>
@ -344,8 +343,8 @@ struct msvc_stdlib_const_traits
: std::iterator_traits<Iterator>
{
typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
typedef const typename std::iterator_traits<Iterator>::value_type* pointer;
typedef const typename std::iterator_traits<Iterator>::value_type& reference;
};
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// typedef <unspecified> boost::detail::lightweight_mutex;
//

View File

@ -94,23 +94,14 @@ enum float_denorm_style {
static const __mem_type __mem_name = __mem_value
#endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */
// Deal with min/max for MinGW
#ifdef min
# undef min
#endif
#ifdef max
# undef max
#endif
// Base class for all specializations of numeric_limits.
template <class __number>
class _Numeric_limits_base {
public:
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false);
static __number min() throw() { return __number(); }
static __number max() throw() { return __number(); }
static __number min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); }
static __number max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); }
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, 0);
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0);
@ -164,8 +155,8 @@ class _Integer_limits : public _Numeric_limits_base<_Int>
public:
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
static _Int min() throw() { return __imin; }
static _Int max() throw() { return __imax; }
static _Int min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imin; }
static _Int max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imax; }
BOOST_STL_DECLARE_LIMITS_MEMBER(int,
digits,
@ -388,9 +379,9 @@ template<> class numeric_limits<float>
round_to_nearest>
{
public:
static float min() throw() { return FLT_MIN; }
static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; }
static float denorm_min() throw() { return FLT_MIN; }
static float max() throw() { return FLT_MAX; }
static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; }
static float epsilon() throw() { return FLT_EPSILON; }
static float round_error() throw() { return 0.5f; } // Units: ulps.
};
@ -416,9 +407,9 @@ template<> class numeric_limits<double>
round_to_nearest>
{
public:
static double min() throw() { return DBL_MIN; }
static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; }
static double denorm_min() throw() { return DBL_MIN; }
static double max() throw() { return DBL_MAX; }
static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; }
static double epsilon() throw() { return DBL_EPSILON; }
static double round_error() throw() { return 0.5; } // Units: ulps.
};
@ -444,9 +435,9 @@ template<> class numeric_limits<long double>
round_to_nearest>
{
public:
static long double min() throw() { return LDBL_MIN; }
static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; }
static long double denorm_min() throw() { return LDBL_MIN; }
static long double max() throw() { return LDBL_MAX; }
static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; }
static long double epsilon() throw() { return LDBL_EPSILON; }
static long double round_error() throw() { return 4; } // Units: ulps.
};

View File

@ -11,10 +11,9 @@
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2002 Lars Gullik Bjønnes <larsbj@lyx.org>
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#include <bits/atomicity.h>
@ -37,7 +36,7 @@ private:
public:
lightweight_mutex(): a_(1)
lightweight_mutex(): a_(0)
{
}
@ -57,16 +56,16 @@ public:
explicit scoped_lock(lightweight_mutex & m): m_(m)
{
while( !__exchange_and_add(&m_.a_, -1) )
while( __exchange_and_add(&m_.a_, 1) )
{
__atomic_add(&m_.a_, 1);
__atomic_add(&m_.a_, -1);
sched_yield();
}
}
~scoped_lock()
{
__atomic_add(&m_.a_, 1);
__atomic_add(&m_.a_, -1);
}
};
};

View File

@ -7,10 +7,9 @@
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2002 Dan Gohman
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#include <sgidefs.h>

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
//

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
namespace boost

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#include <pthread.h>

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002, 2003 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#ifdef BOOST_USE_WINDOWS_H

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2002, 2003 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#ifdef BOOST_USE_WINDOWS_H

View File

@ -1,8 +1,7 @@
// (C) Copyright Jeremy Siek 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// (C) Copyright Jeremy Siek 2001.
// 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)
// Revision History:

View File

@ -1,15 +1,8 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// (C) Copyright David Abrahams 2001, Howard Hinnant 2001.
//
// Template class is_signed and its documentation is:
// (C) Copyright Howard Hinnant 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// 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)
//
// Template class numeric_traits<Number> --
//

View File

@ -6,13 +6,9 @@
// Copyright (c) 2003
// Eric Friedman
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appears in all copies and
// that both the copyright notice and this permission notice appear in
// supporting documentation. No representations are made about the
// suitability of this software for any purpose. It is provided "as is"
// without express or implied warranty.
// 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 BOOST_DETAIL_REFERENCE_CONTENT_HPP
#define BOOST_DETAIL_REFERENCE_CONTENT_HPP

View File

@ -1,8 +1,7 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// (C) Copyright David Abrahams 2001.
// 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)
//
// See http://www.boost.org for most recent version including documentation.

View File

@ -7,10 +7,9 @@
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
// Copyright (c) 2001, 2002 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
//

View File

@ -12,10 +12,9 @@
//
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
#include <boost/config.hpp>
@ -395,9 +394,13 @@ public:
shared_count & operator= (shared_count const & r) // nothrow
{
sp_counted_base * tmp = r.pi_;
if(tmp != 0) tmp->add_ref_copy();
if(pi_ != 0) pi_->release();
pi_ = tmp;
if(tmp != pi_)
{
if(tmp != 0) tmp->add_ref_copy();
if(pi_ != 0) pi_->release();
pi_ = tmp;
}
return *this;
}

View File

@ -7,10 +7,9 @@
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
// Copyright (c) 2001, 2002 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
//

View File

@ -1,8 +1,7 @@
// Copyright David Abrahams 2002. Permission to copy, use,
// modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// Copyright David Abrahams 2002.
// 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 WORKAROUND_DWA2002126_HPP
# define WORKAROUND_DWA2002126_HPP

View File

@ -6,10 +6,9 @@
//
// Copyright (c) 2002 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// 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)
//
// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
//
@ -60,7 +59,7 @@ public:
}
typedef T _internal_element_type; // for bcc 5.5.1
weak_ptr<_internal_element_type> _internal_weak_this;
mutable weak_ptr<_internal_element_type> _internal_weak_this;
};
} // namespace boost

View File

@ -23,10 +23,7 @@ namespace boost
namespace filesystem
{
// create_directories (contributed by Vladimir Prus) -----------------------//
BOOST_FILESYSTEM_DECL void create_directories(const path& ph);
BOOST_FILESYSTEM_DECL bool create_directories(const path& ph);
BOOST_FILESYSTEM_DECL std::string extension(const path& ph);

View File

@ -67,7 +67,8 @@ namespace boost
filesystem_error(
const std::string & who,
const path & path1,
const std::string & message ); // assumed to be error_code::other_error
const std::string & message,
error_code ec = other_error );
filesystem_error(
const std::string & who,

View File

@ -18,6 +18,7 @@
#include <boost/filesystem/path.hpp> // includes <boost/filesystem/config.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/iterator.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <ctime>
@ -52,12 +53,14 @@ namespace boost
inline bool is_empty( const path & ph ) { return _is_empty( ph ); }
# endif
BOOST_FILESYSTEM_DECL bool equivalent( const path & ph1, const path & ph2 );
BOOST_FILESYSTEM_DECL boost::intmax_t file_size( const path & ph );
BOOST_FILESYSTEM_DECL std::time_t last_write_time( const path & ph );
BOOST_FILESYSTEM_DECL void last_write_time( const path & ph, const std::time_t new_time );
// operations --------------------------------------------------------------//
BOOST_FILESYSTEM_DECL void create_directory( const path & directory_ph );
BOOST_FILESYSTEM_DECL bool create_directory( const path & directory_ph );
BOOST_FILESYSTEM_DECL bool remove( const path & ph );
BOOST_FILESYSTEM_DECL unsigned long remove_all( const path & ph );
@ -74,6 +77,14 @@ namespace boost
BOOST_FILESYSTEM_DECL path system_complete( const path & ph );
BOOST_FILESYSTEM_DECL path complete( const path & ph, const path & base = initial_path() );
// test helper -------------------------------------------------------------//
// not part of the documented interface because false positives are possible;
// there is no law that says that an OS that has large stat.st_size
// actually supports large file sizes.
BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
// directory_iterator helpers ----------------------------------------------//
// forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class
// directory_iterator, and so avoid iterator_facade DLL template problems

View File

@ -82,7 +82,7 @@ namespace boost
class iterator : public boost::iterator_facade<
iterator,
std::string const,
boost::single_pass_traversal_tag >
boost::bidirectional_traversal_tag >
{
private:
friend class boost::iterator_core_access;
@ -116,6 +116,14 @@ namespace boost
static void default_name_check( name_check new_check );
static name_check default_name_check();
// relational operators
bool operator<( const path & that ) const;
bool operator==( const path & that ) const { return !(*this < that) && !(that < *this); }
bool operator!=( const path & that ) const { return !(*this == that); }
bool operator>( const path & that ) const { return that < *this; }
bool operator<=( const path & that ) const { return !(that < *this); }
bool operator>=( const path & that ) const { return !(*this < that); }
private:
// Note: This is an implementation for POSIX and Windows, where there
// are only minor differences between generic and system-specific

View File

@ -1,30 +1,31 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ----------------------------------------------------------------------------
// format.hpp : primary header
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_HPP
#define BOOST_FORMAT_HPP
#include <vector>
#include <string>
#include <boost/detail/workaround.hpp>
#include <boost/format/detail/config_macros.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_STD_LOCALE
#include <locale>
#endif
// *** Compatibility framework
#include <boost/format/detail/compat_workarounds.hpp>
#ifdef BOOST_NO_LOCALE_ISIDIGIT
#include <cctype> // we'll use the non-locale <cctype>'s std::isdigit(int)
#endif

View File

@ -0,0 +1,172 @@
// ----------------------------------------------------------------------------
// alt_sstream.hpp : alternative stringstream
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_SK_ALT_SSTREAM_HPP
#define BOOST_SK_ALT_SSTREAM_HPP
#include <string>
#include <boost/format/detail/compat_workarounds.hpp>
#include <boost/utility/base_from_member.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/assert.hpp>
namespace boost {
namespace io {
template<class Ch, class Tr=::std::char_traits<Ch>,
class Alloc=::std::allocator<Ch> >
class basic_altstringbuf;
template<class Ch, class Tr =::std::char_traits<Ch>,
class Alloc=::std::allocator<Ch> >
class basic_oaltstringstream;
template<class Ch, class Tr, class Alloc>
class basic_altstringbuf
: public ::std::basic_streambuf<Ch, Tr>
{
typedef ::std::basic_streambuf<Ch, Tr> streambuf_t;
typedef typename CompatAlloc<Alloc>::compatible_type compat_allocator_type;
typedef typename CompatTraits<Tr>::compatible_type compat_traits_type;
public:
typedef Ch char_type;
typedef Tr traits_type;
typedef typename compat_traits_type::int_type int_type;
typedef typename compat_traits_type::pos_type pos_type;
typedef typename compat_traits_type::off_type off_type;
typedef Alloc allocator_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
typedef ::std::streamsize streamsize;
explicit basic_altstringbuf(std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
: putend_(NULL), is_allocated_(false), mode_(mode)
{}
explicit basic_altstringbuf(const string_type& s,
::std::ios_base::openmode mode
= ::std::ios_base::in | ::std::ios_base::out)
: putend_(NULL), is_allocated_(false), mode_(mode)
{ dealloc(); str(s); }
virtual ~basic_altstringbuf()
{ dealloc(); }
using streambuf_t::pbase;
using streambuf_t::pptr;
using streambuf_t::epptr;
using streambuf_t::eback;
using streambuf_t::gptr;
using streambuf_t::egptr;
void clear_buffer();
void str(const string_type& s);
// 0-copy access :
Ch * begin() const;
streamsize size() const;
streamsize cur_size() const; // stop at current pointer
Ch * pend() const // the highest position reached by pptr() since creation
{ return ((putend_ < pptr()) ? pptr() : putend_); }
streamsize pcount() const
{ return static_cast<streamsize>( pptr() - pbase()) ;}
// copy buffer to string :
string_type str() const
{ return string_type(begin(), size()); }
string_type cur_str() const
{ return string_type(begin(), cur_size()); }
protected:
explicit basic_altstringbuf (basic_altstringbuf * s,
::std::ios_base::openmode mode
= ::std::ios_base::in | ::std::ios_base::out)
: putend_(NULL), is_allocated_(false), mode_(mode)
{ dealloc(); str(s); }
virtual pos_type seekoff(off_type off, ::std::ios_base::seekdir way,
::std::ios_base::openmode which
= ::std::ios_base::in | ::std::ios_base::out);
virtual pos_type seekpos (pos_type pos,
::std::ios_base::openmode which
= ::std::ios_base::in | ::std::ios_base::out);
virtual int_type underflow();
virtual int_type pbackfail(int_type meta = compat_traits_type::eof());
virtual int_type overflow(int_type meta = compat_traits_type::eof());
void dealloc();
private:
enum { alloc_min = 256}; // minimum size of allocations
Ch *putend_; // remembers (over seeks) the highest value of pptr()
bool is_allocated_;
::std::ios_base::openmode mode_;
compat_allocator_type alloc_; // the allocator object
};
// --- class basic_oaltstringstream ----------------------------------------
template <class Ch, class Tr, class Alloc>
class basic_oaltstringstream
: private base_from_member< shared_ptr< basic_altstringbuf< Ch, Tr, Alloc> > >,
public ::std::basic_ostream<Ch, Tr>
{
class No_Op {
// used as no-op deleter for (not-owner) shared_pointers
public:
template<class T>
const T & operator()(const T & arg) { return arg; }
};
typedef ::std::basic_ostream<Ch, Tr> stream_t;
typedef boost::base_from_member<boost::shared_ptr<
basic_altstringbuf<Ch,Tr, Alloc> > >
pbase_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
typedef basic_altstringbuf<Ch, Tr, Alloc> stringbuf_t;
public:
typedef Alloc allocator_type;
basic_oaltstringstream()
: pbase_type(new stringbuf_t), stream_t(rdbuf())
{ }
basic_oaltstringstream(::boost::shared_ptr<stringbuf_t> buf)
: pbase_type(buf), stream_t(rdbuf())
{ }
basic_oaltstringstream(stringbuf_t * buf)
: pbase_type(buf, No_Op() ), stream_t(rdbuf())
{ }
stringbuf_t * rdbuf() const
{ return pbase_type::member.get(); }
void clear_buffer()
{ rdbuf()->clear_buffer(); }
// 0-copy access :
Ch * begin() const
{ return rdbuf()->begin(); }
::std::streamsize size() const
{ return rdbuf()->size(); }
::std::streamsize cur_size() const // stops at current position
{ return rdbuf()->cur_size(); }
// copy buffer to string :
string_type str() const // [pbase, epptr[
{ return rdbuf()->str(); }
string_type cur_str() const // [pbase, pptr[
{ return rdbuf()->cur_str(); }
};
} // N.S. io
} // N.S. boost
#include <boost/format/alt_sstream_impl.hpp>
#endif // include guard

View File

@ -0,0 +1,294 @@
// ----------------------------------------------------------------------------
// alt_sstream_impl.hpp : alternative stringstream, templates implementation
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_SK_ALT_SSTREAM_IMPL_HPP
#define BOOST_SK_ALT_SSTREAM_IMPL_HPP
namespace boost {
namespace io {
// --- Implementation ------------------------------------------------------//
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>::
clear_buffer () {
const Ch * p = pptr();
const Ch * b = pbase();
if(p != NULL && p != b) {
seekpos(0, ::std::ios_base::out);
}
p = gptr();
b = eback();
if(p != NULL && p != b) {
seekpos(0, ::std::ios_base::in);
}
}
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>::
str (const string_type& s) {
std::size_t sz=s.size();
if(sz != 0 && mode_ & (::std::ios_base::in | ::std::ios_base::out) ) {
Ch *new_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0);
// if this didnt throw, we're safe, update the buffer
dealloc();
sz = s.copy(new_ptr);
putend_ = new_ptr + sz;
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(new_ptr, new_ptr, new_ptr + sz);
if(mode_ & ::std::ios_base::out) {
streambuf_t::setp(new_ptr, new_ptr + sz);
if(mode_ & (::std::ios_base::app | ::std::ios_base::ate))
streambuf_t::pbump(sz);
if(gptr() == NULL)
streambuf_t::setg(new_ptr, NULL, new_ptr);
}
is_allocated_ = true;
}
else
dealloc();
}
template<class Ch, class Tr, class Alloc>
Ch* basic_altstringbuf<Ch, Tr, Alloc>::
begin () const {
if(mode_ & ::std::ios_base::out && pptr() != NULL)
return pbase();
else if(mode_ & ::std::ios_base::in && gptr() != NULL)
return eback();
return NULL;
}
template<class Ch, class Tr, class Alloc>
std::streamsize basic_altstringbuf<Ch, Tr, Alloc>::
size () const {
if(mode_ & ::std::ios_base::out && pptr())
return static_cast<streamsize>( pend() - pbase());
else if(mode_ & ::std::ios_base::in && gptr())
return static_cast<streamsize>( egptr() - eback());
else
return 0;
}
template<class Ch, class Tr, class Alloc>
std::streamsize basic_altstringbuf<Ch, Tr, Alloc>::
cur_size () const {
if(mode_ & ::std::ios_base::out && pptr())
return static_cast<streamsize>( pptr() - pbase());
else if(mode_ & ::std::ios_base::in && gptr())
return static_cast<streamsize>( gptr() - eback());
else
return 0;
}
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::pos_type
basic_altstringbuf<Ch, Tr, Alloc>::
seekoff (off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) {
if(pptr() != NULL && putend_ < pptr())
putend_ = pptr();
if(which & ::std::ios_base::in && gptr() != NULL) {
// get area
if(way == ::std::ios_base::end)
off += putend_ - eback();
else if(way == ::std::ios_base::cur && (which & ::std::ios_base::out) == 0)
off += gptr() - eback();
else if(way != ::std::ios_base::beg)
off = off_type(-1);
if(0 <= off && off <= putend_ - eback()) {
// set gptr
streambuf_t::gbump(off + (eback() - gptr()));
if(which & ::std::ios_base::out && pptr() != NULL)
// update pptr to match gptr
streambuf_t::pbump(gptr()-pptr());
}
else
off = off_type(-1);
}
else if(which & ::std::ios_base::out && pptr() != NULL) {
// put area
if(way == ::std::ios_base::end)
off += putend_ - eback();
else if(way == ::std::ios_base::cur)
off += pptr() - eback();
else if(way != ::std::ios_base::beg)
off = off_type(-1);
if(0 <= off && off <= putend_ - eback())
// set pptr
streambuf_t::pbump((int)(eback() - pptr() + off));
else
off = off_type(-1);
}
else // neither in nor out
off = off_type(-1);
return (pos_type(off));
}
//- end seekoff(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::pos_type
basic_altstringbuf<Ch, Tr, Alloc>::
seekpos (pos_type pos, ::std::ios_base::openmode which) {
off_type off = off_type(pos); // operation guaranteed by §27.4.3.2 table 88
if(pptr() != NULL && putend_ < pptr())
putend_ = pptr();
if(off != off_type(-1)) {
if(which & ::std::ios_base::in && gptr() != NULL) {
// get area
if(0 <= off && off <= putend_ - eback()) {
streambuf_t::gbump((int)(eback() - gptr() + off));
if(which & ::std::ios_base::out && pptr() != NULL) {
// update pptr to match gptr
streambuf_t::pbump(gptr()-pptr());
}
}
else
off = off_type(-1);
}
else if(which & ::std::ios_base::out && pptr() != NULL) {
// put area
if(0 <= off && off <= putend_ - eback())
streambuf_t::pbump(eback() - pptr() + off);
else
off = off_type(-1);
}
else // neither in nor out
off = off_type(-1);
return (pos_type(off));
}
else {
BOOST_ASSERT(0); // §27.4.3.2 allows undefined-behaviour here
return pos_type(off_type(-1));
}
}
// -end seekpos(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
basic_altstringbuf<Ch, Tr, Alloc>::
underflow () {
if(gptr() == NULL) // no get area -> nothing to get.
return (compat_traits_type::eof());
else if(gptr() < egptr()) // ok, in buffer
return (compat_traits_type::to_int_type(*gptr()));
else if(mode_ & ::std::ios_base::in && pptr() != NULL
&& (gptr() < pptr() || gptr() < putend_) )
{ // expand get area
if(putend_ < pptr())
putend_ = pptr(); // remember pptr reached this far
streambuf_t::setg(eback(), gptr(), putend_);
return (compat_traits_type::to_int_type(*gptr()));
}
else // couldnt get anything. EOF.
return (compat_traits_type::eof());
}
// -end underflow(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
basic_altstringbuf<Ch, Tr, Alloc>::
pbackfail (int_type meta) {
if(gptr() != NULL && (eback() < gptr())
&& (mode_ & (::std::ios_base::out)
|| compat_traits_type::eq_int_type(compat_traits_type::eof(), meta)
|| compat_traits_type::eq(compat_traits_type::to_char_type(meta), gptr()[-1]) ) ) {
streambuf_t::gbump(-1); // back one character
if(!compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
// put-back meta into get area
*gptr() = compat_traits_type::to_char_type(meta);
return (compat_traits_type::not_eof(meta));
}
else
return (compat_traits_type::eof()); // failed putback
}
// -end pbackfail(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
basic_altstringbuf<Ch, Tr, Alloc>::
overflow (int_type meta) {
if(compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
return compat_traits_type::not_eof(meta); // nothing to do
else if(pptr() != NULL && pptr() < epptr()) {
streambuf_t::sputc(compat_traits_type::to_char_type(meta));
return meta;
}
else if(! (mode_ & ::std::ios_base::out))
// no write position, and cant make one
return compat_traits_type::eof();
else { // make a write position available
std::size_t prev_size = pptr() == NULL ? 0 : epptr() - eback();
std::size_t new_size = prev_size;
// exponential growth : size *= 1.5
std::size_t add_size = new_size / 2;
if(add_size < alloc_min)
add_size = alloc_min;
Ch * newptr = NULL, *oldptr = eback();
// make sure adding add_size wont overflow size_t
while (0 < add_size && ((std::numeric_limits<std::size_t>::max)()
- add_size < new_size) )
add_size /= 2;
if(0 < add_size) {
new_size += add_size;
newptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0);
}
if(0 < prev_size)
compat_traits_type::copy(newptr, oldptr, prev_size);
if(is_allocated_)
alloc_.deallocate(oldptr, prev_size);
is_allocated_=true;
if(prev_size == 0) { // first allocation
putend_ = newptr;
streambuf_t::setp(newptr, newptr + new_size);
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(newptr, newptr, newptr + 1);
else
streambuf_t::setg(newptr, 0, newptr);
}
else { // update pointers
putend_ = putend_ - oldptr + newptr;
int pptr_count = pptr()-pbase();
int gptr_count = gptr()-eback();
streambuf_t::setp(pbase() - oldptr + newptr, newptr + new_size);
streambuf_t::pbump(pptr_count);
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(newptr, newptr + gptr_count, pptr() + 1);
else
streambuf_t::setg(newptr, 0, newptr);
}
streambuf_t::sputc(compat_traits_type::to_char_type(meta));
return meta;
}
}
// -end overflow(..)
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>:: dealloc() {
if(is_allocated_)
alloc_.deallocate(eback(), (pptr() != NULL ? epptr() : egptr()) - eback());
is_allocated_ = false;
streambuf_t::setg(0, 0, 0);
streambuf_t::setp(0, 0);
putend_ = NULL;
}
}// N.S. io
} // N.S. boost
#endif // include guard

View File

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

View File

@ -1,18 +1,18 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// config_macros.hpp : configuration macros for the format library
// only BOOST_IO_STD is absolutely needed. other are just used to trigger workaround
// codes here and there.
// ------------------------------------------------------------------------------
// only BOOST_IO_STD is absolutely needed (it should be 'std::' in general)
// others are compiler-specific workaround macros used in #ifdef switches
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_CONFIG_MACROS_HPP
#define BOOST_FORMAT_CONFIG_MACROS_HPP
@ -22,17 +22,19 @@
// make sure our local macros wont override something :
#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \
|| defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION )
#error "boost::format defines a local macro that would overwrite a previously defined macro."
|| defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) \
|| defined(BOOST_NO_TEMPLATE_STD_STREAM) \
|| defined(BOOST_FORMAT_STREAMBUF_DEFINED) || defined(BOOST_FORMAT_OSTREAM_DEFINED)
#error "boost::format uses a local macro that is already defined."
#endif
// specific workarounds. each header can define BOOS_IO_STD if it
// needs. (e.g. because of IO_NEEDS_USING_DECLARATION)
#include <boost/format/detail/workarounds_gcc-2.95.hpp>
#include <boost/format/detail/workarounds_stlport.hpp> // stlport workarounds
#include <boost/format/detail/workarounds_gcc-2_95.hpp>
#include <boost/format/detail/workarounds_stlport.hpp>
#ifndef BOOST_IO_STD
# define BOOST_IO_STD std::
# define BOOST_IO_STD ::std::
#endif
#if defined(BOOST_NO_STD_LOCALE) || \
@ -47,8 +49,8 @@
#define BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif
// gcc-2.95's stringstream is not usable, unless it's the one from STLPORT :
#if BOOST_WORKAROUND(__GNUC__, < 3) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
// gcc-2.95's native stringstream is not usable
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
#define BOOST_FORMAT_IGNORE_STRINGSTREAM
#endif
@ -58,18 +60,38 @@
namespace boost {
using std::char_traits;
using std::basic_ostream;
using std::basic_ostringstream;
namespace io {
using std::basic_ostream;
namespace detail {
using std::basic_ios;
using std::basic_ostream;
using std::basic_ostringstream;
}
}
#if ! defined(BOOST_NO_STD_LOCALE)
using std::locale;
namespace io {
using std::locale;
namespace detail {
using std::locale;
}
}
#endif // locale
}
#endif
// -end N.S. boost
#endif // needs_using_declaration
// ------------------------------------------------------------------------------
// *** hide std::locale if it doesnt exist.
// this typedef is either std::locale or int, avoids placing ifdefs everywhere
namespace boost { namespace io { namespace detail {
#if ! defined(BOOST_NO_STD_LOCALE)
typedef BOOST_IO_STD locale locale_t;
#else
typedef int locale_t;
#endif
} } }
// ----------------------------------------------------------------------------
#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP

View File

@ -1,27 +1,21 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream
// ----------------------------------------------------------------------------
// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads)
// the trick was described in boost's list by Aleksey Gurtovoy
// the trick was described in boost's list by Aleksey Gurtovoy
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_MSVC_DISAMBIGUATER_HPP
#define BOOST_MSVC_DISAMBIGUATER_HPP
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) // this whole header is specifically for msvc
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300)
// this whole header is specifically for msvc up to 7.0
#include <boost/format/group.hpp>
#include <ostream>

View File

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

View File

@ -1,87 +0,0 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2003
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// workarounds for gcc < 3.0 :
// . defines a few macros
// . supplies template classes basic_foo<char, Tr> where gcc only supplies foo :
// - basic_ios<char, Tr> from ios
// - basic_ostream<char, Tr> from ostream
// - basic_srteambuf<char, Tr> from streambuf
// of course, the traits type 'Tr' is not used at all,
// and you instantiating those template with a char type different than char fails.
#if BOOST_WORKAROUND(__GNUC__, < 3) & defined(__STL_CONFIG_H) // nothing to do else
#ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H
#define BOOST_FORMAT_WORKAROUNDS_GCC295_H
#include <iostream> // SGI STL doesnt have <ostream> and others, we need iostream.
#ifndef BOOST_IO_STD
# define BOOST_IO_STD std::
#endif
// ***
// gcc's simple classes turned into standard-like template classes :
namespace std {
template <class Ch>
class char_traits : public string_char_traits<Ch> {
};
// only problem : gcc's 'string' is a typedef for basic_string<char, string_char_traits<char> >,
// so strings built using char_traits wont match the type 'string'.
// so it's better to use string_char_traits directly.
template <class Ch, class Tr>
class basic_ios;
template <class Tr>
class basic_ios<char, Tr> : virtual public ostream {
public:
char fill() const { return ios::fill(); } // gcc returns wchar..
char fill(char c) { return ios::fill(c); } // gcc takes wchar..
};
typedef ios ios_base;
template <class Ch, class Tr>
class basic_ostream;
template <class Tr>
class basic_ostream<char, Tr> : public basic_ios<char, Tr> {
public:
basic_ostream(streambuf* sb) : ostream(sb) {}
basic_ostream() : ostream() {}
char widen(char c) { return c; }
char narrow(char c, char def) { return c; }
};
template <class Ch, class Tr>
class basic_streambuf;
template <class Tr>
class basic_streambuf<char, Tr> : public streambuf {
};
} // namespace std
#endif // include guard
#endif // if workaround

View File

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

View File

@ -1,24 +1,24 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// ----------------------------------------------------------------------------
// workarounds_stlport.hpp : workaround STLport issues
// ----------------------------------------------------------------------------
// (C) Samuel Krempp 2001
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
// see http://www.boost.org/libs/format for library home page
// ------------------------------------------------------------------------------
// workarounds_stlport.hpp : configuration for the format library
// The contents of this file should be integrated into the boost config system.
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#ifndef BOOST_MACROS_STLPORT_HPP
#define BOOST_MACROS_STLPORT_HPP
#if defined(_STLPORT_VERSION) && BOOST_WORKAROUND( BOOST_MSVC, <= 1300)
// msvc-6-stlport fails to find basic_string::append( iterator, iterator) when linking
// might affect other MSwindows compilers
#define BOOST_NO_STRING_APPEND
#endif
// *** This should go to "boost/config/stdlib/stlport.hpp".
// If the streams are not native and there are problems with using templates
@ -37,6 +37,6 @@
#endif
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // BOOST_MACROS_STLPORT_HPP

View File

@ -1,21 +1,14 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// ----------------------------------------------------------------------------
// boost/format/exceptions.hpp
// ----------------------------------------------------------------------------
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
// ------------------------------------------------------------------------------
// exceptions.hpp
// ------------------------------------------------------------------------------
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_EXCEPTIONS_HPP
#define BOOST_FORMAT_EXCEPTIONS_HPP
@ -26,69 +19,80 @@
namespace boost {
namespace io {
namespace io {
// **** exceptions -----------------------------------------------
class format_error : public std::exception
{
public:
format_error() {}
virtual const char *what() const throw()
{
return "boost::format_error: "
"format generic failure";
}
};
class format_error : public std::exception
{
public:
format_error() {}
virtual const char *what() const throw() {
return "boost::format_error: "
"format generic failure";
}
};
class bad_format_string : public format_error
{
public:
bad_format_string() {}
virtual const char *what() const throw()
{
return "boost::bad_format_string: "
"format-string is ill-formed";
}
};
class bad_format_string : public format_error
{
std::size_t pos_, next_;
public:
bad_format_string(std::size_t pos, std::size_t size)
: pos_(pos), next_(size) {}
std::size_t get_pos() const { return pos_; }
std::size_t get_next() const { return next_; }
virtual const char *what() const throw() {
return "boost::bad_format_string: format-string is ill-formed";
}
};
class too_few_args : public format_error
{
public:
too_few_args() {}
virtual const char *what() const throw()
{
return "boost::too_few_args: "
"format-string refered to more arguments than were passed";
}
};
class too_few_args : public format_error
{
std::size_t cur_, expected_;
public:
too_few_args(std::size_t cur, std::size_t expected)
: cur_(cur), expected_(expected) {}
std::size_t get_cur() const { return cur_; }
std::size_t get_expected() const { return expected_; }
virtual const char *what() const throw() {
return "boost::too_few_args: "
"format-string refered to more arguments than were passed";
}
};
class too_many_args : public format_error
{
public:
too_many_args() {}
virtual const char *what() const throw()
{
return "boost::too_many_args: "
"format-string refered to less arguments than were passed";
}
};
class too_many_args : public format_error
{
std::size_t cur_, expected_;
public:
too_many_args(std::size_t cur, std::size_t expected)
: cur_(cur), expected_(expected) {}
std::size_t get_cur() const { return cur_; }
std::size_t get_expected() const { return expected_; }
virtual const char *what() const throw() {
return "boost::too_many_args: "
"format-string refered to less arguments than were passed";
}
};
class out_of_range : public format_error
{
public:
out_of_range() {}
virtual const char *what() const throw()
{
return "boost::out_of_range: "
"tried to refer to an argument (or item) number which is out of range, "
"according to the format string.";
}
};
class out_of_range : public format_error
{
int index_, beg_, end_; // range is [ beg, end [
public:
out_of_range(int index, int beg, int end)
: index_(index), beg_(beg), end_(end) {}
int get_index() const { return index_; }
int get_beg() const { return beg_; }
int get_end() const { return end_; }
virtual const char *what() const throw() {
return "boost::out_of_range: "
"tried to refer to an argument (or item) number which"
" is out of range, according to the format string.";
}
};
} // namespace io
} // namespace io
} // namespace boost

View File

@ -1,44 +1,33 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream
// ----------------------------------------------------------------------------
// feed_args.hpp : functions for processing each argument
// feed_args.hpp : functions for processing each argument
// (feed, feed_manip, and distribute)
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_FEED_ARGS_HPP
#define BOOST_FORMAT_FEED_ARGS_HPP
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <boost/format/format_class.hpp>
#include <boost/format/group.hpp>
#include <boost/format/detail/msvc_disambiguater.hpp>
#include <boost/throw_exception.hpp>
namespace boost {
namespace io {
namespace detail {
namespace {
template<class Ch, class Tr>
void clear_buffer(io::basic_outsstream<Ch,Tr> & os) {
os.clear_buffer();
}
template<class Ch, class Tr>
void mk_str( std::basic_string<Ch,Tr> & res,
template<class Ch, class Tr, class Alloc>
void mk_str( std::basic_string<Ch,Tr, Alloc> & res,
const Ch * beg,
std::streamsize size,
std::streamsize w,
@ -46,8 +35,8 @@ namespace {
std::ios_base::fmtflags f,
const Ch prefix_space, // 0 if no space-padding
bool center)
// applies centered / left / right padding to the string [beg, beg+size[
// Effects : the result is placed in res.
// applies centered/left/right padding to the string [beg, beg+size[
// Effects : the result is placed in res.
{
res.resize(0);
std::streamsize n=w-size-!!prefix_space;
@ -80,102 +69,103 @@ namespace {
// the trick is in "boost/format/msvc_disambiguater.hpp"
template< class Ch, class Tr, class T> inline
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr>& os, const T& x ) {
void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
disambiguater<Ch, Tr, T>::put_head(os, x, 1L);
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr>& os, const T& x ) {
void put_last (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
disambiguater<Ch, Tr, T>::put_last(os, x, 1L);
}
#else
template< class Ch, class Tr, class T> inline
void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& , const T& ) {
void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> &, const T& ) {
}
template< class Ch, class Tr, class T> inline
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr>& os, const group1<T>& x ) {
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const group1<T>& x ) {
os << group_head(x.a1_); // send the first N-1 items, not the last
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr>& os, const T& x ) {
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
os << x ;
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr>& os, const group1<T>& x ) {
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const group1<T>& x ) {
os << group_last(x.a1_); // this selects the last element
}
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
template< class Ch, class Tr, class T> inline
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr>& , T& ) {
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> &, T& ) {
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr>& os, T& x ) {
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, T& x) {
os << x ;
}
#endif
#endif // -msvc workaround
template< class Ch, class Tr, class T>
template< class Ch, class Tr, class Alloc, class T>
void put( T x,
const format_item<Ch, Tr>& specs,
std::basic_string<Ch, Tr> & res,
io::basic_outsstream<Ch, Tr>& oss_ )
const format_item<Ch, Tr, Alloc>& specs,
typename basic_format<Ch, Tr, Alloc>::string_type& res,
typename basic_format<Ch, Tr, Alloc>::internal_streambuf_t & buf,
io::detail::locale_t *loc_p = NULL)
{
// does the actual conversion of x, with given params, into a string
// using the *supplied* strinstream. (the stream state is important)
// using the supplied stringbuf.
typedef std::basic_string<Ch, Tr> string_t;
typedef format_item<Ch, Tr> format_item_t;
specs.fmtstate_.apply_on(oss_);
typedef typename basic_format<Ch, Tr, Alloc>::string_type string_type;
typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t;
typedef typename string_type::size_type size_type;
basic_oaltstringstream<Ch, Tr, Alloc> oss( &buf);
specs.fmtstate_.apply_on(oss, loc_p);
// the stream format state can be modified by manipulators in the argument :
put_head( oss_, x );
put_head( oss, x );
// in case x is a group, apply the manip part of it,
// in order to find width
// clear_buffer( oss_); // fixme. is it necessary ?
const std::ios_base::fmtflags fl=oss_.flags();
const std::ios_base::fmtflags fl=oss.flags();
const bool internal = (fl & std::ios_base::internal) != 0;
const std::streamsize w = oss_.width();
const std::streamsize w = oss.width();
const bool two_stepped_padding= internal && (w!=0);
res.resize(0);
if(! two_stepped_padding) {
if(w>0) // handle padding via mk_str, not natively in stream
oss_.width(0);
put_last( oss_, x);
const Ch * res_beg = oss_.begin();
oss.width(0);
put_last( oss, x);
const Ch * res_beg = buf.pbase();
Ch prefix_space = 0;
if(specs.pad_scheme_ & format_item_t::spacepad)
if(oss_.pcount()== 0 ||
(res_beg[0] !=oss_.widen('+') && res_beg[0] !=oss_.widen('-') ))
prefix_space = oss_.widen(' ');
std::streamsize res_size = std::min(
static_cast<std::streamsize>(specs.truncate_ - !!prefix_space),
oss_.pcount());
mk_str(res, res_beg, res_size, w, oss_.fill(), fl,
if(buf.pcount()== 0 ||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
prefix_space = oss.widen(' ');
std::streamsize res_size = (std::min)(
static_cast<std::streamsize>(specs.truncate_ - !!prefix_space),
buf.pcount() );
mk_str(res, res_beg, res_size, w, oss.fill(), fl,
prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 );
}
}
else { // 2-stepped padding
// internal can be implied by zeropad, or user-set.
// left, right, and centered alignment overrule internal,
// but spacepad or truncate might be mixed with internal (using manipulator)
put_last( oss_, x); // may pad
const Ch * res_beg = oss_.begin();
std::streamsize res_size = oss_.pcount();
put_last( oss, x); // may pad
const Ch * res_beg = buf.pbase();
std::streamsize res_size = buf.pcount();
bool prefix_space=false;
if(specs.pad_scheme_ & format_item_t::spacepad)
if(oss_.pcount()== 0 ||
(res_beg[0] !=oss_.widen('+') && res_beg[0] !=oss_.widen('-') ))
if(buf.pcount()== 0 ||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
prefix_space = true;
if(res_size == w && w<=specs.truncate_ && !prefix_space) {
// okay, only one thing was printed and padded, so res is fine
@ -184,69 +174,73 @@ namespace {
else { // length w exceeded
// either it was multi-output with first output padding up all width..
// either it was one big arg and we are fine.
//BOOST_ASSERT(res_size > w); //res_size<w means buggy user-defined formatting
// Note that res_size<w is possible (in case of bad user-defined formatting)
res.assign(res_beg, res_size);
res_beg=NULL; // invalidate pointers.
clear_buffer( oss_);
oss_.width(0);
// make a new stream, to start re-formatting from scratch :
buf.clear_buffer();
basic_oaltstringstream<Ch, Tr, Alloc> oss2( &buf);
specs.fmtstate_.apply_on(oss2, loc_p);
put_head( oss2, x );
oss2.width(0);
if(prefix_space)
oss_ << ' ';
put_last(oss_, x );
if(oss_.pcount()==0 && specs.pad_scheme_ & format_item_t::spacepad) {
oss2 << ' ';
put_last(oss2, x );
if(buf.pcount()==0 && specs.pad_scheme_ & format_item_t::spacepad) {
prefix_space =true;
oss_ << ' ';
oss2 << ' ';
}
// minimal-length output
const Ch * tmp_beg = oss_.begin();
std::streamsize tmp_size = std::min(oss_.pcount(),
static_cast<std::streamsize>(specs.truncate_));
// we now have the minimal-length output
const Ch * tmp_beg = buf.pbase();
std::streamsize tmp_size = (std::min)(static_cast<std::streamsize>(specs.truncate_),
buf.pcount() );
std::streamsize d;
if( (d=w - tmp_size) <=0 ) {
// minimal length is already >= w, so no padding (cool!)
res.assign(tmp_beg, tmp_size);
}
else { // hum.. we need to pad (multi_output, or spacepad present)
typedef typename string_t::size_type size_type;
std::streamsize i = prefix_space;
//find where we should pad
//BOOST_ASSERT( static_cast<size_t>(tmp_size-prefix_space <= res.size() ));
std::streamsize sz = std::min(res_size+prefix_space, tmp_size);
for(; i<sz && tmp_beg[i] == res[i-prefix_space]; ++i){}
std::streamsize sz = (std::min)(res_size+prefix_space, tmp_size);
for(; i<sz && tmp_beg[i] == res[i-prefix_space]; ++i) {}
if(i>=tmp_size) i=prefix_space;
res.assign(tmp_beg, i);
if(d>0) res.append(static_cast<size_type>( d ), oss_.fill());
if(d>0) res.append(static_cast<size_type>( d ), oss2.fill());
res.append(tmp_beg+i, tmp_size-i);
assert(i+(tmp_size-i)+std::max(d,(std::streamsize)0) == w);
assert(res.size() == (std::size_t)w);
BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0) == w);
BOOST_ASSERT(res.size() == (std::size_t)w);
}
}
}
clear_buffer( oss_);
buf.clear_buffer();
} // end- put(..)
} // local namespace
template< class Ch, class Tr, class T>
void distribute(basic_format<Ch,Tr>& self, T x) {
template< class Ch, class Tr, class Alloc, class T>
void distribute (basic_format<Ch,Tr, Alloc>& self, T x) {
// call put(x, ..) on every occurence of the current argument :
if(self.cur_arg_ >= self.num_args_) {
if( self.exceptions() & too_many_args_bit )
boost::throw_exception(too_many_args()); // too many variables supplied
boost::throw_exception(too_many_args(self.cur_arg_, self.num_args_));
else return;
}
for(unsigned long i=0; i < self.items_.size(); ++i) {
if(self.items_[i].argN_ == self.cur_arg_) {
put<Ch, Tr, T> (x, self.items_[i], self.items_[i].res_, self.oss_ );
put<Ch, Tr, Alloc, T> (x, self.items_[i], self.items_[i].res_,
self.buf_, boost::get_pointer(self.loc_) );
}
}
}
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& feed(basic_format<Ch,Tr>& self, T x) {
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
feed (basic_format<Ch,Tr, Alloc>& self, T x) {
if(self.dumped_) self.clear();
distribute<Ch, Tr, T> (self, x);
distribute<Ch, Tr, Alloc, T> (self, x);
++self.cur_arg_;
if(self.bound_.size() != 0) {
while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] )

View File

@ -1,20 +1,14 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// ----------------------------------------------------------------------------
// format_class.hpp : class interface
// ----------------------------------------------------------------------------
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
// See http://www.boost.org/libs/format for library home page
// ------------------------------------------------------------------------------
// format_class.hpp : class interface
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_CLASS_HPP
#define BOOST_FORMAT_CLASS_HPP
@ -23,103 +17,124 @@
#include <vector>
#include <string>
#include <boost/optional.hpp> // to store locale when needed
#include <boost/format/format_fwd.hpp>
#include <boost/format/internals_fwd.hpp>
#include <boost/format/internals.hpp>
#include <boost/format/outsstream.hpp>
#include <boost/format/alt_sstream.hpp>
namespace boost {
template<class Ch, class Tr>
template<class Ch, class Tr, class Alloc>
class basic_format
{
typedef typename io::CompatTraits<Tr>::compatible_type compat_traits;
public:
typedef Ch CharT; // borland fails if we use Ch and Tr directly
typedef Tr Traits; // in the body of the operator% template.
typedef std::basic_string<Ch, Tr> string_t;
typedef typename std::basic_string<Ch, Tr>::size_type size_type;
typedef io::basic_outsstream<Ch, Tr> internal_stream_t;
typedef Ch CharT; // borland fails in operator% if we use Ch and Tr directly
typedef std::basic_string<Ch, Tr, Alloc> string_type;
typedef typename string_type::size_type size_type;
typedef io::detail::format_item<Ch, Tr, Alloc> format_item_t;
typedef io::basic_altstringbuf<Ch, Tr, Alloc> internal_streambuf_t;
explicit basic_format(const Ch* str=NULL);
explicit basic_format(const string_t& s);
#ifndef BOOST_NO_STD_LOCALE
explicit basic_format(const Ch* str, const std::locale & loc);
explicit basic_format(const string_t& s, const std::locale & loc);
#endif
explicit basic_format(const string_type& s);
basic_format(const basic_format& x);
basic_format& operator= (const basic_format& x);
void swap(basic_format& x);
basic_format& clear(); // empty all converted string buffers (except bound items)
basic_format& clear_binds(); // unbind all bound items, and call clear()
basic_format& parse(const string_t&); // resets buffers and parse a new format string
#if !defined(BOOST_NO_STD_LOCALE)
explicit basic_format(const Ch* str, const std::locale & loc);
explicit basic_format(const string_type& s, const std::locale & loc);
#endif
io::detail::locale_t getloc() const;
// pass arguments through those operators :
basic_format& clear(); // empty all converted string buffers (except bound items)
basic_format& clear_binds(); // unbind all bound items, and call clear()
basic_format& parse(const string_type&); // resets buffers and parse a new format string
// ** formatted result ** //
size_type size() const; // sum of the current string pieces sizes
string_type str() const; // final string
// ** arguments passing ** //
template<class T>
basic_format& operator%(const T& x)
{ return io::detail::feed<CharT, Traits, const T&>(*this,x); }
{ return io::detail::feed<CharT, Tr, Alloc, const T&>(*this,x); }
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
template<class T> basic_format& operator%(T& x)
{ return io::detail::feed<CharT, Traits, T&>(*this,x); }
{ return io::detail::feed<CharT, Tr, Alloc, T&>(*this,x); }
#endif
// modifying a format object
// ** object modifying **//
template<class T>
basic_format& bind_arg(int argN, const T& val)
{ return io::detail::bind_arg_body(*this, argN, val); }
basic_format& clear_bind(int argN);
template<class T>
basic_format& modify_item(int itemN, T manipulator)
{ return io::detail::modify_item_body<Ch,Tr,T> (*this, itemN, manipulator);}
{ return io::detail::modify_item_body<Ch,Tr, Alloc, T> (*this, itemN, manipulator);}
// Choosing which errors will throw exceptions :
unsigned char exceptions() const;
unsigned char exceptions(unsigned char newexcept);
// final output
size_type size() const; // sum of the current string pieces sizes
string_t str() const;
friend BOOST_IO_STD basic_ostream<Ch, Tr>&
#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300)
operator<< (BOOST_IO_STD basic_ostream<Ch, Tr>& , const basic_format& );
#else
operator<< <Ch, Tr> (BOOST_IO_STD basic_ostream<Ch, Tr>&, const basic_format&);
#endif
#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) \
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \
&& !BOOST_WORKAROUND( _CRAYC, != 0)
&& !BOOST_WORKAROUND( _CRAYC, != 0) \
&& !BOOST_WORKAROUND(__DECCXX_VER, <= 60590041)
// use friend templates and private members only if supported
template<class Ch2, class Tr2, class T> friend basic_format<Ch2, Tr2>&
io::detail::feed(basic_format<Ch2,Tr2>&, T);
template<class Ch2, class Tr2, class T> friend
void io::detail::distribute(basic_format<Ch2,Tr2>&, T);
template<class Ch2, class Tr2, class T> friend
basic_format<Ch2, Tr2>& io::detail::modify_item_body(basic_format<Ch2, Tr2>&, int, T);
template<class Ch2, class Tr2, class T> friend
basic_format<Ch2, Tr2>& io::detail::bind_arg_body(basic_format<Ch2, Tr2>&, int, const T&);
#ifndef BOOST_NO_TEMPLATE_STD_STREAM
template<class Ch2, class Tr2, class Alloc2>
friend std::basic_ostream<Ch2, Tr2> &
operator<<( std::basic_ostream<Ch2, Tr2> & ,
const basic_format<Ch2, Tr2, Alloc2>& );
#else
template<class Ch2, class Tr2, class Alloc2>
friend std::ostream &
operator<<( std::ostream & ,
const basic_format<Ch2, Tr2, Alloc2>& );
#endif
template<class Ch2, class Tr2, class Alloc2, class T>
friend basic_format<Ch2, Tr2, Alloc2>&
io::detail::feed (basic_format<Ch2, Tr2, Alloc2>&, T);
template<class Ch2, class Tr2, class Alloc2, class T> friend
void io::detail::distribute (basic_format<Ch2, Tr2, Alloc2>&, T);
template<class Ch2, class Tr2, class Alloc2, class T> friend
basic_format<Ch2, Tr2, Alloc2>&
io::detail::modify_item_body (basic_format<Ch2, Tr2, Alloc2>&, int, T);
template<class Ch2, class Tr2, class Alloc2, class T> friend
basic_format<Ch2, Tr2, Alloc2>&
io::detail::bind_arg_body (basic_format<Ch2, Tr2, Alloc2>&, int, const T&);
private:
#endif
typedef BOOST_IO_STD basic_ostream<Ch, Tr> stream_t;
typedef io::detail::stream_format_state<Ch, Tr> stream_format_state;
typedef io::detail::format_item<Ch, Tr> format_item_t;
// flag bits, used for style_
enum style_values { ordered = 1, // set only if all directives are positional
special_needs = 4 };
void make_or_reuse_data(std::size_t nbitems);// used for (re-)initialisation
// member data --------------------------------------------//
std::vector<format_item_t> items_; // each '%..' directive leads to a format_item
std::vector<bool> bound_; // stores which arguments were bound. size() == 0 || num_args
int style_; // style of format-string : positional or not, etc
int style_; // style of format-string : positional or not, etc
int cur_arg_; // keep track of wich argument is current
int num_args_; // number of expected arguments
mutable bool dumped_; // true only after call to str() or <<
string_t prefix_; // piece of string to insert before first item
internal_stream_t oss_; // the internal stream.
string_type prefix_; // piece of string to insert before first item
unsigned char exceptions_;
internal_streambuf_t buf_; // the internal stream buffer.
boost::optional<io::detail::locale_t> loc_;
}; // class basic_format
} // namespace boost

View File

@ -1,19 +1,14 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// ----------------------------------------------------------------------------
// format_fwd.hpp : forward declarations
// ----------------------------------------------------------------------------
// (C) Samuel Krempp 2001
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
// See http://www.boost.org/libs/format for library home page
// ------------------------------------------------------------------------------
// format_fwd.hpp : forward declarations, for primary header format.hpp
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_FWD_HPP
#define BOOST_FORMAT_FWD_HPP
@ -21,45 +16,33 @@
#include <string>
#include <iosfwd>
#include <boost/format/detail/config_macros.hpp>
#include <boost/format/detail/compat_workarounds.hpp>
namespace boost {
template <class Ch,
#if !( BOOST_WORKAROUND(__GNUC__, <3) && defined(__STL_CONFIG_H) )
class Tr = BOOST_IO_STD char_traits<Ch> >
#if !( BOOST_WORKAROUND(__GNUC__, <3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) )
// gcc-2.95's native stdlid needs special treatment
class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> >
#else
class Tr = std::string_char_traits<Ch> >
class Tr = std::string_char_traits<Ch>, class Alloc = std::alloc >
#endif
class basic_format;
typedef basic_format<char > format;
#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) \
&& !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
//we use either sstream or strstream, and strstream doesnt support wchar
&& !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
typedef basic_format<wchar_t > wformat;
#endif
template<class Ch, class Tr>
std::basic_string<Ch, Tr> str(const basic_format<Ch, Tr>& ) ;
namespace io {
using ::boost::str; // it used to bed define in boost::io, keep compatibility
enum format_error_bits { bad_format_string_bit = 1,
too_few_args_bit = 2, too_many_args_bit = 4,
out_of_range_bit = 8,
all_error_bits = 255, no_error_bits=0 };
namespace io {
enum format_error_bits { bad_format_string_bit = 1,
too_few_args_bit = 2, too_many_args_bit = 4,
out_of_range_bit = 8,
all_error_bits = 255, no_error_bits=0 };
} // namespace io
template< class Ch, class Tr>
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator<<( BOOST_IO_STD basic_ostream<Ch, Tr>&, const basic_format<Ch, Tr>&);
} // namespace io
} // namespace boost

View File

@ -1,25 +1,20 @@
// -*- C++ -*-
// Boost general library format ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream
// ----------------------------------------------------------------------------
// format_implementation.hpp Implementation of the basic_format class
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_IMPLEMENTATION_HPP
#define BOOST_FORMAT_IMPLEMENTATION_HPP
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/assert.hpp>
#include <boost/format/format_class.hpp>
@ -27,9 +22,10 @@
namespace boost {
// -------- format:: -------------------------------------------
template< class Ch, class Tr>
basic_format<Ch, Tr>:: basic_format(const Ch* str)
// --- basic_format implementation -----------------------------------------//
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* str)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
{
@ -37,44 +33,56 @@ namespace boost {
parse( str );
}
#ifndef BOOST_NO_STD_LOCALE
template< class Ch, class Tr>
basic_format<Ch, Tr>:: basic_format(const Ch* str, const std::locale & loc)
#if !defined(BOOST_NO_STD_LOCALE)
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* str, const std::locale & loc)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
loc_(loc), exceptions_(io::all_error_bits)
{
oss_.imbue( loc );
if(str) parse( str );
}
template< class Ch, class Tr>
basic_format<Ch, Tr>:: basic_format(const string_t& s, const std::locale & loc)
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s, const std::locale & loc)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
loc_(loc), exceptions_(io::all_error_bits)
{
oss_.imbue( loc );
parse(s);
}
#endif //BOOST_NO_STD_LOCALE
#endif // ! BOOST_NO_STD_LOCALE
template< class Ch, class Tr, class Alloc>
io::detail::locale_t basic_format<Ch, Tr, Alloc>::
getloc() const {
return loc_ ? loc_.get() : io::detail::locale_t();
}
template< class Ch, class Tr>
basic_format<Ch, Tr>:: basic_format(const string_t& s)
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
{
parse(s);
}
template< class Ch, class Tr>
basic_format<Ch, Tr>:: basic_format(const basic_format& x)
: items_(x.items_), bound_(x.bound_), style_(x.style_),
cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
prefix_(x.prefix_), exceptions_(x.exceptions_)
{
}
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>:: basic_format(const basic_format& x)
: items_(x.items_), bound_(x.bound_), style_(x.style_),
cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_)
{
}
template< class Ch, class Tr>
void basic_format<Ch, Tr>:: swap (basic_format & x) {
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>& basic_format<Ch, Tr, Alloc>::
operator= (const basic_format& x) {
if(this == &x)
return *this;
(basic_format<Ch, Tr, Alloc>(x)).swap(*this);
return *this;
}
template< class Ch, class Tr, class Alloc>
void basic_format<Ch, Tr, Alloc>::
swap (basic_format & x) {
std::swap(exceptions_, x.exceptions_);
std::swap(style_, x.style_);
std::swap(cur_arg_, x.cur_arg_);
@ -86,41 +94,40 @@ namespace boost {
bound_.swap(x.bound_);
}
template< class Ch, class Tr>
basic_format<Ch, Tr>& basic_format<Ch, Tr>:: operator= (const basic_format& x) {
if(this == &x)
return *this;
(basic_format<Ch, Tr>(x)).swap(*this);
return *this;
}
template< class Ch, class Tr>
unsigned char basic_format<Ch,Tr>:: exceptions() const {
template< class Ch, class Tr, class Alloc>
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions() const {
return exceptions_;
}
template< class Ch, class Tr>
unsigned char basic_format<Ch,Tr>:: exceptions(unsigned char newexcept) {
template< class Ch, class Tr, class Alloc>
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions(unsigned char newexcept) {
unsigned char swp = exceptions_;
exceptions_ = newexcept;
return swp;
}
template<class Ch, class Tr>
void basic_format<Ch, Tr>:: make_or_reuse_data(std::size_t nbitems) {
Ch fill = oss_.widen(' ');
template<class Ch, class Tr, class Alloc>
void basic_format<Ch, Tr, Alloc>::
make_or_reuse_data (std::size_t nbitems) {
#if !defined(BOOST_NO_STD_LOCALE)
Ch fill = ( BOOST_USE_FACET(std::ctype<Ch>, getloc()) ). widen(' ');
#else
Ch fill = ' ';
#endif
if(items_.size() == 0)
items_.assign( nbitems, format_item_t(fill) );
else {
if(nbitems>items_.size())
items_.resize(nbitems, format_item_t(fill));
bound_.resize(0);
items_.resize(nbitems, format_item_t(fill));
for(std::size_t i=0; i < nbitems; ++i)
items_[i].reset(fill); // strings are resized to "", instead of reallocated
items_[i].reset(fill); // strings are resized, instead of reallocated
}
}
template< class Ch, class Tr>
basic_format<Ch,Tr>& basic_format<Ch,Tr>:: clear() {
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear () {
// empty the string buffers (except bound arguments)
// and make the format object ready for formatting a new set of arguments
@ -128,32 +135,34 @@ namespace boost {
for(unsigned long i=0; i<items_.size(); ++i) {
// clear converted strings only if the corresponding argument is not bound :
if( bound_.size()==0 || !bound_[ items_[i].argN_ ] ) items_[i].res_.resize(0);
if( bound_.size()==0 || !bound_[ items_[i].argN_ ] )
items_[i].res_.resize(0);
}
cur_arg_=0; dumped_=false;
// maybe first arg is bound:
if(bound_.size() != 0) {
while(cur_arg_ < num_args_ && bound_[cur_arg_] )
++cur_arg_;
for(; cur_arg_ < num_args_ && bound_[cur_arg_]; ++cur_arg_)
{}
}
return *this;
}
template< class Ch, class Tr>
basic_format<Ch,Tr>& basic_format<Ch,Tr>:: clear_binds() {
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear_binds () {
// remove all binds, then clear()
bound_.resize(0);
clear();
return *this;
}
template< class Ch, class Tr>
basic_format<Ch,Tr>& basic_format<Ch,Tr>:: clear_bind(int argN) {
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear_bind (int argN) {
// remove the bind of ONE argument then clear()
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) {
if( exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range()); // arg not in range.
if( exceptions() & io::out_of_range_bit)
boost::throw_exception(io::out_of_range(argN, 1, num_args_+1 ) );
else return *this;
}
bound_[argN-1]=false;
@ -161,18 +170,19 @@ namespace boost {
return *this;
}
template< class Ch, class Tr>
std::basic_string<Ch,Tr> basic_format<Ch,Tr>:: str() const {
dumped_=true;
template< class Ch, class Tr, class Alloc>
typename basic_format<Ch, Tr, Alloc>::string_type
basic_format<Ch,Tr, Alloc>::
str () const {
if(items_.size()==0)
return prefix_;
if( cur_arg_ < num_args_)
if( exceptions() & io::too_few_args_bit )
boost::throw_exception(io::too_few_args()); // not enough variables supplied
// not enough variables supplied
boost::throw_exception(io::too_few_args(cur_arg_, num_args_));
unsigned long i;
string_t res;
string_type res;
res.reserve(size());
res += prefix_;
for(i=0; i < items_.size(); ++i) {
@ -186,36 +196,38 @@ namespace boost {
}
res += item.appendix_;
}
dumped_=true;
return res;
}
template< class Ch, class Tr>
typename basic_format<Ch, Tr>::size_type basic_format<Ch,Tr>::
template< class Ch, class Tr, class Alloc>
typename basic_format<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr, Alloc>::
size () const {
BOOST_USING_STD_MAX();
std::streamsize sz = prefix_.size();
unsigned long i;
for(i=0; i < items_.size(); ++i) {
const format_item_t& item = items_[i];
sz += item.res_.size();
if( item.argN_ == format_item_t::argN_tabulation)
sz = std::max(sz, item.fmtstate_.width_);
sz = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz, item.fmtstate_.width_);
sz += + item.appendix_.size();
}
return static_cast<size_type> (sz);
return static_cast<typename string_type::size_type> (sz);
}
namespace io {
namespace detail {
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& bind_arg_body( basic_format<Ch, Tr>& self,
int argN, const T& val) {
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
bind_arg_body (basic_format<Ch, Tr, Alloc>& self, int argN, const T& val) {
// bind one argument to a fixed value
// this is persistent over clear() calls, thus also over str() and <<
if(self.dumped_)
self.clear(); // needed because we will modify cur_arg_
if(argN<1 || argN > self.num_args_) {
if( self.exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range()); // arg not in range.
boost::throw_exception(io::out_of_range(argN, 1, self.num_args_+1 ) );
else return self;
}
if(self.bound_.size()==0)
@ -242,14 +254,13 @@ namespace detail {
return self;
}
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& modify_item_body( basic_format<Ch, Tr>& self,
int itemN, T manipulator) {
template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>&
modify_item_body (basic_format<Ch, Tr, Alloc>& self, int itemN, T manipulator) {
// applies a manipulator to the format_item describing a given directive.
// this is a permanent change, clear or reset won't cancel that.
if(itemN<1 || itemN > static_cast<signed int>(self.items_.size() )) {
if( self.exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range()); // item not in range.
boost::throw_exception(io::out_of_range(itemN, 1, self.items_.size() ));
else return self;
}
self.items_[itemN-1].fmtstate_. template apply_manip<T> ( manipulator );

View File

@ -1,19 +1,14 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// ----------------------------------------------------------------------------
// free_funcs.hpp : implementation of the free functions of boost::format
// ----------------------------------------------------------------------------
// (C) Samuel Krempp 2001
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
// See http://www.boost.org/libs/format for library home page
// ------------------------------------------------------------------------------
// free_funcs.hpp : implementation of the free functions declared in namespace format
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_FUNCS_HPP
#define BOOST_FORMAT_FUNCS_HPP
@ -23,26 +18,36 @@
namespace boost {
template<class Ch, class Tr> inline
std::basic_string<Ch, Tr> str(const basic_format<Ch, Tr>& f) {
template<class Ch, class Tr, class Alloc> inline
std::basic_string<Ch, Tr, Alloc> str(const basic_format<Ch, Tr, Alloc>& f) {
// adds up all pieces of strings and converted items, and return the formatted string
return f.str();
}
namespace io {
using ::boost::str; // keep compatibility with when it was defined in this N.S.
} // - namespace io
template< class Ch, class Tr>
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator<<( BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const boost::basic_format<Ch, Tr>& f)
// effect: "return os << str(f);" but we can try to do it faster
#ifndef BOOST_NO_TEMPLATE_STD_STREAM
template<class Ch, class Tr, class Alloc>
std::basic_ostream<Ch, Tr> &
operator<<( std::basic_ostream<Ch, Tr> & os,
const basic_format<Ch, Tr, Alloc>& f)
#else
template<class Ch, class Tr, class Alloc>
std::ostream &
operator<<( std::ostream & os,
const basic_format<Ch, Tr, Alloc>& f)
#endif
// effect: "return os << str(f);" but we can do it faster
{
typedef boost::basic_format<Ch, Tr> format_t;
typedef boost::basic_format<Ch, Tr, Alloc> format_t;
if(f.items_.size()==0)
os << f.prefix_;
else {
if(f.cur_arg_ < f.num_args_)
if( f.exceptions() & io::too_few_args_bit )
boost::throw_exception(io::too_few_args()); // not enough variables supplied
// not enough variables supplied
boost::throw_exception(io::too_few_args(f.cur_arg_, f.num_args_));
if(f.style_ & format_t::special_needs)
os << f.str();
else {

View File

@ -1,28 +1,22 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// ----------------------------------------------------------------------------
// group.hpp : encapsulates a group of manipulators along with an argument
// ----------------------------------------------------------------------------
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// group.hpp : encapsulates a group of manipulators along with an argument
//
// group_head : cut the last element of a group out.
// (is overloaded below on each type of group)
// group_last : returns the last element of a group
// (is overloaded below on each type of group)
// ----------------------------------------------------------------------------
@ -671,7 +665,7 @@ detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> >
}
#endif //end- #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif // - BOOST_NO_OVERLOAD_FOR_NON_CONST
} // namespace io

View File

@ -1,39 +1,33 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream
// ----------------------------------------------------------------------------
// internals.hpp : internal structs. included by format.hpp
// stream_format_state, and format_item
// internals.hpp : internal structs : stream_format_state, format_item.
// included by format.hpp
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_INTERNALS_HPP
#define BOOST_FORMAT_INTERNALS_HPP
#include <string>
#include <boost/assert.hpp>
#include <boost/format/outsstream.hpp>
#include <boost/optional.hpp>
#include <boost/limits.hpp>
#include <boost/format/detail/compat_workarounds.hpp>
#include <boost/format/alt_sstream.hpp> // used as a dummy stream
namespace boost {
namespace io {
namespace detail {
//----- stream_format_state --------------------------------------------------//
//---- stream_format_state --------------------------------------------------//
// set of params that define the format state of a stream
template<class Ch, class Tr>
@ -42,11 +36,12 @@ namespace detail {
typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
stream_format_state(Ch fill) { reset(fill); }
stream_format_state(const basic_ios& os) { set_by_stream(os); }
// stream_format_state(const basic_ios& os) { set_by_stream(os); }
void reset(Ch fill); //- sets to default state.
void set_by_stream(const basic_ios& os); //- sets to os's state.
void apply_on(basic_ios & os) const; //- applies format_state to the stream
void apply_on(basic_ios & os, //- applies format_state to the stream
boost::io::detail::locale_t * loc_default = 0) const;
template<class T>
void apply_manip(T manipulator) //- modifies state by applying manipulator
{ apply_manip_body<Ch, Tr, T>( *this, manipulator) ; }
@ -58,13 +53,14 @@ namespace detail {
std::ios_base::fmtflags flags_;
std::ios_base::iostate rdstate_;
std::ios_base::iostate exceptions_;
boost::optional<boost::io::detail::locale_t> loc_;
};
//----- format_item ---------------------------------------------------------//
//---- format_item ---------------------------------------------------------//
// stores all parameters that can be specified in format strings
template<class Ch, class Tr>
template<class Ch, class Tr, class Alloc>
struct format_item
{
enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 };
@ -75,9 +71,9 @@ namespace detail {
argN_tabulation = -2, // tabulation directive. (no argument read)
argN_ignored = -3 // ignored directive. (no argument read)
};
typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
typedef detail::stream_format_state<Ch, Tr> stream_format_state;
typedef std::basic_string<Ch, Tr> string_t;
typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
typedef detail::stream_format_state<Ch, Tr> stream_format_state;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
format_item(Ch fill) :argN_(argN_no_posit), fmtstate_(fill),
truncate_(max_streamsize()), pad_scheme_(0) {}
@ -85,28 +81,29 @@ namespace detail {
void compute_states(); // sets states according to truncate and pad_scheme.
static std::streamsize max_streamsize() {
return std::numeric_limits<std::streamsize>::max();
return (std::numeric_limits<std::streamsize>::max)();
}
// --- data ---
int argN_; //- argument number (starts at 0, eg : %1 => argN=0)
// negative values for items that don't process an argument
string_t res_; //- result of the formatting of this item
string_t appendix_; //- piece of string between this item and the next
string_type res_; //- result of the formatting of this item
string_type appendix_; //- piece of string between this item and the next
stream_format_state fmtstate_;// set by parsing, is only affected by modify_item
std::streamsize truncate_; //- is set for directives like %.5s that ask truncation
std::streamsize truncate_;//- is set for directives like %.5s that ask truncation
unsigned int pad_scheme_;//- several possible padding schemes can mix. see pad_values
};
//---- Definitions ------------------------------------------------------------
//--- Definitions ------------------------------------------------------------
// --- stream_format_state:: -------------------------------------------------
// - stream_format_state:: -------------------------------------------------
template<class Ch, class Tr>
void stream_format_state<Ch,Tr>:: apply_on(basic_ios & os) const {
void stream_format_state<Ch,Tr>:: apply_on (basic_ios & os,
boost::io::detail::locale_t * loc_default) const {
// set the state of this stream according to our params
if(width_ != -1)
os.width(width_);
@ -117,6 +114,12 @@ namespace detail {
os.flags(flags_);
os.clear(rdstate_);
os.exceptions(exceptions_);
#if !defined(BOOST_NO_STD_LOCALE)
if(loc_)
os.imbue(loc_.get());
else if(loc_default)
os.imbue(*loc_default);
#endif
}
template<class Ch, class Tr>
@ -135,7 +138,7 @@ namespace detail {
void apply_manip_body( stream_format_state<Ch, Tr>& self,
T manipulator) {
// modify our params according to the manipulator
basic_outsstream<Ch, Tr> ss;
basic_oaltstringstream<Ch, Tr> ss;
self.apply_on( ss );
ss << manipulator;
self.set_by_stream( ss );
@ -155,16 +158,17 @@ namespace detail {
// --- format_item:: --------------------------------------------------------
template<class Ch, class Tr>
void format_item<Ch, Tr>::
reset(Ch fill) {
template<class Ch, class Tr, class Alloc>
void format_item<Ch, Tr, Alloc>::
reset (Ch fill) {
argN_=argN_no_posit; truncate_ = max_streamsize(); pad_scheme_ =0;
res_.resize(0); appendix_.resize(0);
fmtstate_.reset(fill);
}
template<class Ch, class Tr>
void format_item<Ch, Tr>:: compute_states() {
template<class Ch, class Tr, class Alloc>
void format_item<Ch, Tr, Alloc>::
compute_states() {
// reflect pad_scheme_ on fmt_state_
// because some pad_schemes has complex consequences on several state params.
if(pad_scheme_ & zeropad) {

View File

@ -1,20 +1,14 @@
// -*- C++ -*-
// Boost general library 'format' ---------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2001
// krempp@crans.ens-cachan.fr
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ideas taken from Rüdiger Loos's format class
// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// internals_fwd.hpp : forward declarations, for internal headers
// ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_INTERNAL_FWD_HPP
#define BOOST_FORMAT_INTERNAL_FWD_HPP
@ -28,34 +22,34 @@ namespace io {
namespace detail {
template<class Ch, class Tr> struct stream_format_state;
template<class Ch, class Tr> struct format_item;
}
template<class Ch, class Tr, class Alloc> struct format_item;
namespace detail {
// these functions were intended as methods,
// but MSVC have problems with template member functions :
// defined in format_implementation.hpp :
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& modify_item_body( basic_format<Ch, Tr>& self,
int itemN, T manipulator);
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
modify_item_body (basic_format<Ch, Tr, Alloc>& self,
int itemN, T manipulator);
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& bind_arg_body( basic_format<Ch, Tr>& self,
int argN, const T& val);
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
bind_arg_body (basic_format<Ch, Tr, Alloc>& self,
int argN, const T& val);
// in internals.hpp :
template<class Ch, class Tr, class T>
void apply_manip_body( stream_format_state<Ch, Tr>& self,
void apply_manip_body (stream_format_state<Ch, Tr>& self,
T manipulator);
// argument feeding (defined in feed_args.hpp ) :
template<class Ch, class Tr, class T>
void distribute(basic_format<Ch,Tr>& self, T x);
// argument feeding (defined in feed_args.hpp ) :
template<class Ch, class Tr, class Alloc, class T>
void distribute (basic_format<Ch,Tr, Alloc>& self, T x);
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& feed(basic_format<Ch,Tr>& self, T x);
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
feed (basic_format<Ch,Tr, Alloc>& self, T x);
} // namespace detail

View File

@ -1,146 +0,0 @@
// -*- C++ -*-
// Boost format ----------------------------------------------------
// See http://www.boost.org for updates, documentation, and revision history.
// (C) Samuel Krempp 2003
// Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// ------------------------------------------------------------------------------
// outsstream<Ch, Tr> is a class extending stringstream by adding :
// clear_buffer() method, and
// access to the [pbase(), pptr()[ part of the 'output sequence'
// (see §27.5.1 of the C++ standard)
// if sstream is not available, it uses strstream and is slightly different.
// ------------------------------------------------------------------------------
#ifndef BOOST_FORMAT_OUTSSTREAM_H
#define BOOST_FORMAT_OUTSSTREAM_H
#include <boost/assert.hpp>
#include <boost/utility/base_from_member.hpp>
#include <boost/format/detail/config_macros.hpp>
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
#include <sstream>
#else
#include <strstream>
#include <string>
#endif // BOOST_NO_STRING_STREAM
namespace boost {
namespace io {
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
//---- The stringstream way ---------------------------------------------------
// --- class steal_basic_stringbuf : steals pbase(), pptr() & co -----------
template<class Ch, class Tr = BOOST_IO_STD char_traits<Ch> >
class steal_basic_stringbuf : public std::basic_stringbuf<Ch, Tr>
{
typedef std::basic_stringbuf<Ch, Tr> buff_t;
public:
typedef std::basic_string<Ch,Tr> string_type;
// get [pbase, pptr[ from stringbuf::str(), which returns [pbase, epptr[ :
string_type cur_str() const { return string_type(this->str(), 0, pcount()); }
// publicize those functions (protected in stringbuf) :
std::streamsize pcount() const { return pptr() - pbase(); }
const Ch * pbase() const { return buff_t::pbase(); }
const Ch * pptr() const { return buff_t::pptr(); }
const Ch * epptr() const { return buff_t::epptr(); }
// added convenience function :
void clear_buffer();
};
// --- class basic_outsstream -----------------------------------------------
template<class Ch, class Tr = BOOST_IO_STD char_traits<Ch> >
class basic_outsstream : boost::base_from_member<steal_basic_stringbuf<Ch, Tr> >,
public BOOST_IO_STD basic_ostream<Ch, Tr>
// use stringbuf with its stolen protected members,
// publicly derived from basic_ostream to make this class a stream.
{
public:
typedef std::basic_string<Ch,Tr> string_type;
basic_outsstream() : pbase_type(),
std::basic_ostream<Ch,Tr>( & sb() ) {}
// buffer access via strings
string_type str() const { return sb().str(); } // [begin, end[
string_type cur_str() const { return sb().cur_str(); } // [begin, cur[
// copy-less access (note the pointers can be invalidated when modifying the stream)
std::streamsize pcount() const { return sb().pcount(); }
const Ch * begin() const { return sb().pbase(); }
const Ch * cur() const { return sb().pptr(); }
const Ch * end() const { return sb().epptr(); }
void clear_buffer() { sb().clear_buffer(); }
private:
typedef boost::base_from_member<steal_basic_stringbuf<Ch, Tr> > pbase_type;
steal_basic_stringbuf<Ch, Tr> & sb() { return pbase_type::member; }
steal_basic_stringbuf<Ch, Tr> const& sb() const { return pbase_type::member; }
};
#else // BOOST_NO_STRINGSTREAM
//---- The strstream way ------------------------------------------------------
template <class Ch,
#if !( BOOST_WORKAROUND(__GNUC__, <3) && defined(__STL_CONFIG_H) )
class Tr = BOOST_IO_STD char_traits<Ch> >
#else
class Tr = std::string_char_traits<Ch> >
#endif
class basic_outsstream; // we define only the <char> specialisaton
// --- class basic_outsstream -----------------------------------------------
template<class Tr>
class basic_outsstream<char, Tr> : private BOOST_IO_STD strstreambuf,
public std::basic_ostream<char, Tr>
{
public:
typedef char Ch;
typedef std::basic_string<Ch,Tr> string_type;
typedef BOOST_IO_STD strstreambuf buff_t;
typedef std::basic_ostream<char, Tr> stream_t;
public:
basic_outsstream();
// ! physically copy chars :
string_type str();
string_type cur_str() const { return string_type(begin(), cur()); }
int freeze() const { return buff_t::freeze(); }
void freeze(int x) { buff_t::freeze(x); }
// copy-less access (be careful, the pointer are invalidated when modifying the stream) :
std::streamsize pcount() const { return cur()-begin(); }
const Ch * begin() const { return buff_t::pbase(); }
const Ch * cur() const { return buff_t::pptr(); }
const Ch * end() const { return buff_t::epptr(); }
void clear_buffer();
};
#endif // BOOST_NO_STRINGSTREAM
typedef basic_outsstream<char> outsstream;
} // namespace boost::io
} // namespace boost
#include <boost/format/outsstream_impl.hpp> // implementation
#endif // BOOST_FORMAT_OUTSSTREAM_H include guard

Some files were not shown because too many files have changed in this diff Show More