diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-19 08:48:05 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-19 21:29:44 (GMT) |
commit | b1836ffb49bd7740dbd7c32bfad04d077e81ecb5 (patch) | |
tree | 9d0d9b3fad9c2bbd0192696d59e08477b8c22c10 /3rdParty | |
parent | 2f6c2299c28c9bb03ee1437058a4c7071ff2ac3f (diff) | |
download | swift-b1836ffb49bd7740dbd7c32bfad04d077e81ecb5.zip swift-b1836ffb49bd7740dbd7c32bfad04d077e81ecb5.tar.bz2 |
Make Swift translatable.
Diffstat (limited to '3rdParty')
20 files changed, 3471 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/format.hpp b/3rdParty/Boost/src/boost/format.hpp new file mode 100644 index 0000000..73464a8 --- /dev/null +++ b/3rdParty/Boost/src/boost/format.hpp @@ -0,0 +1,59 @@ +// ---------------------------------------------------------------------------- +// 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/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 + +// **** Forward declarations ---------------------------------- +#include <boost/format/format_fwd.hpp> // basic_format<Ch,Tr>, and other frontends +#include <boost/format/internals_fwd.hpp> // misc forward declarations for internal use + +// **** Auxiliary structs (stream_format_state<Ch,Tr> , and format_item<Ch,Tr> ) +#include <boost/format/internals.hpp> + +// **** Format class interface -------------------------------- +#include <boost/format/format_class.hpp> + +// **** Exceptions ----------------------------------------------- +#include <boost/format/exceptions.hpp> + +// **** Implementation ------------------------------------------- +#include <boost/format/format_implementation.hpp> // member functions +#include <boost/format/group.hpp> // class for grouping arguments +#include <boost/format/feed_args.hpp> // argument-feeding functions +#include <boost/format/parsing.hpp> // format-string parsing (member-)functions + +// **** Implementation of the free functions ---------------------- +#include <boost/format/free_funcs.hpp> + + +// *** Undefine 'local' macros : +#include <boost/format/detail/unset_macros.hpp> + +#endif // BOOST_FORMAT_HPP diff --git a/3rdParty/Boost/src/boost/format/alt_sstream.hpp b/3rdParty/Boost/src/boost/format/alt_sstream.hpp new file mode 100644 index 0000000..e236be3 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/alt_sstream.hpp @@ -0,0 +1,176 @@ +// ---------------------------------------------------------------------------- +// 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 typename string_type::size_type size_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; + size_type size() const; + size_type cur_size() const; // stop at current pointer + Ch * pend() const // the highest position reached by pptr() since creation + { return ((putend_ < pptr()) ? pptr() : putend_); } + size_type pcount() const + { return static_cast<size_type>( 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 typename string_type::size_type size_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(); } + size_type size() const + { return rdbuf()->size(); } + size_type 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(); } + void str(const string_type& s) + { rdbuf()->str(s); } + }; + + } // N.S. io +} // N.S. boost + +#include <boost/format/alt_sstream_impl.hpp> + +#endif // include guard + diff --git a/3rdParty/Boost/src/boost/format/alt_sstream_impl.hpp b/3rdParty/Boost/src/boost/format/alt_sstream_impl.hpp new file mode 100644 index 0000000..9975e4f --- /dev/null +++ b/3rdParty/Boost/src/boost/format/alt_sstream_impl.hpp @@ -0,0 +1,313 @@ +// ---------------------------------------------------------------------------- +// 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) { + size_type sz=s.size(); + if(sz != 0 && mode_ & (::std::ios_base::in | ::std::ios_base::out) ) { +#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC + void *vd_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0); + Ch *new_ptr = static_cast<Ch *>(vd_ptr); +#else + Ch *new_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0); +#endif + // if this didnt throw, we're safe, update the buffer + dealloc(); + sz = s.copy(new_ptr, sz); + 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(static_cast<int>(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> + typename std::basic_string<Ch,Tr,Alloc>::size_type + basic_altstringbuf<Ch, Tr, Alloc>:: + size () const { + if(mode_ & ::std::ios_base::out && pptr()) + return static_cast<size_type>(pend() - pbase()); + else if(mode_ & ::std::ios_base::in && gptr()) + return static_cast<size_type>(egptr() - eback()); + else + return 0; + } + + template<class Ch, class Tr, class Alloc> + typename std::basic_string<Ch,Tr,Alloc>::size_type + 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 += static_cast<off_type>(putend_ - gptr()); + else if(way == ::std::ios_base::beg) + off += static_cast<off_type>(eback() - gptr()); + else if(way != ::std::ios_base::cur || (which & ::std::ios_base::out) ) + // (altering in&out is only supported if way is beg or end, not cur) + return pos_type(off_type(-1)); + if(eback() <= off+gptr() && off+gptr() <= putend_ ) { + // set gptr + streambuf_t::gbump(static_cast<int>(off)); + if(which & ::std::ios_base::out && pptr() != NULL) + // update pptr to match gptr + streambuf_t::pbump(static_cast<int>(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 += static_cast<off_type>(putend_ - pptr()); + else if(way == ::std::ios_base::beg) + off += static_cast<off_type>(pbase() - pptr()); + else if(way != ::std::ios_base::beg) + return pos_type(off_type(-1)); + if(pbase() <= off+pptr() && off+pptr() <= putend_) + // set pptr + streambuf_t::pbump(static_cast<int>(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(static_cast<int>(eback() - gptr() + off)); + if(which & ::std::ios_base::out && pptr() != NULL) { + // update pptr to match gptr + streambuf_t::pbump(static_cast<int>(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(static_cast<int>(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) { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4996) +#endif + 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; +#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC + void *vdptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0); + newptr = static_cast<Ch *>(vdptr); +#else + newptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0); +#endif + } + + 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 = static_cast<int>(pptr()-pbase()); + int gptr_count = static_cast<int>(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; + } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } + // -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 + diff --git a/3rdParty/Boost/src/boost/format/detail/compat_workarounds.hpp b/3rdParty/Boost/src/boost/format/detail/compat_workarounds.hpp new file mode 100644 index 0000000..8e51514 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/detail/compat_workarounds.hpp @@ -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 diff --git a/3rdParty/Boost/src/boost/format/detail/config_macros.hpp b/3rdParty/Boost/src/boost/format/detail/config_macros.hpp new file mode 100644 index 0000000..1f01b17 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/detail/config_macros.hpp @@ -0,0 +1,97 @@ +// -*- C++ -*- +// ---------------------------------------------------------------------------- +// config_macros.hpp : configuration macros for the format library +// only BOOST_IO_STD is absolutely needed (it should be 'std::' in general) +// others are compiler-specific workaround macros used in #ifdef switches +// ---------------------------------------------------------------------------- + +// Copyright Samuel Krempp 2003. Use, modification, and distribution are +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// see http://www.boost.org/libs/format for library home page + + +// ---------------------------------------------------------------------------- + +#ifndef BOOST_FORMAT_CONFIG_MACROS_HPP +#define BOOST_FORMAT_CONFIG_MACROS_HPP + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +// make sure our local macros wont override something : +#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \ + || defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) \ + || defined(BOOST_NO_TEMPLATE_STD_STREAM) \ + || defined(BOOST_FORMAT_STREAMBUF_DEFINED) || defined(BOOST_FORMAT_OSTREAM_DEFINED) +#error "boost::format uses a local macro that is already defined." +#endif + +// specific workarounds. each header can define BOOS_IO_STD if it +// needs. (e.g. because of IO_NEEDS_USING_DECLARATION) +#include <boost/format/detail/workarounds_gcc-2_95.hpp> +#include <boost/format/detail/workarounds_stlport.hpp> + +#ifndef BOOST_IO_STD +# define BOOST_IO_STD ::std:: +#endif + +#if defined(BOOST_NO_STD_LOCALE) || \ + ( BOOST_WORKAROUND(__BORLANDC__, <= 0x564) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) ) +// some future __BORLANDC__ >0x564 versions might not need this +// 0x570 is Borland's kylix branch +#define BOOST_NO_LOCALE_ISDIGIT +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300)) +#define BOOST_NO_OVERLOAD_FOR_NON_CONST +#endif + +// gcc-2.95's native stringstream is not usable +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +#define BOOST_FORMAT_IGNORE_STRINGSTREAM +#endif + + +// **** Workaround for io streams, stlport and msvc. +#ifdef BOOST_IO_NEEDS_USING_DECLARATION +namespace boost { + using std::char_traits; + using std::basic_ostream; + namespace io { + using std::basic_ostream; + namespace detail { + using std::basic_ios; + using std::basic_ostream; + } + } +#if ! defined(BOOST_NO_STD_LOCALE) + using std::locale; + namespace io { + using std::locale; + namespace detail { + using std::locale; + } + } +#endif // locale +} + // -end N.S. boost +#endif // needs_using_declaration + + +// *** hide std::locale if it doesnt exist. +// this typedef is either std::locale or int, avoids placing ifdefs everywhere +namespace boost { namespace io { namespace detail { +#if ! defined(BOOST_NO_STD_LOCALE) + typedef BOOST_IO_STD locale locale_t; +#else + typedef int locale_t; +#endif +} } } + + +// ---------------------------------------------------------------------------- + +#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP diff --git a/3rdParty/Boost/src/boost/format/detail/msvc_disambiguater.hpp b/3rdParty/Boost/src/boost/format/detail/msvc_disambiguater.hpp new file mode 100644 index 0000000..f12e5e9 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/detail/msvc_disambiguater.hpp @@ -0,0 +1,56 @@ +// ---------------------------------------------------------------------------- +// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads) +// the trick was described in boost's list by Aleksey Gurtovoy +// ---------------------------------------------------------------------------- + +// Copyright Samuel Krempp 2003. Use, modification, and distribution are +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// see http://www.boost.org/libs/format for library home page + +// ---------------------------------------------------------------------------- + +#ifndef BOOST_MSVC_DISAMBIGUATER_HPP +#define BOOST_MSVC_DISAMBIGUATER_HPP + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + // this whole header is specifically for msvc up to 7.0 + +#include <boost/format/group.hpp> +#include <ostream> + +namespace boost { +namespace io { +namespace detail { + +template< class Ch, class Tr, class T > +struct disambiguater +{ + template< typename U > + static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long) + { + os << group_head(x.a1_); + } + static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int) + { + } + template< typename U > + static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long) + { + os << group_last(x.a1_); + } + static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int) + { + os << x; + } +}; + +} // namespace detail +} // namespace io +} // namespace boost + +#endif // -BOOST_MSVC + +#endif // -BOOST_MSVC_DISAMBIGUATER_HPP diff --git a/3rdParty/Boost/src/boost/format/detail/unset_macros.hpp b/3rdParty/Boost/src/boost/format/detail/unset_macros.hpp new file mode 100644 index 0000000..b3ac47b --- /dev/null +++ b/3rdParty/Boost/src/boost/format/detail/unset_macros.hpp @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------- +// unset_macros.hpp +// ---------------------------------------------------------------------------- + +// Copyright Samuel Krempp 2003. Use, modification, and distribution are +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/format for library home page + +// ---------------------------------------------------------------------------- + +// *** Undefine 'local' macros : +#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST +#undef BOOST_NO_OVERLOAD_FOR_NON_CONST +#endif +#ifdef BOOST_NO_LOCALE_ISDIGIT +#undef BOOST_NO_LOCALE_ISDIGIT +#endif +#ifdef BOOST_IO_STD +#undef BOOST_IO_STD +#endif +#ifdef BOOST_IO_NEEDS_USING_DECLARATION +#undef BOOST_IO_NEEDS_USING_DECLARATION +#endif +#ifdef BOOST_NO_TEMPLATE_STD_STREAM +#undef BOOST_NO_TEMPLATE_STD_STREAM +#endif +#ifdef BOOST_FORMAT_STREAMBUF_DEFINED +#undef BOOST_FORMAT_STREAMBUF_DEFINED +#endif +#ifdef BOOST_FORMAT_OSTREAM_DEFINED +#undef BOOST_FORMAT_OSTREAM_DEFINED +#endif diff --git a/3rdParty/Boost/src/boost/format/detail/workarounds_gcc-2_95.hpp b/3rdParty/Boost/src/boost/format/detail/workarounds_gcc-2_95.hpp new file mode 100644 index 0000000..8c49d42 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/detail/workarounds_gcc-2_95.hpp @@ -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 diff --git a/3rdParty/Boost/src/boost/format/detail/workarounds_stlport.hpp b/3rdParty/Boost/src/boost/format/detail/workarounds_stlport.hpp new file mode 100644 index 0000000..eb35dc1 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/detail/workarounds_stlport.hpp @@ -0,0 +1,42 @@ +// ---------------------------------------------------------------------------- +// workarounds_stlport.hpp : workaround STLport issues +// ---------------------------------------------------------------------------- + +// Copyright Samuel Krempp 2003. Use, modification, and distribution are +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// see http://www.boost.org/libs/format for library home page + +// ---------------------------------------------------------------------------- + +#ifndef BOOST_MACROS_STLPORT_HPP +#define BOOST_MACROS_STLPORT_HPP + +#if defined(_STLPORT_VERSION) && BOOST_WORKAROUND( BOOST_MSVC, <= 1300) +// msvc-6-stlport fails to find basic_string::append( iterator, iterator) when linking +// might affect other MSwindows compilers +#define BOOST_NO_STRING_APPEND +#endif + +// *** This should go to "boost/config/stdlib/stlport.hpp". + +// If the streams are not native and there are problems with using templates +// accross namespaces, we define some macros to enable a workaround for this. + +// STLport 4.5 +#if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) +# define BOOST_IO_STD +# define BOOST_IO_NEEDS_USING_DECLARATION +#endif + +// STLport 4.0 +#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE) +# define BOOST_IO_STD +# define BOOST_IO_NEEDS_USING_DECLARATION +#endif + + +// ---------------------------------------------------------------------------- + +#endif // BOOST_MACROS_STLPORT_HPP diff --git a/3rdParty/Boost/src/boost/format/exceptions.hpp b/3rdParty/Boost/src/boost/format/exceptions.hpp new file mode 100644 index 0000000..9b2de83 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/exceptions.hpp @@ -0,0 +1,103 @@ +// ---------------------------------------------------------------------------- +// boost/format/exceptions.hpp +// ---------------------------------------------------------------------------- + +// Copyright Samuel Krempp 2003. +// +// 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/format/ for library home page + +// ---------------------------------------------------------------------------- + +#ifndef BOOST_FORMAT_EXCEPTIONS_HPP +#define BOOST_FORMAT_EXCEPTIONS_HPP + + +#include <stdexcept> + + +namespace boost { + + 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 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 + { + 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 referred to more 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 referred to less arguments than were passed"; + } + }; + + + 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 boost + + +#endif // BOOST_FORMAT_EXCEPTIONS_HPP diff --git a/3rdParty/Boost/src/boost/format/feed_args.hpp b/3rdParty/Boost/src/boost/format/feed_args.hpp new file mode 100644 index 0000000..53243dc --- /dev/null +++ b/3rdParty/Boost/src/boost/format/feed_args.hpp @@ -0,0 +1,277 @@ +// ---------------------------------------------------------------------------- +// 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> + +namespace boost { +namespace io { +namespace detail { + + template<class Ch, class Tr, class Alloc> + void mk_str( std::basic_string<Ch,Tr, Alloc> & res, + const Ch * beg, + typename std::basic_string<Ch,Tr,Alloc>::size_type size, + std::streamsize w, + const Ch fill_char, + 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. + { + typedef typename std::basic_string<Ch,Tr,Alloc>::size_type size_type; + res.resize(0); + if(w<=0 || static_cast<size_type>(w) <=size) { + // no need to pad. + res.reserve(size + !!prefix_space); + if(prefix_space) + res.append(1, prefix_space); + if (size) + res.append(beg, size); + } + else { + std::streamsize n=static_cast<std::streamsize>(w-size-!!prefix_space); + std::streamsize n_after = 0, n_before = 0; + res.reserve(static_cast<size_type>(w)); // allocate once for the 2 inserts + if(center) + n_after = n/2, n_before = n - n_after; + else + if(f & std::ios_base::left) + n_after = n; + else + n_before = n; + // now make the res string : + if(n_before) res.append(static_cast<size_type>(n_before), fill_char); + if(prefix_space) + res.append(1, prefix_space); + if (size) + res.append(beg, size); + if(n_after) res.append(static_cast<size_type>(n_after), fill_char); + } + } // -mk_str(..) + + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) +// MSVC needs to be tricked to disambiguate this simple overload.. +// 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 ) { + 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 ) { + 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& ) { + } + + template< class Ch, class Tr, class T> inline + 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 ) { + 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 ) { + 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& ) { + } + + template< class Ch, class Tr, class T> inline + 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 Alloc, class T> + void put( T x, + 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) + { +#ifdef BOOST_MSVC + // If std::min<unsigned> or std::max<unsigned> are already instantiated + // at this point then we get a blizzard of warning messages when we call + // those templates with std::size_t as arguments. Weird and very annoyning... +#pragma warning(push) +#pragma warning(disable:4267) +#endif + // does the actual conversion of x, with given params, into a string + // using the supplied stringbuf. + + 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 ); + // in case x is a group, apply the manip part of it, + // in order to find width + + const std::ios_base::fmtflags fl=oss.flags(); + const bool internal = (fl & std::ios_base::internal) != 0; + 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 = buf.pbase(); + Ch prefix_space = 0; + if(specs.pad_scheme_ & format_item_t::spacepad) + if(buf.pcount()== 0 || + (res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') )) + prefix_space = oss.widen(' '); + size_type res_size = (std::min)( + static_cast<size_type>(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 = buf.pbase(); + size_type res_size = buf.pcount(); + bool prefix_space=false; + if(specs.pad_scheme_ & format_item_t::spacepad) + if(buf.pcount()== 0 || + (res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') )) + prefix_space = true; + if(res_size == static_cast<size_type>(w) && w<=specs.truncate_ && !prefix_space) { + // okay, only one thing was printed and padded, so res is fine + res.assign(res_beg, res_size); + } + 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. + // 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. + + // 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) + oss2 << ' '; + put_last(oss2, x ); + if(buf.pcount()==0 && specs.pad_scheme_ & format_item_t::spacepad) { + prefix_space =true; + oss2 << ' '; + } + // we now have the minimal-length output + const Ch * tmp_beg = buf.pbase(); + size_type tmp_size = (std::min)(static_cast<size_type>(specs.truncate_), + buf.pcount() ); + + + if(static_cast<size_type>(w) <= tmp_size) { + // 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) + //find where we should pad + size_type sz = (std::min)(res_size + (prefix_space ? 1 : 0), tmp_size); + size_type i = prefix_space; + for(; i<sz && tmp_beg[i] == res[i - (prefix_space ? 1 : 0)]; ++i) {} + if(i>=tmp_size) i=prefix_space; + res.assign(tmp_beg, i); + std::streamsize d = w - static_cast<std::streamsize>(tmp_size); + BOOST_ASSERT(d>0); + res.append(static_cast<size_type>( d ), oss2.fill()); + res.append(tmp_beg+i, tmp_size-i); + BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0) + == static_cast<size_type>(w)); + BOOST_ASSERT(res.size() == static_cast<size_type>(w)); + } + } + } + buf.clear_buffer(); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } // end- put(..) + + + 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(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, Alloc, T> (x, self.items_[i], self.items_[i].res_, + self.buf_, boost::get_pointer(self.loc_) ); + } + } + } + + 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, Alloc, T> (self, x); + ++self.cur_arg_; + if(self.bound_.size() != 0) { + while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] ) + ++self.cur_arg_; + } + return self; + } + +} // namespace detail +} // namespace io +} // namespace boost + + +#endif // BOOST_FORMAT_FEED_ARGS_HPP diff --git a/3rdParty/Boost/src/boost/format/format_class.hpp b/3rdParty/Boost/src/boost/format/format_class.hpp new file mode 100644 index 0000000..4555e56 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/format_class.hpp @@ -0,0 +1,168 @@ +// ---------------------------------------------------------------------------- +// format_class.hpp : class interface +// ---------------------------------------------------------------------------- + +// 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_CLASS_HPP +#define BOOST_FORMAT_CLASS_HPP + + +#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/alt_sstream.hpp> + +namespace boost { + + 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 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_type& s); + basic_format(const basic_format& x); + basic_format& operator= (const basic_format& x); + void swap(basic_format& x); + +#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; + + 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, 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, Tr, Alloc, T&>(*this,x); } +#endif + +#if defined(__GNUC__) + // GCC can't handle anonymous enums without some help + // ** arguments passing ** // + basic_format& operator%(const int& x) + { return io::detail::feed<CharT, Tr, Alloc, const int&>(*this,x); } + +#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST + basic_format& operator%(int& x) + { return io::detail::feed<CharT, Tr, Alloc, int&>(*this,x); } +#endif +#endif + + // The total number of arguments expected to be passed to the format objectt + int expected_args() const + { return num_args_; } + // The number of arguments currently bound (see bind_arg(..) ) + int bound_args() const; + // The number of arguments currently fed to the format object + int fed_args() const; + // The index (1-based) of the current argument (i.e. next to be formatted) + int cur_arg() const; + // The number of arguments still required to be fed + int remaining_args() const; // same as expected_args() - bound_args() - fed_args() + + + // ** 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, Alloc, T> (*this, itemN, manipulator);} + + // Choosing which errors will throw exceptions : + unsigned char exceptions() const; + unsigned char exceptions(unsigned char newexcept); + +#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) \ + && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \ + && !BOOST_WORKAROUND( _CRAYC, != 0) \ + && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + // use friend templates and private members only if supported + +#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 io::detail::stream_format_state<Ch, Tr> stream_format_state; + // 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 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_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 + + +#endif // BOOST_FORMAT_CLASS_HPP diff --git a/3rdParty/Boost/src/boost/format/format_fwd.hpp b/3rdParty/Boost/src/boost/format/format_fwd.hpp new file mode 100644 index 0000000..be3228a --- /dev/null +++ b/3rdParty/Boost/src/boost/format/format_fwd.hpp @@ -0,0 +1,49 @@ +// ---------------------------------------------------------------------------- +// format_fwd.hpp : forward declarations +// ---------------------------------------------------------------------------- + +// 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_FWD_HPP +#define BOOST_FORMAT_FWD_HPP + +#include <string> +#include <iosfwd> + +#include <boost/format/detail/compat_workarounds.hpp> + +namespace boost { + + template <class 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 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_FORMAT_IGNORE_STRINGSTREAM) + typedef basic_format<wchar_t > wformat; +#endif + + 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 + +} // namespace boost + +#endif // BOOST_FORMAT_FWD_HPP diff --git a/3rdParty/Boost/src/boost/format/format_implementation.hpp b/3rdParty/Boost/src/boost/format/format_implementation.hpp new file mode 100644 index 0000000..2abb5c4 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/format_implementation.hpp @@ -0,0 +1,329 @@ +// ---------------------------------------------------------------------------- +// 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> +#include <algorithm> // std::swap + +namespace boost { + +// --- basic_format implementation -----------------------------------------// + + template< class Ch, class Tr, class Alloc> + basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + exceptions_(io::all_error_bits) + { + if( s) + parse( s ); + } + +#if !defined(BOOST_NO_STD_LOCALE) + template< class Ch, class Tr, class Alloc> + basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s, const std::locale & loc) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + exceptions_(io::all_error_bits), loc_(loc) + { + if(s) parse( s ); + } + + 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) + { + parse(s); + } +#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, 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, 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_(x.dumped_), + prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_) + { + } + + 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_); + std::swap(num_args_, x.num_args_); + std::swap(dumped_, x.dumped_); + + items_.swap(x.items_); + prefix_.swap(x.prefix_); + bound_.swap(x.bound_); + } + + template< class Ch, class Tr, class Alloc> + unsigned char basic_format<Ch,Tr, Alloc>:: exceptions() const { + return exceptions_; + } + + 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, 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); + for(std::size_t i=0; i < nbitems; ++i) + items_[i].reset(fill); // strings are resized, instead of reallocated + } + prefix_.resize(0); + } + + 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 + + BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast<int>(bound_.size()) ); + + for(unsigned long i=0; i<items_.size(); ++i) { + // clear converted strings only if the corresponding argument is not bound : + if( bound_.size()==0 || items_[i].argN_<0 || !bound_[ items_[i].argN_ ] ) + items_[i].res_.resize(0); + } + cur_arg_=0; dumped_=false; + // maybe first arg is bound: + if(bound_.size() != 0) { + for(; cur_arg_ < num_args_ && bound_[cur_arg_]; ++cur_arg_) + {} + } + return *this; + } + + 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, 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(argN, 1, num_args_+1 ) ); + else return *this; + } + bound_[argN-1]=false; + clear(); + return *this; + } + + template< class Ch, class Tr, class Alloc> + int basic_format<Ch,Tr, Alloc>:: + bound_args() const { + if(bound_.size()==0) + return 0; + int n=0; + for(int i=0; i<num_args_ ; ++i) + if(bound_[i]) + ++n; + return n; + } + + template< class Ch, class Tr, class Alloc> + int basic_format<Ch,Tr, Alloc>:: + fed_args() const { + if(bound_.size()==0) + return cur_arg_; + int n=0; + for(int i=0; i<cur_arg_ ; ++i) + if(!bound_[i]) + ++n; + return n; + } + + template< class Ch, class Tr, class Alloc> + int basic_format<Ch,Tr, Alloc>:: + cur_arg() const { + return cur_arg_+1; } + + template< class Ch, class Tr, class Alloc> + int basic_format<Ch,Tr, Alloc>:: + remaining_args() const { + if(bound_.size()==0) + return num_args_-cur_arg_; + int n=0; + for(int i=cur_arg_; i<num_args_ ; ++i) + if(!bound_[i]) + ++n; + return n; + } + + 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 ) + // not enough variables supplied + boost::throw_exception(io::too_few_args(cur_arg_, num_args_)); + + unsigned long i; + string_type res; + res.reserve(size()); + res += prefix_; + for(i=0; i < items_.size(); ++i) { + const format_item_t& item = items_[i]; + res += item.res_; + if( item.argN_ == format_item_t::argN_tabulation) { + BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation); + if( static_cast<size_type>(item.fmtstate_.width_) > res.size() ) + res.append( static_cast<size_type>(item.fmtstate_.width_) - res.size(), + item.fmtstate_.fill_ ); + } + res += item.appendix_; + } + dumped_=true; + return res; + } + template< class Ch, class Tr, class Alloc> + typename std::basic_string<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr, Alloc>:: + size () const { +#ifdef BOOST_MSVC + // If std::min<unsigned> or std::max<unsigned> are already instantiated + // at this point then we get a blizzard of warning messages when we call + // those templates with std::size_t as arguments. Weird and very annoyning... +#pragma warning(push) +#pragma warning(disable:4267) +#endif + BOOST_USING_STD_MAX(); + size_type 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 = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz, + static_cast<size_type>(item.fmtstate_.width_) ); + sz += item.appendix_.size(); + } + return sz; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } + +namespace io { +namespace detail { + + 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(argN, 1, self.num_args_+1 ) ); + else return self; + } + if(self.bound_.size()==0) + self.bound_.assign(self.num_args_,false); + else + BOOST_ASSERT( self.num_args_ == static_cast<signed int>(self.bound_.size()) ); + int o_cur_arg = self.cur_arg_; + self.cur_arg_ = argN-1; // arrays begin at 0 + + self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets.. + self.operator%(val); // put val at the right place, because cur_arg is set + + + // Now re-position cur_arg before leaving : + self.cur_arg_ = o_cur_arg; + self.bound_[argN-1]=true; + if(self.cur_arg_ == argN-1 ) { + // hum, now this arg is bound, so move to next free arg + while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_]) + ++self.cur_arg_; + } + // In any case, we either have all args, or are on an unbound arg : + BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]); + return self; + } + + 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(itemN, 1, static_cast<int>(self.items_.size()) )); + else return self; + } + self.items_[itemN-1].fmtstate_. template apply_manip<T> ( manipulator ); + return self; + } + +} // namespace detail +} // namespace io +} // namespace boost + + + +#endif // BOOST_FORMAT_IMPLEMENTATION_HPP diff --git a/3rdParty/Boost/src/boost/format/free_funcs.hpp b/3rdParty/Boost/src/boost/format/free_funcs.hpp new file mode 100644 index 0000000..3a51545 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/free_funcs.hpp @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------- +// free_funcs.hpp : implementation of the free functions of boost::format +// ---------------------------------------------------------------------------- + +// 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_FUNCS_HPP +#define BOOST_FORMAT_FUNCS_HPP + +#include <boost/format/format_class.hpp> +#include <boost/throw_exception.hpp> + +namespace boost { + + 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 + +#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, 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 ) + // 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 { + // else we dont have to count chars output, so we dump directly to os : + os << f.prefix_; + for(unsigned long i=0; i<f.items_.size(); ++i) { + const typename format_t::format_item_t& item = f.items_[i]; + os << item.res_; + os << item.appendix_; + } + } + } + f.dumped_=true; + return os; + } + +} // namespace boost + + +#endif // BOOST_FORMAT_FUNCS_HPP diff --git a/3rdParty/Boost/src/boost/format/group.hpp b/3rdParty/Boost/src/boost/format/group.hpp new file mode 100644 index 0000000..c586b2a --- /dev/null +++ b/3rdParty/Boost/src/boost/format/group.hpp @@ -0,0 +1,684 @@ + +// ---------------------------------------------------------------------------- +// group.hpp : encapsulates a group of manipulators along with an argument +// ---------------------------------------------------------------------------- + +// 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 + +// ---------------------------------------------------------------------------- + + +// 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) +// ---------------------------------------------------------------------------- + + +#ifndef BOOST_FORMAT_GROUP_HPP +#define BOOST_FORMAT_GROUP_HPP + +#include <boost/config.hpp> + + +namespace boost { +namespace io { + + +namespace detail { + + +// empty group, but useful even though. +struct group0 +{ + group0() {} +}; + +template <class Ch, class Tr> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << ( BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group0& ) +{ + return os; +} + +template <class T1> +struct group1 +{ + T1 a1_; + group1(T1 a1) + : a1_(a1) + {} +private: + group1& operator=(const group1&); +}; + +template <class Ch, class Tr, class T1> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group1<T1>& x) +{ + os << x.a1_; + return os; +} + + + + +template <class T1,class T2> +struct group2 +{ + T1 a1_; + T2 a2_; + group2(T1 a1,T2 a2) + : a1_(a1),a2_(a2) + {} +private: + group2& operator=(const group2&); +}; + +template <class Ch, class Tr, class T1,class T2> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group2<T1,T2>& x) +{ + os << x.a1_<< x.a2_; + return os; +} + +template <class T1,class T2,class T3> +struct group3 +{ + T1 a1_; + T2 a2_; + T3 a3_; + group3(T1 a1,T2 a2,T3 a3) + : a1_(a1),a2_(a2),a3_(a3) + {} +private: + group3& operator=(const group3&); +}; + +template <class Ch, class Tr, class T1,class T2,class T3> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group3<T1,T2,T3>& x) +{ + os << x.a1_<< x.a2_<< x.a3_; + return os; +} + +template <class T1,class T2,class T3,class T4> +struct group4 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + group4(T1 a1,T2 a2,T3 a3,T4 a4) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4) + {} +private: + group4& operator=(const group4&); +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group4<T1,T2,T3,T4>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_; + return os; +} + +template <class T1,class T2,class T3,class T4,class T5> +struct group5 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + group5(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5) + {} +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group5<T1,T2,T3,T4,T5>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_; + return os; +} + +template <class T1,class T2,class T3,class T4,class T5,class T6> +struct group6 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + group6(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6) + {} +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group6<T1,T2,T3,T4,T5,T6>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_; + return os; +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7> +struct group7 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + group7(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7) + {} +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group7<T1,T2,T3,T4,T5,T6,T7>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_; + return os; +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> +struct group8 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + T8 a8_; + group8(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8) + {} +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group8<T1,T2,T3,T4,T5,T6,T7,T8>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_; + return os; +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> +struct group9 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + T8 a8_; + T9 a9_; + group9(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9) + {} +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group9<T1,T2,T3,T4,T5,T6,T7,T8,T9>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_; + return os; +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> +struct group10 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + T8 a8_; + T9 a9_; + T10 a10_; + group10(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9,T10 a10) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9),a10_(a10) + {} +}; + +template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> +inline +BOOST_IO_STD basic_ostream<Ch, Tr>& +operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, + const group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_<< x.a10_; + return os; +} + + + + +template <class T1,class T2> +inline +group1<T1> +group_head( group2<T1,T2> const& x) +{ + return group1<T1> (x.a1_); +} + +template <class T1,class T2> +inline +group1<T2> +group_last( group2<T1,T2> const& x) +{ + return group1<T2> (x.a2_); +} + + + +template <class T1,class T2,class T3> +inline +group2<T1,T2> +group_head( group3<T1,T2,T3> const& x) +{ + return group2<T1,T2> (x.a1_,x.a2_); +} + +template <class T1,class T2,class T3> +inline +group1<T3> +group_last( group3<T1,T2,T3> const& x) +{ + return group1<T3> (x.a3_); +} + + + +template <class T1,class T2,class T3,class T4> +inline +group3<T1,T2,T3> +group_head( group4<T1,T2,T3,T4> const& x) +{ + return group3<T1,T2,T3> (x.a1_,x.a2_,x.a3_); +} + +template <class T1,class T2,class T3,class T4> +inline +group1<T4> +group_last( group4<T1,T2,T3,T4> const& x) +{ + return group1<T4> (x.a4_); +} + + + +template <class T1,class T2,class T3,class T4,class T5> +inline +group4<T1,T2,T3,T4> +group_head( group5<T1,T2,T3,T4,T5> const& x) +{ + return group4<T1,T2,T3,T4> (x.a1_,x.a2_,x.a3_,x.a4_); +} + +template <class T1,class T2,class T3,class T4,class T5> +inline +group1<T5> +group_last( group5<T1,T2,T3,T4,T5> const& x) +{ + return group1<T5> (x.a5_); +} + + + +template <class T1,class T2,class T3,class T4,class T5,class T6> +inline +group5<T1,T2,T3,T4,T5> +group_head( group6<T1,T2,T3,T4,T5,T6> const& x) +{ + return group5<T1,T2,T3,T4,T5> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6> +inline +group1<T6> +group_last( group6<T1,T2,T3,T4,T5,T6> const& x) +{ + return group1<T6> (x.a6_); +} + + + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7> +inline +group6<T1,T2,T3,T4,T5,T6> +group_head( group7<T1,T2,T3,T4,T5,T6,T7> const& x) +{ + return group6<T1,T2,T3,T4,T5,T6> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7> +inline +group1<T7> +group_last( group7<T1,T2,T3,T4,T5,T6,T7> const& x) +{ + return group1<T7> (x.a7_); +} + + + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> +inline +group7<T1,T2,T3,T4,T5,T6,T7> +group_head( group8<T1,T2,T3,T4,T5,T6,T7,T8> const& x) +{ + return group7<T1,T2,T3,T4,T5,T6,T7> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> +inline +group1<T8> +group_last( group8<T1,T2,T3,T4,T5,T6,T7,T8> const& x) +{ + return group1<T8> (x.a8_); +} + + + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> +inline +group8<T1,T2,T3,T4,T5,T6,T7,T8> +group_head( group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> const& x) +{ + return group8<T1,T2,T3,T4,T5,T6,T7,T8> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_,x.a8_); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9> +inline +group1<T9> +group_last( group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> const& x) +{ + return group1<T9> (x.a9_); +} + + + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> +inline +group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> +group_head( group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> const& x) +{ + return group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_,x.a8_,x.a9_); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10> +inline +group1<T10> +group_last( group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> const& x) +{ + return group1<T10> (x.a10_); +} + + + + + +} // namespace detail + + + +// helper functions + + +inline detail::group1< detail::group0 > +group() { return detail::group1< detail::group0 > ( detail::group0() ); } + +template <class T1, class Var> +inline +detail::group1< detail::group2<T1, Var const&> > + group(T1 a1, Var const& var) +{ + return detail::group1< detail::group2<T1, Var const&> > + ( detail::group2<T1, Var const&> + (a1, var) + ); +} + +template <class T1,class T2, class Var> +inline +detail::group1< detail::group3<T1,T2, Var const&> > + group(T1 a1,T2 a2, Var const& var) +{ + return detail::group1< detail::group3<T1,T2, Var const&> > + ( detail::group3<T1,T2, Var const&> + (a1,a2, var) + ); +} + +template <class T1,class T2,class T3, class Var> +inline +detail::group1< detail::group4<T1,T2,T3, Var const&> > + group(T1 a1,T2 a2,T3 a3, Var const& var) +{ + return detail::group1< detail::group4<T1,T2,T3, Var const&> > + ( detail::group4<T1,T2,T3, Var const&> + (a1,a2,a3, var) + ); +} + +template <class T1,class T2,class T3,class T4, class Var> +inline +detail::group1< detail::group5<T1,T2,T3,T4, Var const&> > + group(T1 a1,T2 a2,T3 a3,T4 a4, Var const& var) +{ + return detail::group1< detail::group5<T1,T2,T3,T4, Var const&> > + ( detail::group5<T1,T2,T3,T4, Var const&> + (a1,a2,a3,a4, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5, class Var> +inline +detail::group1< detail::group6<T1,T2,T3,T4,T5, Var const&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var const& var) +{ + return detail::group1< detail::group6<T1,T2,T3,T4,T5, Var const&> > + ( detail::group6<T1,T2,T3,T4,T5, Var const&> + (a1,a2,a3,a4,a5, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6, class Var> +inline +detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var const&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var const& var) +{ + return detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var const&> > + ( detail::group7<T1,T2,T3,T4,T5,T6, Var const&> + (a1,a2,a3,a4,a5,a6, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7, class Var> +inline +detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var const& var) +{ + return detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> > + ( detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> + (a1,a2,a3,a4,a5,a6,a7, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8, class Var> +inline +detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var const& var) +{ + return detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> > + ( detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> + (a1,a2,a3,a4,a5,a6,a7,a8, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9, class Var> +inline +detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var const& var) +{ + return detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> > + ( detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> + (a1,a2,a3,a4,a5,a6,a7,a8,a9, var) + ); +} + + +#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST + +template <class T1, class Var> +inline +detail::group1< detail::group2<T1, Var&> > + group(T1 a1, Var& var) +{ + return detail::group1< detail::group2<T1, Var&> > + ( detail::group2<T1, Var&> + (a1, var) + ); +} + +template <class T1,class T2, class Var> +inline +detail::group1< detail::group3<T1,T2, Var&> > + group(T1 a1,T2 a2, Var& var) +{ + return detail::group1< detail::group3<T1,T2, Var&> > + ( detail::group3<T1,T2, Var&> + (a1,a2, var) + ); +} + +template <class T1,class T2,class T3, class Var> +inline +detail::group1< detail::group4<T1,T2,T3, Var&> > + group(T1 a1,T2 a2,T3 a3, Var& var) +{ + return detail::group1< detail::group4<T1,T2,T3, Var&> > + ( detail::group4<T1,T2,T3, Var&> + (a1,a2,a3, var) + ); +} + +template <class T1,class T2,class T3,class T4, class Var> +inline +detail::group1< detail::group5<T1,T2,T3,T4, Var&> > + group(T1 a1,T2 a2,T3 a3,T4 a4, Var& var) +{ + return detail::group1< detail::group5<T1,T2,T3,T4, Var&> > + ( detail::group5<T1,T2,T3,T4, Var&> + (a1,a2,a3,a4, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5, class Var> +inline +detail::group1< detail::group6<T1,T2,T3,T4,T5, Var&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var& var) +{ + return detail::group1< detail::group6<T1,T2,T3,T4,T5, Var&> > + ( detail::group6<T1,T2,T3,T4,T5, Var&> + (a1,a2,a3,a4,a5, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6, class Var> +inline +detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var& var) +{ + return detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var&> > + ( detail::group7<T1,T2,T3,T4,T5,T6, Var&> + (a1,a2,a3,a4,a5,a6, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7, class Var> +inline +detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var& var) +{ + return detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> > + ( detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> + (a1,a2,a3,a4,a5,a6,a7, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8, class Var> +inline +detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var& var) +{ + return detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> > + ( detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> + (a1,a2,a3,a4,a5,a6,a7,a8, var) + ); +} + +template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9, class Var> +inline +detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var& var) +{ + return detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> > + ( detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> + (a1,a2,a3,a4,a5,a6,a7,a8,a9, var) + ); +} + + +#endif // - BOOST_NO_OVERLOAD_FOR_NON_CONST + + +} // namespace io + +} // namespace boost + + +#endif // BOOST_FORMAT_GROUP_HPP diff --git a/3rdParty/Boost/src/boost/format/internals.hpp b/3rdParty/Boost/src/boost/format/internals.hpp new file mode 100644 index 0000000..b0d874a --- /dev/null +++ b/3rdParty/Boost/src/boost/format/internals.hpp @@ -0,0 +1,201 @@ +// ---------------------------------------------------------------------------- +// 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/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 --------------------------------------------------// + +// set of params that define the format state of a stream + template<class Ch, class Tr> + struct stream_format_state + { + 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); } + + 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, //- 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) ; } + + // --- data --- + std::streamsize width_; + std::streamsize precision_; + Ch fill_; + 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 ---------------------------------------------------------// + +// stores all parameters that can be specified in format strings + template<class Ch, class Tr, class Alloc> + struct format_item + { + enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 }; + // 1. if zeropad is set, all other bits are not, + // 2. if tabulation is set, all others are not. + // centered and spacepad can be mixed freely. + enum arg_values { argN_no_posit = -1, // non-positional directive. will set argN later + 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, Alloc> string_type; + + format_item(Ch fill) :argN_(argN_no_posit), fmtstate_(fill), + truncate_(max_streamsize()), pad_scheme_(0) {} + void reset(Ch fill); + void compute_states(); // sets states according to truncate and pad_scheme. + + static std::streamsize max_streamsize() { + 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_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 + unsigned int pad_scheme_;//- several possible padding schemes can mix. see pad_values + }; + + + +//--- Definitions ------------------------------------------------------------ + +// - stream_format_state:: ------------------------------------------------- + template<class Ch, class Tr> + 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_); + if(precision_ != -1) + os.precision(precision_); + if(fill_ != 0) + os.fill(fill_); + 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); +#else + (void) loc_default; // keep compiler quiet if we don't support locales +#endif + } + + template<class Ch, class Tr> + void stream_format_state<Ch,Tr>:: set_by_stream(const basic_ios& os) { + // set our params according to the state of this stream + flags_ = os.flags(); + width_ = os.width(); + precision_ = os.precision(); + fill_ = os.fill(); + rdstate_ = os.rdstate(); + exceptions_ = os.exceptions(); + } + + + template<class Ch, class Tr, class T> + void apply_manip_body( stream_format_state<Ch, Tr>& self, + T manipulator) { + // modify our params according to the manipulator + basic_oaltstringstream<Ch, Tr> ss; + self.apply_on( ss ); + ss << manipulator; + self.set_by_stream( ss ); + } + + template<class Ch, class Tr> inline + void stream_format_state<Ch,Tr>:: reset(Ch fill) { + // set our params to standard's default state. cf 27.4.4.1 of the C++ norm + width_=0; precision_=6; + fill_=fill; // default is widen(' '), but we cant compute it without the locale + flags_ = std::ios_base::dec | std::ios_base::skipws; + // the adjust_field part is left equal to 0, which means right. + exceptions_ = std::ios_base::goodbit; + rdstate_ = std::ios_base::goodbit; + } + + +// --- format_item:: -------------------------------------------------------- + + 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, 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) { + // ignore zeropad in left alignment : + if(fmtstate_.flags_ & std::ios_base::left) { + BOOST_ASSERT(!(fmtstate_.flags_ &(std::ios_base::adjustfield ^std::ios_base::left))); + // only left bit might be set. (not right, nor internal) + pad_scheme_ = pad_scheme_ & (~zeropad); + } + else { + pad_scheme_ &= ~spacepad; // printf ignores spacepad when zeropadding + fmtstate_.fill_='0'; + fmtstate_.flags_ = (fmtstate_.flags_ & ~std::ios_base::adjustfield) + | std::ios_base::internal; + // removes all adjustfield bits, and adds internal. + } + } + if(pad_scheme_ & spacepad) { + if(fmtstate_.flags_ & std::ios_base::showpos) + pad_scheme_ &= ~spacepad; + } + } + + +} } } // namespaces boost :: io :: detail + + +#endif // BOOST_FORMAT_INTERNALS_HPP diff --git a/3rdParty/Boost/src/boost/format/internals_fwd.hpp b/3rdParty/Boost/src/boost/format/internals_fwd.hpp new file mode 100644 index 0000000..e44eb3c --- /dev/null +++ b/3rdParty/Boost/src/boost/format/internals_fwd.hpp @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------- +// 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 + +#include <boost/format/format_fwd.hpp> +#include <boost/config.hpp> + + +namespace boost { +namespace io { + +namespace detail { + template<class Ch, class Tr> struct stream_format_state; + template<class Ch, class Tr, class Alloc> struct format_item; + + + // 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 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 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, + T manipulator); + + // 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 Alloc, class T> + basic_format<Ch, Tr, Alloc>& + feed (basic_format<Ch,Tr, Alloc>& self, T x); + +} // namespace detail + +} // namespace io +} // namespace boost + + +#endif // BOOST_FORMAT_INTERNAL_FWD_HPP diff --git a/3rdParty/Boost/src/boost/format/parsing.hpp b/3rdParty/Boost/src/boost/format/parsing.hpp new file mode 100644 index 0000000..b14ca82 --- /dev/null +++ b/3rdParty/Boost/src/boost/format/parsing.hpp @@ -0,0 +1,504 @@ +// ---------------------------------------------------------------------------- +// parsing.hpp : implementation of the parsing member functions +// ( parse, parse_printf_directive) +// ---------------------------------------------------------------------------- + +// 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_PARSING_HPP +#define BOOST_FORMAT_PARSING_HPP + + +#include <boost/format/format_class.hpp> +#include <boost/format/exceptions.hpp> +#include <boost/throw_exception.hpp> +#include <boost/assert.hpp> + + +namespace boost { +namespace io { +namespace detail { + +#if defined(BOOST_NO_STD_LOCALE) + // streams will be used for narrow / widen. but these methods are not const + template<class T> + T& const_or_not(const T& x) { + return const_cast<T&> (x); + } +#else + template<class T> + const T& const_or_not(const T& x) { + return x; + } +#endif + + template<class Ch, class Facet> inline + char wrap_narrow(const Facet& fac, Ch c, char deflt) { + return const_or_not(fac).narrow(c, deflt); + } + + template<class Ch, class Facet> inline + bool wrap_isdigit(const Facet& fac, Ch c) { +#if ! defined( BOOST_NO_LOCALE_ISDIGIT ) + return fac.is(std::ctype<Ch>::digit, c); +# else + (void) fac; // remove "unused parameter" warning + using namespace std; + return isdigit(c); +#endif + } + + template<class Iter, class Facet> + Iter wrap_scan_notdigit(const Facet & fac, Iter beg, Iter end) { + using namespace std; + for( ; beg!=end && wrap_isdigit(fac, *beg); ++beg) ; + return beg; + } + + + // Input : [start, last) iterators range and a + // a Facet to use its widen/narrow member function + // Effects : read sequence and convert digits into integral n, of type Res + // Returns : n + template<class Res, class Iter, class Facet> + Iter str2int (const Iter & start, const Iter & last, Res & res, + const Facet& fac) + { + using namespace std; + Iter it; + res=0; + for(it=start; it != last && wrap_isdigit(fac, *it); ++it ) { + char cur_ch = wrap_narrow(fac, *it, 0); // cant fail. + res *= 10; + res += cur_ch - '0'; // 22.2.1.1.2.13 of the C++ standard + } + return it; + } + + // skip printf's "asterisk-fields" directives in the format-string buf + // Input : char string, with starting index *pos_p + // a Facet merely to use its widen/narrow member function + // Effects : advance *pos_p by skipping printf's asterisk fields. + // Returns : nothing + template<class Iter, class Facet> + Iter skip_asterisk(Iter start, Iter last, const Facet& fac) + { + using namespace std; + ++ start; + start = wrap_scan_notdigit(fac, start, last); + if(start!=last && *start== const_or_not(fac).widen( '$') ) + ++start; + return start; + } + + + // auxiliary func called by parse_printf_directive + // for centralising error handling + // it either throws if user sets the corresponding flag, or does nothing. + inline void maybe_throw_exception(unsigned char exceptions, + std::size_t pos, std::size_t size) + { + if(exceptions & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string(pos, size) ); + } + + + // Input: the position of a printf-directive in the format-string + // a basic_ios& merely to use its widen/narrow member function + // a bitset'exceptions' telling whether to throw exceptions on errors. + // Returns: + // true if parse succeeded (ignore some errors if exceptions disabled) + // false if it failed so bad that the directive should be printed verbatim + // Effects: + // start is incremented so that *start is the first char after + // this directive + // *fpar is set with the parameters read in the directive + template<class Ch, class Tr, class Alloc, class Iter, class Facet> + bool parse_printf_directive(Iter & start, const Iter& last, + detail::format_item<Ch, Tr, Alloc> * fpar, + const Facet& fac, + std::size_t offset, unsigned char exceptions) + { + typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t; + + fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive + bool precision_set = false; + bool in_brackets=false; + Iter start0 = start; + std::size_t fstring_size = last-start0+offset; + + if(start>= last) { // empty directive : this is a trailing % + maybe_throw_exception(exceptions, start-start0 + offset, fstring_size); + return false; + } + + if(*start== const_or_not(fac).widen( '|')) { + in_brackets=true; + if( ++start >= last ) { + maybe_throw_exception(exceptions, start-start0 + offset, fstring_size); + return false; + } + } + + // the flag '0' would be picked as a digit for argument order, but here it's a flag : + if(*start== const_or_not(fac).widen( '0')) + goto parse_flags; + + // handle argument order (%2$d) or possibly width specification: %2d + if(wrap_isdigit(fac, *start)) { + int n; + start = str2int(start, last, n, fac); + if( start >= last ) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return false; + } + + // %N% case : this is already the end of the directive + if( *start == const_or_not(fac).widen( '%') ) { + fpar->argN_ = n-1; + ++start; + if( in_brackets) + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + // but don't return. maybe "%" was used in lieu of '$', so we go on. + else + return true; + } + + if ( *start== const_or_not(fac).widen( '$') ) { + fpar->argN_ = n-1; + ++start; + } + else { + // non-positionnal directive + fpar->fmtstate_.width_ = n; + fpar->argN_ = format_item_t::argN_no_posit; + goto parse_precision; + } + } + + parse_flags: + // handle flags + while ( start != last) { // as long as char is one of + - = _ # 0 l h or ' ' + // misc switches + switch ( wrap_narrow(fac, *start, 0)) { + case '\'' : break; // no effect yet. (painful to implement) + case 'l': + case 'h': // short/long modifier : for printf-comaptibility (no action needed) + break; + case '-': + fpar->fmtstate_.flags_ |= std::ios_base::left; + break; + case '=': + fpar->pad_scheme_ |= format_item_t::centered; + break; + case '_': + fpar->fmtstate_.flags_ |= std::ios_base::internal; + break; + case ' ': + fpar->pad_scheme_ |= format_item_t::spacepad; + break; + case '+': + fpar->fmtstate_.flags_ |= std::ios_base::showpos; + break; + case '0': + fpar->pad_scheme_ |= format_item_t::zeropad; + // need to know alignment before really setting flags, + // so just add 'zeropad' flag for now, it will be processed later. + break; + case '#': + fpar->fmtstate_.flags_ |= std::ios_base::showpoint | std::ios_base::showbase; + break; + default: + goto parse_width; + } + ++start; + } // loop on flag. + + if( start>=last) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return true; + } + parse_width: + // handle width spec + // first skip 'asterisk fields' : *, or *N$ + if(*start == const_or_not(fac).widen( '*') ) + start = skip_asterisk(start, last, fac); + if(start!=last && wrap_isdigit(fac, *start)) + start = str2int(start, last, fpar->fmtstate_.width_, fac); + + parse_precision: + if( start>= last) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return true; + } + // handle precision spec + if (*start== const_or_not(fac).widen( '.')) { + ++start; + if(start != last && *start == const_or_not(fac).widen( '*') ) + start = skip_asterisk(start, last, fac); + if(start != last && wrap_isdigit(fac, *start)) { + start = str2int(start, last, fpar->fmtstate_.precision_, fac); + precision_set = true; + } + else + fpar->fmtstate_.precision_ =0; + } + + // handle formatting-type flags : + while( start != last && ( *start== const_or_not(fac).widen( 'l') + || *start== const_or_not(fac).widen( 'L') + || *start== const_or_not(fac).widen( 'h')) ) + ++start; + if( start>=last) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return true; + } + + if( in_brackets && *start== const_or_not(fac).widen( '|') ) { + ++start; + return true; + } + switch ( wrap_narrow(fac, *start, 0) ) { + case 'X': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + case 'p': // pointer => set hex. + case 'x': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::hex; + break; + + case 'o': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::oct; + break; + + case 'E': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + case 'e': + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + fpar->fmtstate_.flags_ |= std::ios_base::scientific; + + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; + break; + + case 'f': + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + fpar->fmtstate_.flags_ |= std::ios_base::fixed; + case 'u': + case 'd': + case 'i': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; + break; + + case 'T': + ++start; + if( start >= last) + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + else + fpar->fmtstate_.fill_ = *start; + fpar->pad_scheme_ |= format_item_t::tabulation; + fpar->argN_ = format_item_t::argN_tabulation; + break; + case 't': + fpar->fmtstate_.fill_ = const_or_not(fac).widen( ' '); + fpar->pad_scheme_ |= format_item_t::tabulation; + fpar->argN_ = format_item_t::argN_tabulation; + break; + + case 'G': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + break; + case 'g': // 'g' conversion is default for floats. + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; + + // CLEAR all floatield flags, so stream will CHOOSE + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + break; + + case 'C': + case 'c': + fpar->truncate_ = 1; + break; + case 'S': + case 's': + if(precision_set) // handle truncation manually, with own parameter. + fpar->truncate_ = fpar->fmtstate_.precision_; + fpar->fmtstate_.precision_ = 6; // default stream precision. + break; + case 'n' : + fpar->argN_ = format_item_t::argN_ignored; + break; + default: + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + } + ++start; + + if( in_brackets ) { + if( start != last && *start== const_or_not(fac).widen( '|') ) { + ++start; + return true; + } + else maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + } + return true; + } + // -end parse_printf_directive() + + template<class String, class Facet> + int upper_bound_from_fstring(const String& buf, + const typename String::value_type arg_mark, + const Facet& fac, + unsigned char exceptions) + { + // quick-parsing of the format-string to count arguments mark (arg_mark, '%') + // returns : upper bound on the number of format items in the format strings + using namespace boost::io; + typename String::size_type i1=0; + int num_items=0; + while( (i1=buf.find(arg_mark,i1)) != String::npos ) { + if( i1+1 >= buf.size() ) { + if(exceptions & bad_format_string_bit) + boost::throw_exception(bad_format_string(i1, buf.size() )); // must not end in ".. %" + else { + ++num_items; + break; + } + } + if(buf[i1+1] == buf[i1] ) {// escaped "%%" + i1+=2; continue; + } + + ++i1; + // in case of %N% directives, dont count it double (wastes allocations..) : + i1 = detail::wrap_scan_notdigit(fac, buf.begin()+i1, buf.end()) - buf.begin(); + if( i1 < buf.size() && buf[i1] == arg_mark ) + ++i1; + ++num_items; + } + return num_items; + } + template<class String> inline + void append_string(String& dst, const String& src, + const typename String::size_type beg, + const typename String::size_type end) { +#if !defined(BOOST_NO_STRING_APPEND) + dst.append(src.begin()+beg, src.begin()+end); +#else + dst += src.substr(beg, end-beg); +#endif + } + +} // detail namespace +} // io namespace + + + +// ----------------------------------------------- +// format :: parse(..) + + template<class Ch, class Tr, class Alloc> + basic_format<Ch, Tr, Alloc>& basic_format<Ch, Tr, Alloc>:: + parse (const string_type& buf) { + // parse the format-string + using namespace std; +#if !defined(BOOST_NO_STD_LOCALE) + const std::ctype<Ch> & fac = BOOST_USE_FACET( std::ctype<Ch>, getloc()); +#else + io::basic_oaltstringstream<Ch, Tr, Alloc> fac; + //has widen and narrow even on compilers without locale +#endif + + const Ch arg_mark = io::detail::const_or_not(fac).widen( '%'); + bool ordered_args=true; + int max_argN=-1; + + // A: find upper_bound on num_items and allocates arrays + int num_items = io::detail::upper_bound_from_fstring(buf, arg_mark, fac, exceptions()); + make_or_reuse_data(num_items); + + // B: Now the real parsing of the format string : + num_items=0; + typename string_type::size_type i0=0, i1=0; + typename string_type::const_iterator it; + bool special_things=false; + int cur_item=0; + while( (i1=buf.find(arg_mark,i1)) != string_type::npos ) { + string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_; + if( buf[i1+1] == buf[i1] ) { // escaped mark, '%%' + io::detail::append_string(piece, buf, i0, i1+1); + i1+=2; i0=i1; + continue; + } + BOOST_ASSERT( static_cast<unsigned int>(cur_item) < items_.size() || cur_item==0); + + if(i1!=i0) { + io::detail::append_string(piece, buf, i0, i1); + i0=i1; + } + ++i1; + it = buf.begin()+i1; + bool parse_ok = io::detail::parse_printf_directive( + it, buf.end(), &items_[cur_item], fac, i1, exceptions()); + i1 = it - buf.begin(); + if( ! parse_ok ) // the directive will be printed verbatim + continue; + i0=i1; + items_[cur_item].compute_states(); // process complex options, like zeropad, into params + + int argN=items_[cur_item].argN_; + if(argN == format_item_t::argN_ignored) + continue; + if(argN ==format_item_t::argN_no_posit) + ordered_args=false; + else if(argN == format_item_t::argN_tabulation) special_things=true; + else if(argN > max_argN) max_argN = argN; + ++num_items; + ++cur_item; + } // loop on %'s + BOOST_ASSERT(cur_item == num_items); + + // store the final piece of string + { + string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_; + io::detail::append_string(piece, buf, i0, buf.size()); + } + + if( !ordered_args) { + if(max_argN >= 0 ) { // dont mix positional with non-positionnal directives + if(exceptions() & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string(max_argN, 0)); + // else do nothing. => positionnal arguments are processed as non-positionnal + } + // set things like it would have been with positional directives : + int non_ordered_items = 0; + for(int i=0; i< num_items; ++i) + if(items_[i].argN_ == format_item_t::argN_no_posit) { + items_[i].argN_ = non_ordered_items; + ++non_ordered_items; + } + max_argN = non_ordered_items-1; + } + + // C: set some member data : + items_.resize(num_items, format_item_t(io::detail::const_or_not(fac).widen( ' ')) ); + + if(special_things) style_ |= special_needs; + num_args_ = max_argN + 1; + if(ordered_args) style_ |= ordered; + else style_ &= ~ordered; + return *this; + } + +} // namespace boost + + +#endif // BOOST_FORMAT_PARSING_HPP diff --git a/3rdParty/Boost/update.sh b/3rdParty/Boost/update.sh index 4be35df..9af5258 100755 --- a/3rdParty/Boost/update.sh +++ b/3rdParty/Boost/update.sh @@ -32,6 +32,7 @@ fi regex.hpp \ boost/unordered_map.hpp \ boost/algorithm/string.hpp \ + boost/format.hpp \ $TARGET_DIR rm -rf $TARGET_DIR/libs/config |