summaryrefslogtreecommitdiff
path: root/nix/boost
diff options
context:
space:
mode:
Diffstat (limited to 'nix/boost')
-rw-r--r--nix/boost/assert.hpp38
-rw-r--r--nix/boost/format.hpp64
-rw-r--r--nix/boost/format/exceptions.hpp96
-rw-r--r--nix/boost/format/feed_args.hpp247
-rw-r--r--nix/boost/format/format_class.hpp135
-rw-r--r--nix/boost/format/format_fwd.hpp49
-rw-r--r--nix/boost/format/format_implementation.cc256
-rw-r--r--nix/boost/format/free_funcs.cc71
-rw-r--r--nix/boost/format/group.hpp680
-rw-r--r--nix/boost/format/internals.hpp167
-rw-r--r--nix/boost/format/internals_fwd.hpp65
-rw-r--r--nix/boost/format/macros_default.hpp48
-rw-r--r--nix/boost/format/parsing.cc454
-rw-r--r--nix/boost/throw_exception.hpp47
14 files changed, 0 insertions, 2417 deletions
diff --git a/nix/boost/assert.hpp b/nix/boost/assert.hpp
deleted file mode 100644
index 754ebb954bc..00000000000
--- a/nix/boost/assert.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
1//
2// boost/assert.hpp - BOOST_ASSERT(expr)
3//
4// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
5//
6// Permission to copy, use, modify, sell and distribute this software
7// is granted provided this copyright notice appears in all copies.
8// This software is provided "as is" without express or implied
9// warranty, and with no claim as to its suitability for any purpose.
10//
11// Note: There are no include guards. This is intentional.
12//
13// See http://www.boost.org/libs/utility/assert.html for documentation.
14//
15
16#undef BOOST_ASSERT
17
18#if defined(BOOST_DISABLE_ASSERTS)
19
20# define BOOST_ASSERT(expr) ((void)0)
21
22#elif defined(BOOST_ENABLE_ASSERT_HANDLER)
23
24#include <boost/current_function.hpp>
25
26namespace boost
27{
28
29void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
30
31} // namespace boost
32
33#define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
34
35#else
36# include <assert.h>
37# define BOOST_ASSERT(expr) assert(expr)
38#endif
diff --git a/nix/boost/format.hpp b/nix/boost/format.hpp
deleted file mode 100644
index f965f0f33e9..00000000000
--- a/nix/boost/format.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream
14
15// ----------------------------------------------------------------------------
16// format.hpp : primary header
17// ----------------------------------------------------------------------------
18
19#ifndef BOOST_FORMAT_HPP
20#define BOOST_FORMAT_HPP
21
22#include <vector>
23#include <string>
24#include <sstream>
25#include <cassert>
26
27#if HAVE_LOCALE
28#include <locale>
29#else
30#define BOOST_NO_STD_LOCALE
31#define BOOST_NO_LOCALE_ISIDIGIT
32#include <cctype>
33#endif
34
35#include <boost/format/macros_default.hpp>
36
37
38// **** Forward declarations ----------------------------------
39#include <boost/format/format_fwd.hpp> // basic_format<Ch,Tr>, and other frontends
40#include <boost/format/internals_fwd.hpp> // misc forward declarations for internal use
41
42
43// **** Auxiliary structs (stream_format_state<Ch,Tr> , and format_item<Ch,Tr> )
44#include <boost/format/internals.hpp>
45
46// **** Format class interface --------------------------------
47#include <boost/format/format_class.hpp>
48
49// **** Exceptions -----------------------------------------------
50#include <boost/format/exceptions.hpp>
51
52// **** Implementation -------------------------------------------
53//#include <boost/format/format_implementation.hpp> // member functions
54
55#include <boost/format/group.hpp> // class for grouping arguments
56
57#include <boost/format/feed_args.hpp> // argument-feeding functions
58//#include <boost/format/parsing.hpp> // format-string parsing (member-)functions
59
60// **** Implementation of the free functions ----------------------
61//#include <boost/format/free_funcs.hpp>
62
63
64#endif // BOOST_FORMAT_HPP
diff --git a/nix/boost/format/exceptions.hpp b/nix/boost/format/exceptions.hpp
deleted file mode 100644
index 80da6d57189..00000000000
--- a/nix/boost/format/exceptions.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// exceptions.hpp
17// ------------------------------------------------------------------------------
18
19
20#ifndef BOOST_FORMAT_EXCEPTIONS_HPP
21#define BOOST_FORMAT_EXCEPTIONS_HPP
22
23
24#include <stdexcept>
25
26
27namespace boost {
28
29namespace io {
30
31// **** exceptions -----------------------------------------------
32
33class format_error : public std::exception
34{
35public:
36 format_error() {}
37 virtual const char *what() const throw()
38 {
39 return "boost::format_error: "
40 "format generic failure";
41 }
42};
43
44class bad_format_string : public format_error
45{
46public:
47 bad_format_string() {}
48 virtual const char *what() const throw()
49 {
50 return "boost::bad_format_string: "
51 "format-string is ill-formed";
52 }
53};
54
55class too_few_args : public format_error
56{
57public:
58 too_few_args() {}
59 virtual const char *what() const throw()
60 {
61 return "boost::too_few_args: "
62 "format-string referred to more arguments than were passed";
63 }
64};
65
66class too_many_args : public format_error
67{
68public:
69 too_many_args() {}
70 virtual const char *what() const throw()
71 {
72 return "boost::too_many_args: "
73 "format-string referred to less arguments than were passed";
74 }
75};
76
77
78class out_of_range : public format_error
79{
80public:
81 out_of_range() {}
82 virtual const char *what() const throw()
83 {
84 return "boost::out_of_range: "
85 "tried to refer to an argument (or item) number which is out of range, "
86 "according to the format string.";
87 }
88};
89
90
91} // namespace io
92
93} // namespace boost
94
95
96#endif // BOOST_FORMAT_EXCEPTIONS_HPP
diff --git a/nix/boost/format/feed_args.hpp b/nix/boost/format/feed_args.hpp
deleted file mode 100644
index 3d0b47b4a12..00000000000
--- a/nix/boost/format/feed_args.hpp
+++ /dev/null
@@ -1,247 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream
14
15// ----------------------------------------------------------------------------
16// feed_args.hpp : functions for processing each argument
17// (feed, feed_manip, and distribute)
18// ----------------------------------------------------------------------------
19
20
21#ifndef BOOST_FORMAT_FEED_ARGS_HPP
22#define BOOST_FORMAT_FEED_ARGS_HPP
23
24#include "boost/format/format_class.hpp"
25#include "boost/format/group.hpp"
26
27#include "boost/throw_exception.hpp"
28
29namespace boost {
30namespace io {
31namespace detail {
32namespace {
33
34 inline
35 void empty_buf(BOOST_IO_STD ostringstream & os) {
36 static const std::string emptyStr;
37 os.str(emptyStr);
38 }
39
40 void do_pad( std::string & s,
41 std::streamsize w,
42 const char c,
43 std::ios::fmtflags f,
44 bool center)
45 // applies centered / left / right padding to the string s.
46 // Effects : string s is padded.
47 {
48 std::streamsize n=w-s.size();
49 if(n<=0) {
50 return;
51 }
52 if(center)
53 {
54 s.reserve(w); // allocate once for the 2 inserts
55 const std::streamsize n1 = n /2, n0 = n - n1;
56 s.insert(s.begin(), n0, c);
57 s.append(n1, c);
58 }
59 else
60 {
61 if(f & std::ios::left) {
62 s.append(n, c);
63 }
64 else {
65 s.insert(s.begin(), n, c);
66 }
67 }
68 } // -do_pad(..)
69
70
71 template<class T> inline
72 void put_head(BOOST_IO_STD ostream& , const T& ) {
73 }
74
75 template<class T> inline
76 void put_head( BOOST_IO_STD ostream& os, const group1<T>& x ) {
77 os << group_head(x.a1_); // send the first N-1 items, not the last
78 }
79
80 template<class T> inline
81 void put_last( BOOST_IO_STD ostream& os, const T& x ) {
82 os << x ;
83 }
84
85 template<class T> inline
86 void put_last( BOOST_IO_STD ostream& os, const group1<T>& x ) {
87 os << group_last(x.a1_); // this selects the last element
88 }
89
90#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
91 template<class T> inline
92 void put_head( BOOST_IO_STD ostream& , T& ) {
93 }
94
95 template<class T> inline
96 void put_last( BOOST_IO_STD ostream& os, T& x ) {
97 os << x ;
98 }
99#endif
100
101
102
103
104template<class T>
105void put( T x,
106 const format_item& specs,
107 std::string & res,
108 BOOST_IO_STD ostringstream& oss_ )
109{
110 // does the actual conversion of x, with given params, into a string
111 // using the *supplied* strinstream. (the stream state is important)
112
113 typedef std::string string_t;
114 typedef format_item format_item_t;
115
116 stream_format_state prev_state(oss_);
117
118 specs.state_.apply_on(oss_);
119
120 // in case x is a group, apply the manip part of it,
121 // in order to find width
122 put_head( oss_, x );
123 empty_buf( oss_);
124
125 const std::streamsize w=oss_.width();
126 const std::ios::fmtflags fl=oss_.flags();
127 const bool internal = (fl & std::ios::internal) != 0;
128 const bool two_stepped_padding = internal
129 && ! ( specs.pad_scheme_ & format_item_t::spacepad )
130 && specs.truncate_ < 0 ;
131
132
133 if(! two_stepped_padding)
134 {
135 if(w>0) // handle simple padding via do_pad, not natively in stream
136 oss_.width(0);
137 put_last( oss_, x);
138 res = oss_.str();
139
140 if (specs.truncate_ >= 0)
141 res.erase(specs.truncate_);
142
143 // complex pads :
144 if(specs.pad_scheme_ & format_item_t::spacepad)
145 {
146 if( res.size()==0 || ( res[0]!='+' && res[0]!='-' ))
147 {
148 res.insert(res.begin(), 1, ' '); // insert 1 space at pos 0
149 }
150 }
151 if(w > 0) // need do_pad
152 {
153 do_pad(res,w,oss_.fill(), fl, (specs.pad_scheme_ & format_item_t::centered) !=0 );
154 }
155 }
156 else // 2-stepped padding
157 {
158 put_last( oss_, x); // oss_.width() may result in padding.
159 res = oss_.str();
160
161 if (specs.truncate_ >= 0)
162 res.erase(specs.truncate_);
163
164 if( res.size() - w > 0)
165 { // length w exceeded
166 // either it was multi-output with first output padding up all width..
167 // either it was one big arg and we are fine.
168 empty_buf( oss_);
169 oss_.width(0);
170 put_last(oss_, x );
171 string_t tmp = oss_.str(); // minimal-length output
172 std::streamsize d;
173 if( (d=w - tmp.size()) <=0 )
174 {
175 // minimal length is already >= w, so no padding (cool!)
176 res.swap(tmp);
177 }
178 else
179 { // hum.. we need to pad (it was necessarily multi-output)
180 typedef typename string_t::size_type size_type;
181 size_type i = 0;
182 while( i<tmp.size() && tmp[i] == res[i] ) // find where we should pad.
183 ++i;
184 tmp.insert(i, static_cast<size_type>( d ), oss_.fill());
185 res.swap( tmp );
186 }
187 }
188 else
189 { // okay, only one thing was printed and padded, so res is fine.
190 }
191 }
192
193 prev_state.apply_on(oss_);
194 empty_buf( oss_);
195 oss_.clear();
196} // end- put(..)
197
198
199} // local namespace
200
201
202
203
204
205template<class T>
206void distribute(basic_format& self, T x)
207 // call put(x, ..) on every occurence of the current argument :
208{
209 if(self.cur_arg_ >= self.num_args_)
210 {
211 if( self.exceptions() & too_many_args_bit )
212 boost::throw_exception(too_many_args()); // too many variables have been supplied !
213 else return;
214 }
215 for(unsigned long i=0; i < self.items_.size(); ++i)
216 {
217 if(self.items_[i].argN_ == self.cur_arg_)
218 {
219 put<T> (x, self.items_[i], self.items_[i].res_, self.oss_ );
220 }
221 }
222}
223
224template<class T>
225basic_format& feed(basic_format& self, T x)
226{
227 if(self.dumped_) self.clear();
228 distribute<T> (self, x);
229 ++self.cur_arg_;
230 if(self.bound_.size() != 0)
231 {
232 while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] )
233 ++self.cur_arg_;
234 }
235
236 // this arg is finished, reset the stream's format state
237 self.state0_.apply_on(self.oss_);
238 return self;
239}
240
241
242} // namespace detail
243} // namespace io
244} // namespace boost
245
246
247#endif // BOOST_FORMAT_FEED_ARGS_HPP
diff --git a/nix/boost/format/format_class.hpp b/nix/boost/format/format_class.hpp
deleted file mode 100644
index 6875623acb4..00000000000
--- a/nix/boost/format/format_class.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// format_class.hpp : class interface
17// ------------------------------------------------------------------------------
18
19
20#ifndef BOOST_FORMAT_CLASS_HPP
21#define BOOST_FORMAT_CLASS_HPP
22
23#include <vector>
24#include <string>
25
26#include <boost/format/format_fwd.hpp>
27#include <boost/format/internals_fwd.hpp>
28
29#include <boost/format/internals.hpp>
30
31namespace boost {
32
33class basic_format
34{
35public:
36 typedef std::string string_t;
37 typedef BOOST_IO_STD ostringstream internal_stream_t;
38private:
39 typedef BOOST_IO_STD ostream stream_t;
40 typedef io::detail::stream_format_state stream_format_state;
41 typedef io::detail::format_item format_item_t;
42
43public:
44 basic_format(const char* str);
45 basic_format(const string_t& s);
46#ifndef BOOST_NO_STD_LOCALE
47 basic_format(const char* str, const std::locale & loc);
48 basic_format(const string_t& s, const std::locale & loc);
49#endif // no locale
50 basic_format(const basic_format& x);
51 basic_format& operator= (const basic_format& x);
52
53 basic_format& clear(); // empty the string buffers (except bound arguments, see clear_binds() )
54
55 // pass arguments through those operators :
56 template<class T> basic_format& operator%(const T& x)
57 {
58 return io::detail::feed<const T&>(*this,x);
59 }
60
61#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
62 template<class T> basic_format& operator%(T& x)
63 {
64 return io::detail::feed<T&>(*this,x);
65 }
66#endif
67
68
69 // system for binding arguments :
70 template<class T>
71 basic_format& bind_arg(int argN, const T& val)
72 {
73 return io::detail::bind_arg_body(*this, argN, val);
74 }
75 basic_format& clear_bind(int argN);
76 basic_format& clear_binds();
77
78 // modify the params of a directive, by applying a manipulator :
79 template<class T>
80 basic_format& modify_item(int itemN, const T& manipulator)
81 {
82 return io::detail::modify_item_body(*this, itemN, manipulator) ;
83 }
84
85 // Choosing which errors will throw exceptions :
86 unsigned char exceptions() const;
87 unsigned char exceptions(unsigned char newexcept);
88
89 // final output
90 string_t str() const;
91 friend BOOST_IO_STD ostream&
92 operator<< ( BOOST_IO_STD ostream& , const basic_format& );
93
94
95 template<class T> friend basic_format&
96 io::detail::feed(basic_format&, T);
97
98 template<class T> friend
99 void io::detail::distribute(basic_format&, T);
100
101 template<class T> friend
102 basic_format& io::detail::modify_item_body(basic_format&, int, const T&);
103
104 template<class T> friend
105 basic_format& io::detail::bind_arg_body(basic_format&, int, const T&);
106
107// make the members private only if the friend templates are supported
108private:
109
110 // flag bits, used for style_
111 enum style_values { ordered = 1, // set only if all directives are positional directives
112 special_needs = 4 };
113
114 // parse the format string :
115 void parse(const string_t&);
116
117 int style_; // style of format-string : positional or not, etc
118 int cur_arg_; // keep track of wich argument will come
119 int num_args_; // number of expected arguments
120 mutable bool dumped_; // true only after call to str() or <<
121 std::vector<format_item_t> items_; // vector of directives (aka items)
122 string_t prefix_; // piece of string to insert before first item
123
124 std::vector<bool> bound_; // stores which arguments were bound
125 // size = num_args OR zero
126 internal_stream_t oss_; // the internal stream.
127 stream_format_state state0_; // reference state for oss_
128 unsigned char exceptions_;
129}; // class basic_format
130
131
132} // namespace boost
133
134
135#endif // BOOST_FORMAT_CLASS_HPP
diff --git a/nix/boost/format/format_fwd.hpp b/nix/boost/format/format_fwd.hpp
deleted file mode 100644
index 97c55f6684c..00000000000
--- a/nix/boost/format/format_fwd.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// format_fwd.hpp : forward declarations, for primary header format.hpp
17// ------------------------------------------------------------------------------
18
19#ifndef BOOST_FORMAT_FWD_HPP
20#define BOOST_FORMAT_FWD_HPP
21
22#include <string>
23#include <iosfwd>
24
25namespace boost {
26
27class basic_format;
28
29typedef basic_format format;
30
31namespace io {
32enum format_error_bits { bad_format_string_bit = 1,
33 too_few_args_bit = 2, too_many_args_bit = 4,
34 out_of_range_bit = 8,
35 all_error_bits = 255, no_error_bits=0 };
36
37// Convertion: format to string
38std::string str(const basic_format& ) ;
39
40} // namespace io
41
42
43BOOST_IO_STD ostream&
44operator<<( BOOST_IO_STD ostream&, const basic_format&);
45
46
47} // namespace boost
48
49#endif // BOOST_FORMAT_FWD_HPP
diff --git a/nix/boost/format/format_implementation.cc b/nix/boost/format/format_implementation.cc
deleted file mode 100644
index aa191afe113..00000000000
--- a/nix/boost/format/format_implementation.cc
+++ /dev/null
@@ -1,256 +0,0 @@
1// -*- C++ -*-
2// Boost general library format ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream
14
15// ----------------------------------------------------------------------------
16// format_implementation.hpp Implementation of the basic_format class
17// ----------------------------------------------------------------------------
18
19
20#ifndef BOOST_FORMAT_IMPLEMENTATION_HPP
21#define BOOST_FORMAT_IMPLEMENTATION_HPP
22
23#include <boost/throw_exception.hpp>
24#include <boost/assert.hpp>
25#include <boost/format.hpp>
26
27namespace boost {
28
29// -------- format:: -------------------------------------------
30basic_format::basic_format(const char* str)
31 : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
32 items_(), oss_(), exceptions_(io::all_error_bits)
33{
34 state0_.set_by_stream(oss_);
35 string_t emptyStr;
36 if( !str) str = emptyStr.c_str();
37 parse( str );
38}
39
40#ifndef BOOST_NO_STD_LOCALE
41basic_format::basic_format(const char* str, const std::locale & loc)
42 : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
43 items_(), oss_(), exceptions_(io::all_error_bits)
44{
45 oss_.imbue( loc );
46 state0_.set_by_stream(oss_);
47 string_t emptyStr;
48 if( !str) str = emptyStr.c_str();
49 parse( str );
50}
51
52basic_format::basic_format(const string_t& s, const std::locale & loc)
53 : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
54 items_(), oss_(), exceptions_(io::all_error_bits)
55{
56 oss_.imbue( loc );
57 state0_.set_by_stream(oss_);
58 parse(s);
59}
60#endif //BOOST_NO_STD_LOCALE
61
62basic_format::basic_format(const string_t& s)
63 : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
64 items_(), oss_(), exceptions_(io::all_error_bits)
65{
66 state0_.set_by_stream(oss_);
67 parse(s);
68}
69
70basic_format:: basic_format(const basic_format& x)
71 : style_(x.style_), cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
72 items_(x.items_), prefix_(x.prefix_), bound_(x.bound_),
73 oss_(), // <- we obviously can't copy x.oss_
74 state0_(x.state0_), exceptions_(x.exceptions_)
75{
76 state0_.apply_on(oss_);
77}
78
79basic_format& basic_format::operator= (const basic_format& x)
80{
81 if(this == &x)
82 return *this;
83 state0_ = x.state0_;
84 state0_.apply_on(oss_);
85
86 // plus all the other (trivial) assignments :
87 exceptions_ = x.exceptions_;
88 items_ = x.items_;
89 prefix_ = x.prefix_;
90 bound_=x.bound_;
91 style_=x.style_;
92 cur_arg_=x.cur_arg_;
93 num_args_=x.num_args_;
94 dumped_=x.dumped_;
95 return *this;
96}
97
98
99unsigned char basic_format::exceptions() const
100{
101 return exceptions_;
102}
103
104unsigned char basic_format::exceptions(unsigned char newexcept)
105{
106 unsigned char swp = exceptions_;
107 exceptions_ = newexcept;
108 return swp;
109}
110
111
112basic_format& basic_format ::clear()
113 // empty the string buffers (except bound arguments, see clear_binds() )
114 // and make the format object ready for formatting a new set of arguments
115{
116 BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast<int>(bound_.size()) );
117
118 for(unsigned long i=0; i<items_.size(); ++i){
119 items_[i].state_ = items_[i].ref_state_;
120 // clear converted strings only if the corresponding argument is not bound :
121 if( bound_.size()==0 || !bound_[ items_[i].argN_ ] ) items_[i].res_.resize(0);
122 }
123 cur_arg_=0; dumped_=false;
124 // maybe first arg is bound:
125 if(bound_.size() != 0)
126 {
127 while(cur_arg_ < num_args_ && bound_[cur_arg_] ) ++cur_arg_;
128 }
129 return *this;
130}
131
132basic_format& basic_format ::clear_binds()
133 // cancel all bindings, and clear()
134{
135 bound_.resize(0);
136 clear();
137 return *this;
138}
139
140basic_format& basic_format::clear_bind(int argN)
141 // cancel the binding of ONE argument, and clear()
142{
143 if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] )
144 {
145 if( exceptions() & io::out_of_range_bit )
146 boost::throw_exception(io::out_of_range()); // arg not in range.
147 else return *this;
148 }
149 bound_[argN-1]=false;
150 clear();
151 return *this;
152}
153
154
155
156std::string basic_format::str() const
157{
158 dumped_=true;
159 if(items_.size()==0)
160 return prefix_;
161 if( cur_arg_ < num_args_)
162 if( exceptions() & io::too_few_args_bit )
163 boost::throw_exception(io::too_few_args()); // not enough variables have been supplied !
164
165 unsigned long sz = prefix_.size();
166 unsigned long i;
167 for(i=0; i < items_.size(); ++i)
168 sz += items_[i].res_.size() + items_[i].appendix_.size();
169 string_t res;
170 res.reserve(sz);
171
172 res += prefix_;
173 for(i=0; i < items_.size(); ++i)
174 {
175 const format_item_t& item = items_[i];
176 res += item.res_;
177 if( item.argN_ == format_item_t::argN_tabulation)
178 {
179 BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation);
180 std::streamsize n = item.state_.width_ - res.size();
181 if( n > 0 )
182 res.append( n, item.state_.fill_ );
183 }
184 res += item.appendix_;
185 }
186 return res;
187}
188
189namespace io {
190namespace detail {
191
192template<class T>
193basic_format& bind_arg_body( basic_format& self,
194 int argN,
195 const T& val)
196 // bind one argument to a fixed value
197 // this is persistent over clear() calls, thus also over str() and <<
198{
199 if(self.dumped_) self.clear(); // needed, because we will modify cur_arg_..
200 if(argN<1 || argN > self.num_args_)
201 {
202 if( self.exceptions() & io::out_of_range_bit )
203 boost::throw_exception(io::out_of_range()); // arg not in range.
204 else return self;
205 }
206 if(self.bound_.size()==0)
207 self.bound_.assign(self.num_args_,false);
208 else
209 BOOST_ASSERT( self.num_args_ == static_cast<signed int>(self.bound_.size()) );
210 int o_cur_arg = self.cur_arg_;
211 self.cur_arg_ = argN-1; // arrays begin at 0
212
213 self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets..
214 self.operator%(val); // put val at the right place, because cur_arg is set
215
216
217 // Now re-position cur_arg before leaving :
218 self.cur_arg_ = o_cur_arg;
219 self.bound_[argN-1]=true;
220 if(self.cur_arg_ == argN-1 )
221 // hum, now this arg is bound, so move to next free arg
222 {
223 while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_]) ++self.cur_arg_;
224 }
225 // In any case, we either have all args, or are on a non-binded arg :
226 BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]);
227 return self;
228}
229
230template<class T>
231basic_format& modify_item_body( basic_format& self,
232 int itemN,
233 const T& manipulator)
234 // applies a manipulator to the format_item describing a given directive.
235 // this is a permanent change, clear or clear_binds won't cancel that.
236{
237 if(itemN<1 || itemN >= static_cast<signed int>(self.items_.size() ))
238 {
239 if( self.exceptions() & io::out_of_range_bit )
240 boost::throw_exception(io::out_of_range()); // item not in range.
241 else return self;
242 }
243 self.items_[itemN-1].ref_state_.apply_manip( manipulator );
244 self.items_[itemN-1].state_ = self.items_[itemN-1].ref_state_;
245 return self;
246}
247
248} // namespace detail
249
250} // namespace io
251
252} // namespace boost
253
254
255
256#endif // BOOST_FORMAT_IMPLEMENTATION_HPP
diff --git a/nix/boost/format/free_funcs.cc b/nix/boost/format/free_funcs.cc
deleted file mode 100644
index 151db37a0ac..00000000000
--- a/nix/boost/format/free_funcs.cc
+++ /dev/null
@@ -1,71 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// free_funcs.hpp : implementation of the free functions declared in namespace format
17// ------------------------------------------------------------------------------
18
19#ifndef BOOST_FORMAT_FUNCS_HPP
20#define BOOST_FORMAT_FUNCS_HPP
21
22#include "boost/format.hpp"
23#include "boost/throw_exception.hpp"
24
25namespace boost {
26
27namespace io {
28 inline
29 std::string str(const basic_format& f)
30 // adds up all pieces of strings and converted items, and return the formatted string
31 {
32 return f.str();
33 }
34} // - namespace io
35
36BOOST_IO_STD ostream&
37operator<<( BOOST_IO_STD ostream& os,
38 const boost::basic_format& f)
39 // effect: "return os << str(f);" but we can try to do it faster
40{
41 typedef boost::basic_format format_t;
42 if(f.items_.size()==0)
43 os << f.prefix_;
44 else {
45 if(f.cur_arg_ < f.num_args_)
46 if( f.exceptions() & io::too_few_args_bit )
47 boost::throw_exception(io::too_few_args()); // not enough variables have been supplied !
48 if(f.style_ & format_t::special_needs)
49 os << f.str();
50 else {
51 // else we dont have to count chars output, so we dump directly to os :
52 os << f.prefix_;
53 for(unsigned long i=0; i<f.items_.size(); ++i)
54 {
55 const format_t::format_item_t& item = f.items_[i];
56 os << item.res_;
57 os << item.appendix_;
58
59 }
60 }
61 }
62 f.dumped_=true;
63 return os;
64}
65
66
67
68} // namespace boost
69
70
71#endif // BOOST_FORMAT_FUNCS_HPP
diff --git a/nix/boost/format/group.hpp b/nix/boost/format/group.hpp
deleted file mode 100644
index ac63f3f0bab..00000000000
--- a/nix/boost/format/group.hpp
+++ /dev/null
@@ -1,680 +0,0 @@
1
2// -*- C++ -*-
3// Boost general library 'format' ---------------------------
4// See http://www.boost.org for updates, documentation, and revision history.
5
6// (C) Samuel Krempp 2001
7// krempp@crans.ens-cachan.fr
8// Permission to copy, use, modify, sell and
9// distribute this software is granted provided this copyright notice appears
10// in all copies. This software is provided "as is" without express or implied
11// warranty, and with no claim as to its suitability for any purpose.
12
13// ideas taken from Rüdiger Loos's format class
14// and Karl Nelson's ofstream
15
16// ----------------------------------------------------------------------------
17
18// group.hpp : encapsulates a group of manipulators along with an argument
19//
20// group_head : cut the last element of a group out.
21// (is overloaded below on each type of group)
22
23// group_last : returns the last element of a group
24// (is overloaded below on each type of group)
25
26// ----------------------------------------------------------------------------
27
28
29#ifndef BOOST_FORMAT_GROUP_HPP
30#define BOOST_FORMAT_GROUP_HPP
31
32
33namespace boost {
34namespace io {
35
36
37namespace detail {
38
39
40// empty group, but useful even though.
41struct group0
42{
43 group0() {}
44};
45
46template <class Ch, class Tr>
47inline
48BOOST_IO_STD ostream&
49operator << ( BOOST_IO_STD ostream& os,
50 const group0& )
51{
52 return os;
53}
54
55template <class T1>
56struct group1
57{
58 T1 a1_;
59 group1(T1 a1)
60 : a1_(a1)
61 {}
62};
63
64template <class Ch, class Tr, class T1>
65inline
66BOOST_IO_STD ostream&
67operator << (BOOST_IO_STD ostream& os,
68 const group1<T1>& x)
69{
70 os << x.a1_;
71 return os;
72}
73
74
75
76
77template <class T1,class T2>
78struct group2
79{
80 T1 a1_;
81 T2 a2_;
82 group2(T1 a1,T2 a2)
83 : a1_(a1),a2_(a2)
84 {}
85};
86
87template <class Ch, class Tr, class T1,class T2>
88inline
89BOOST_IO_STD ostream&
90operator << (BOOST_IO_STD ostream& os,
91 const group2<T1,T2>& x)
92{
93 os << x.a1_<< x.a2_;
94 return os;
95}
96
97template <class T1,class T2,class T3>
98struct group3
99{
100 T1 a1_;
101 T2 a2_;
102 T3 a3_;
103 group3(T1 a1,T2 a2,T3 a3)
104 : a1_(a1),a2_(a2),a3_(a3)
105 {}
106};
107
108template <class Ch, class Tr, class T1,class T2,class T3>
109inline
110BOOST_IO_STD ostream&
111operator << (BOOST_IO_STD ostream& os,
112 const group3<T1,T2,T3>& x)
113{
114 os << x.a1_<< x.a2_<< x.a3_;
115 return os;
116}
117
118template <class T1,class T2,class T3,class T4>
119struct group4
120{
121 T1 a1_;
122 T2 a2_;
123 T3 a3_;
124 T4 a4_;
125 group4(T1 a1,T2 a2,T3 a3,T4 a4)
126 : a1_(a1),a2_(a2),a3_(a3),a4_(a4)
127 {}
128};
129
130template <class Ch, class Tr, class T1,class T2,class T3,class T4>
131inline
132BOOST_IO_STD ostream&
133operator << (BOOST_IO_STD ostream& os,
134 const group4<T1,T2,T3,T4>& x)
135{
136 os << x.a1_<< x.a2_<< x.a3_<< x.a4_;
137 return os;
138}
139
140template <class T1,class T2,class T3,class T4,class T5>
141struct group5
142{
143 T1 a1_;
144 T2 a2_;
145 T3 a3_;
146 T4 a4_;
147 T5 a5_;
148 group5(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
149 : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5)
150 {}
151};
152
153template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5>
154inline
155BOOST_IO_STD ostream&
156operator << (BOOST_IO_STD ostream& os,
157 const group5<T1,T2,T3,T4,T5>& x)
158{
159 os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_;
160 return os;
161}
162
163template <class T1,class T2,class T3,class T4,class T5,class T6>
164struct group6
165{
166 T1 a1_;
167 T2 a2_;
168 T3 a3_;
169 T4 a4_;
170 T5 a5_;
171 T6 a6_;
172 group6(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
173 : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6)
174 {}
175};
176
177template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6>
178inline
179BOOST_IO_STD ostream&
180operator << (BOOST_IO_STD ostream& os,
181 const group6<T1,T2,T3,T4,T5,T6>& x)
182{
183 os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_;
184 return os;
185}
186
187template <class T1,class T2,class T3,class T4,class T5,class T6,class T7>
188struct group7
189{
190 T1 a1_;
191 T2 a2_;
192 T3 a3_;
193 T4 a4_;
194 T5 a5_;
195 T6 a6_;
196 T7 a7_;
197 group7(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7)
198 : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7)
199 {}
200};
201
202template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7>
203inline
204BOOST_IO_STD ostream&
205operator << (BOOST_IO_STD ostream& os,
206 const group7<T1,T2,T3,T4,T5,T6,T7>& x)
207{
208 os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_;
209 return os;
210}
211
212template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
213struct group8
214{
215 T1 a1_;
216 T2 a2_;
217 T3 a3_;
218 T4 a4_;
219 T5 a5_;
220 T6 a6_;
221 T7 a7_;
222 T8 a8_;
223 group8(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8)
224 : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8)
225 {}
226};
227
228template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
229inline
230BOOST_IO_STD ostream&
231operator << (BOOST_IO_STD ostream& os,
232 const group8<T1,T2,T3,T4,T5,T6,T7,T8>& x)
233{
234 os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_;
235 return os;
236}
237
238template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
239struct group9
240{
241 T1 a1_;
242 T2 a2_;
243 T3 a3_;
244 T4 a4_;
245 T5 a5_;
246 T6 a6_;
247 T7 a7_;
248 T8 a8_;
249 T9 a9_;
250 group9(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9)
251 : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9)
252 {}
253};
254
255template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
256inline
257BOOST_IO_STD ostream&
258operator << (BOOST_IO_STD ostream& os,
259 const group9<T1,T2,T3,T4,T5,T6,T7,T8,T9>& x)
260{
261 os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_;
262 return os;
263}
264
265template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
266struct group10
267{
268 T1 a1_;
269 T2 a2_;
270 T3 a3_;
271 T4 a4_;
272 T5 a5_;
273 T6 a6_;
274 T7 a7_;
275 T8 a8_;
276 T9 a9_;
277 T10 a10_;
278 group10(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9,T10 a10)
279 : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9),a10_(a10)
280 {}
281};
282
283template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
284inline
285BOOST_IO_STD ostream&
286operator << (BOOST_IO_STD ostream& os,
287 const group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>& x)
288{
289 os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_<< x.a10_;
290 return os;
291}
292
293
294
295
296template <class T1,class T2>
297inline
298group1<T1>
299group_head( group2<T1,T2> const& x)
300{
301 return group1<T1> (x.a1_);
302}
303
304template <class T1,class T2>
305inline
306group1<T2>
307group_last( group2<T1,T2> const& x)
308{
309 return group1<T2> (x.a2_);
310}
311
312
313
314template <class T1,class T2,class T3>
315inline
316group2<T1,T2>
317group_head( group3<T1,T2,T3> const& x)
318{
319 return group2<T1,T2> (x.a1_,x.a2_);
320}
321
322template <class T1,class T2,class T3>
323inline
324group1<T3>
325group_last( group3<T1,T2,T3> const& x)
326{
327 return group1<T3> (x.a3_);
328}
329
330
331
332template <class T1,class T2,class T3,class T4>
333inline
334group3<T1,T2,T3>
335group_head( group4<T1,T2,T3,T4> const& x)
336{
337 return group3<T1,T2,T3> (x.a1_,x.a2_,x.a3_);
338}
339
340template <class T1,class T2,class T3,class T4>
341inline
342group1<T4>
343group_last( group4<T1,T2,T3,T4> const& x)
344{
345 return group1<T4> (x.a4_);
346}
347
348
349
350template <class T1,class T2,class T3,class T4,class T5>
351inline
352group4<T1,T2,T3,T4>
353group_head( group5<T1,T2,T3,T4,T5> const& x)
354{
355 return group4<T1,T2,T3,T4> (x.a1_,x.a2_,x.a3_,x.a4_);
356}
357
358template <class T1,class T2,class T3,class T4,class T5>
359inline
360group1<T5>
361group_last( group5<T1,T2,T3,T4,T5> const& x)
362{
363 return group1<T5> (x.a5_);
364}
365
366
367
368template <class T1,class T2,class T3,class T4,class T5,class T6>
369inline
370group5<T1,T2,T3,T4,T5>
371group_head( group6<T1,T2,T3,T4,T5,T6> const& x)
372{
373 return group5<T1,T2,T3,T4,T5> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_);
374}
375
376template <class T1,class T2,class T3,class T4,class T5,class T6>
377inline
378group1<T6>
379group_last( group6<T1,T2,T3,T4,T5,T6> const& x)
380{
381 return group1<T6> (x.a6_);
382}
383
384
385
386template <class T1,class T2,class T3,class T4,class T5,class T6,class T7>
387inline
388group6<T1,T2,T3,T4,T5,T6>
389group_head( group7<T1,T2,T3,T4,T5,T6,T7> const& x)
390{
391 return group6<T1,T2,T3,T4,T5,T6> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_);
392}
393
394template <class T1,class T2,class T3,class T4,class T5,class T6,class T7>
395inline
396group1<T7>
397group_last( group7<T1,T2,T3,T4,T5,T6,T7> const& x)
398{
399 return group1<T7> (x.a7_);
400}
401
402
403
404template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
405inline
406group7<T1,T2,T3,T4,T5,T6,T7>
407group_head( group8<T1,T2,T3,T4,T5,T6,T7,T8> const& x)
408{
409 return group7<T1,T2,T3,T4,T5,T6,T7> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_);
410}
411
412template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
413inline
414group1<T8>
415group_last( group8<T1,T2,T3,T4,T5,T6,T7,T8> const& x)
416{
417 return group1<T8> (x.a8_);
418}
419
420
421
422template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
423inline
424group8<T1,T2,T3,T4,T5,T6,T7,T8>
425group_head( group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> const& x)
426{
427 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_);
428}
429
430template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
431inline
432group1<T9>
433group_last( group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> const& x)
434{
435 return group1<T9> (x.a9_);
436}
437
438
439
440template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
441inline
442group9<T1,T2,T3,T4,T5,T6,T7,T8,T9>
443group_head( group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> const& x)
444{
445 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_);
446}
447
448template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
449inline
450group1<T10>
451group_last( group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> const& x)
452{
453 return group1<T10> (x.a10_);
454}
455
456
457
458
459
460} // namespace detail
461
462
463
464// helper functions
465
466
467inline detail::group1< detail::group0 >
468group() { return detail::group1< detail::group0 > ( detail::group0() ); }
469
470template <class T1, class Var>
471inline
472detail::group1< detail::group2<T1, Var const&> >
473 group(T1 a1, Var const& var)
474{
475 return detail::group1< detail::group2<T1, Var const&> >
476 ( detail::group2<T1, Var const&>
477 (a1, var)
478 );
479}
480
481template <class T1,class T2, class Var>
482inline
483detail::group1< detail::group3<T1,T2, Var const&> >
484 group(T1 a1,T2 a2, Var const& var)
485{
486 return detail::group1< detail::group3<T1,T2, Var const&> >
487 ( detail::group3<T1,T2, Var const&>
488 (a1,a2, var)
489 );
490}
491
492template <class T1,class T2,class T3, class Var>
493inline
494detail::group1< detail::group4<T1,T2,T3, Var const&> >
495 group(T1 a1,T2 a2,T3 a3, Var const& var)
496{
497 return detail::group1< detail::group4<T1,T2,T3, Var const&> >
498 ( detail::group4<T1,T2,T3, Var const&>
499 (a1,a2,a3, var)
500 );
501}
502
503template <class T1,class T2,class T3,class T4, class Var>
504inline
505detail::group1< detail::group5<T1,T2,T3,T4, Var const&> >
506 group(T1 a1,T2 a2,T3 a3,T4 a4, Var const& var)
507{
508 return detail::group1< detail::group5<T1,T2,T3,T4, Var const&> >
509 ( detail::group5<T1,T2,T3,T4, Var const&>
510 (a1,a2,a3,a4, var)
511 );
512}
513
514template <class T1,class T2,class T3,class T4,class T5, class Var>
515inline
516detail::group1< detail::group6<T1,T2,T3,T4,T5, Var const&> >
517 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var const& var)
518{
519 return detail::group1< detail::group6<T1,T2,T3,T4,T5, Var const&> >
520 ( detail::group6<T1,T2,T3,T4,T5, Var const&>
521 (a1,a2,a3,a4,a5, var)
522 );
523}
524
525template <class T1,class T2,class T3,class T4,class T5,class T6, class Var>
526inline
527detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var const&> >
528 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var const& var)
529{
530 return detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var const&> >
531 ( detail::group7<T1,T2,T3,T4,T5,T6, Var const&>
532 (a1,a2,a3,a4,a5,a6, var)
533 );
534}
535
536template <class T1,class T2,class T3,class T4,class T5,class T6,class T7, class Var>
537inline
538detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> >
539 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var const& var)
540{
541 return detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> >
542 ( detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&>
543 (a1,a2,a3,a4,a5,a6,a7, var)
544 );
545}
546
547template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8, class Var>
548inline
549detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> >
550 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var const& var)
551{
552 return detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> >
553 ( detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&>
554 (a1,a2,a3,a4,a5,a6,a7,a8, var)
555 );
556}
557
558template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9, class Var>
559inline
560detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> >
561 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var const& var)
562{
563 return detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> >
564 ( detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&>
565 (a1,a2,a3,a4,a5,a6,a7,a8,a9, var)
566 );
567}
568
569
570#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
571
572template <class T1, class Var>
573inline
574detail::group1< detail::group2<T1, Var&> >
575 group(T1 a1, Var& var)
576{
577 return detail::group1< detail::group2<T1, Var&> >
578 ( detail::group2<T1, Var&>
579 (a1, var)
580 );
581}
582
583template <class T1,class T2, class Var>
584inline
585detail::group1< detail::group3<T1,T2, Var&> >
586 group(T1 a1,T2 a2, Var& var)
587{
588 return detail::group1< detail::group3<T1,T2, Var&> >
589 ( detail::group3<T1,T2, Var&>
590 (a1,a2, var)
591 );
592}
593
594template <class T1,class T2,class T3, class Var>
595inline
596detail::group1< detail::group4<T1,T2,T3, Var&> >
597 group(T1 a1,T2 a2,T3 a3, Var& var)
598{
599 return detail::group1< detail::group4<T1,T2,T3, Var&> >
600 ( detail::group4<T1,T2,T3, Var&>
601 (a1,a2,a3, var)
602 );
603}
604
605template <class T1,class T2,class T3,class T4, class Var>
606inline
607detail::group1< detail::group5<T1,T2,T3,T4, Var&> >
608 group(T1 a1,T2 a2,T3 a3,T4 a4, Var& var)
609{
610 return detail::group1< detail::group5<T1,T2,T3,T4, Var&> >
611 ( detail::group5<T1,T2,T3,T4, Var&>
612 (a1,a2,a3,a4, var)
613 );
614}
615
616template <class T1,class T2,class T3,class T4,class T5, class Var>
617inline
618detail::group1< detail::group6<T1,T2,T3,T4,T5, Var&> >
619 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var& var)
620{
621 return detail::group1< detail::group6<T1,T2,T3,T4,T5, Var&> >
622 ( detail::group6<T1,T2,T3,T4,T5, Var&>
623 (a1,a2,a3,a4,a5, var)
624 );
625}
626
627template <class T1,class T2,class T3,class T4,class T5,class T6, class Var>
628inline
629detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var&> >
630 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var& var)
631{
632 return detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var&> >
633 ( detail::group7<T1,T2,T3,T4,T5,T6, Var&>
634 (a1,a2,a3,a4,a5,a6, var)
635 );
636}
637
638template <class T1,class T2,class T3,class T4,class T5,class T6,class T7, class Var>
639inline
640detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> >
641 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var& var)
642{
643 return detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> >
644 ( detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&>
645 (a1,a2,a3,a4,a5,a6,a7, var)
646 );
647}
648
649template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8, class Var>
650inline
651detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> >
652 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var& var)
653{
654 return detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> >
655 ( detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&>
656 (a1,a2,a3,a4,a5,a6,a7,a8, var)
657 );
658}
659
660template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9, class Var>
661inline
662detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> >
663 group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var& var)
664{
665 return detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> >
666 ( detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&>
667 (a1,a2,a3,a4,a5,a6,a7,a8,a9, var)
668 );
669}
670
671
672#endif //end- #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
673
674
675} // namespace io
676
677} // namespace boost
678
679
680#endif // BOOST_FORMAT_GROUP_HPP
diff --git a/nix/boost/format/internals.hpp b/nix/boost/format/internals.hpp
deleted file mode 100644
index d25eb4c864c..00000000000
--- a/nix/boost/format/internals.hpp
+++ /dev/null
@@ -1,167 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream
14
15// ----------------------------------------------------------------------------
16// internals.hpp : internal structs. included by format.hpp
17// stream_format_state, and format_item
18// ----------------------------------------------------------------------------
19
20
21#ifndef BOOST_FORMAT_INTERNALS_HPP
22#define BOOST_FORMAT_INTERNALS_HPP
23
24
25#include <string>
26#include <sstream>
27
28namespace boost {
29namespace io {
30namespace detail {
31
32
33// --------------
34// set of params that define the format state of a stream
35
36struct stream_format_state
37{
38 typedef std::ios basic_ios;
39
40 std::streamsize width_;
41 std::streamsize precision_;
42 char fill_;
43 std::ios::fmtflags flags_;
44
45 stream_format_state() : width_(-1), precision_(-1), fill_(0), flags_(std::ios::dec) {}
46 stream_format_state(basic_ios& os) {set_by_stream(os); }
47
48 void apply_on(basic_ios & os) const; //- applies format_state to the stream
49 template<class T> void apply_manip(T manipulator) //- modifies state by applying manipulator.
50 { apply_manip_body<T>( *this, manipulator) ; }
51 void reset(); //- sets to default state.
52 void set_by_stream(const basic_ios& os); //- sets to os's state.
53};
54
55
56
57// --------------
58// format_item : stores all parameters that can be defined by directives in the format-string
59
60struct format_item
61{
62 enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 };
63
64 enum arg_values { argN_no_posit = -1, // non-positional directive. argN will be set later.
65 argN_tabulation = -2, // tabulation directive. (no argument read)
66 argN_ignored = -3 // ignored directive. (no argument read)
67 };
68 typedef BOOST_IO_STD ios basic_ios;
69 typedef detail::stream_format_state stream_format_state;
70 typedef std::string string_t;
71 typedef BOOST_IO_STD ostringstream internal_stream_t;
72
73
74 int argN_; //- argument number (starts at 0, eg : %1 => argN=0)
75 // negative values are used for items that don't process
76 // an argument
77 string_t res_; //- result of the formatting of this item
78 string_t appendix_; //- piece of string between this item and the next
79
80 stream_format_state ref_state_;// set by parsing the format_string, is only affected by modify_item
81 stream_format_state state_; // always same as ref_state, _unless_ modified by manipulators 'group(..)'
82
83 // non-stream format-state parameters
84 signed int truncate_; //- is >=0 for directives like %.5s (take 5 chars from the string)
85 unsigned int pad_scheme_; //- several possible padding schemes can mix. see pad_values
86
87 format_item() : argN_(argN_no_posit), truncate_(-1), pad_scheme_(0) {}
88
89 void compute_states(); // sets states according to truncate and pad_scheme.
90};
91
92
93
94// -----------------------------------------------------------
95// Definitions
96// -----------------------------------------------------------
97
98// --- stream_format_state:: -------------------------------------------
99inline
100void stream_format_state::apply_on(basic_ios & os) const
101 // set the state of this stream according to our params
102{
103 if(width_ != -1)
104 os.width(width_);
105 if(precision_ != -1)
106 os.precision(precision_);
107 if(fill_ != 0)
108 os.fill(fill_);
109 os.flags(flags_);
110}
111
112inline
113void stream_format_state::set_by_stream(const basic_ios& os)
114 // set our params according to the state of this stream
115{
116 flags_ = os.flags();
117 width_ = os.width();
118 precision_ = os.precision();
119 fill_ = os.fill();
120}
121
122template<class T> inline
123void apply_manip_body( stream_format_state& self,
124 T manipulator)
125 // modify our params according to the manipulator
126{
127 BOOST_IO_STD stringstream ss;
128 self.apply_on( ss );
129 ss << manipulator;
130 self.set_by_stream( ss );
131}
132
133inline
134void stream_format_state::reset()
135 // set our params to standard's default state
136{
137 width_=-1; precision_=-1; fill_=0;
138 flags_ = std::ios::dec;
139}
140
141
142// --- format_items:: -------------------------------------------
143inline
144void format_item::compute_states()
145 // reflect pad_scheme_ on state_ and ref_state_
146 // because some pad_schemes has complex consequences on several state params.
147{
148 if(pad_scheme_ & zeropad)
149 {
150 if(ref_state_.flags_ & std::ios::left)
151 {
152 pad_scheme_ = pad_scheme_ & (~zeropad); // ignore zeropad in left alignment
153 }
154 else
155 {
156 ref_state_.fill_='0';
157 ref_state_.flags_ |= std::ios::internal;
158 }
159 }
160 state_ = ref_state_;
161}
162
163
164} } } // namespaces boost :: io :: detail
165
166
167#endif // BOOST_FORMAT_INTERNALS_HPP
diff --git a/nix/boost/format/internals_fwd.hpp b/nix/boost/format/internals_fwd.hpp
deleted file mode 100644
index a8ebf7c3abc..00000000000
--- a/nix/boost/format/internals_fwd.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// internals_fwd.hpp : forward declarations, for internal headers
17// ------------------------------------------------------------------------------
18
19#ifndef BOOST_FORMAT_INTERNAL_FWD_HPP
20#define BOOST_FORMAT_INTERNAL_FWD_HPP
21
22#include "boost/format/format_fwd.hpp"
23
24
25namespace boost {
26namespace io {
27
28namespace detail {
29 struct stream_format_state;
30 struct format_item;
31}
32
33
34namespace detail {
35
36 // these functions were intended as methods,
37 // but MSVC have problems with template member functions :
38
39 // defined in format_implementation.hpp :
40 template<class T>
41 basic_format& modify_item_body( basic_format& self,
42 int itemN, const T& manipulator);
43
44 template<class T>
45 basic_format& bind_arg_body( basic_format& self,
46 int argN, const T& val);
47
48 template<class T>
49 void apply_manip_body( stream_format_state& self,
50 T manipulator);
51
52 // argument feeding (defined in feed_args.hpp ) :
53 template<class T>
54 void distribute(basic_format& self, T x);
55
56 template<class T>
57 basic_format& feed(basic_format& self, T x);
58
59} // namespace detail
60
61} // namespace io
62} // namespace boost
63
64
65#endif // BOOST_FORMAT_INTERNAL_FWD_HPP
diff --git a/nix/boost/format/macros_default.hpp b/nix/boost/format/macros_default.hpp
deleted file mode 100644
index 4fd84a163fb..00000000000
--- a/nix/boost/format/macros_default.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rüdiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// macros_default.hpp : configuration for the format library
17// provides default values for the stl workaround macros
18// ------------------------------------------------------------------------------
19
20#ifndef BOOST_FORMAT_MACROS_DEFAULT_HPP
21#define BOOST_FORMAT_MACROS_DEFAULT_HPP
22
23// *** This should go to "boost/config/suffix.hpp".
24
25#ifndef BOOST_IO_STD
26# define BOOST_IO_STD std::
27#endif
28
29// **** Workaround for io streams, stlport and msvc.
30#ifdef BOOST_IO_NEEDS_USING_DECLARATION
31namespace boost {
32 using std::char_traits;
33 using std::basic_ostream;
34 using std::basic_ostringstream;
35 namespace io {
36 using std::basic_ostream;
37 namespace detail {
38 using std::basic_ios;
39 using std::basic_ostream;
40 using std::basic_ostringstream;
41 }
42 }
43}
44#endif
45
46// ------------------------------------------------------------------------------
47
48#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP
diff --git a/nix/boost/format/parsing.cc b/nix/boost/format/parsing.cc
deleted file mode 100644
index 34c36adeb73..00000000000
--- a/nix/boost/format/parsing.cc
+++ /dev/null
@@ -1,454 +0,0 @@
1// -*- C++ -*-
2// Boost general library 'format' ---------------------------
3// See http://www.boost.org for updates, documentation, and revision history.
4
5// (C) Samuel Krempp 2001
6// krempp@crans.ens-cachan.fr
7// Permission to copy, use, modify, sell and
8// distribute this software is granted provided this copyright notice appears
9// in all copies. This software is provided "as is" without express or implied
10// warranty, and with no claim as to its suitability for any purpose.
11
12// ideas taken from Rudiger Loos's format class
13// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15// ------------------------------------------------------------------------------
16// parsing.hpp : implementation of the parsing member functions
17// ( parse, parse_printf_directive)
18// ------------------------------------------------------------------------------
19
20
21#ifndef BOOST_FORMAT_PARSING_HPP
22#define BOOST_FORMAT_PARSING_HPP
23
24
25#include <boost/format.hpp>
26#include <boost/throw_exception.hpp>
27#include <boost/assert.hpp>
28
29
30namespace boost {
31namespace io {
32namespace detail {
33
34 template<class Stream> inline
35 bool wrap_isdigit(char c, Stream &os)
36 {
37#ifndef BOOST_NO_LOCALE_ISIDIGIT
38 return std::isdigit(c, os.rdbuf()->getloc() );
39# else
40 using namespace std;
41 return isdigit(c);
42#endif
43 } //end- wrap_isdigit(..)
44
45 template<class Res> inline
46 Res str2int(const std::string& s,
47 std::string::size_type start,
48 BOOST_IO_STD ios &os,
49 const Res = Res(0) )
50 // Input : char string, with starting index
51 // a basic_ios& merely to call its widen/narrow member function in the desired locale.
52 // Effects : reads s[start:] and converts digits into an integral n, of type Res
53 // Returns : n
54 {
55 Res n = 0;
56 while(start<s.size() && wrap_isdigit(s[start], os) ) {
57 char cur_ch = s[start];
58 BOOST_ASSERT(cur_ch != 0 ); // since we called isdigit, this should not happen.
59 n *= 10;
60 n += cur_ch - '0'; // 22.2.1.1.2 of the C++ standard
61 ++start;
62 }
63 return n;
64 }
65
66 void skip_asterisk(const std::string & buf,
67 std::string::size_type * pos_p,
68 BOOST_IO_STD ios &os)
69 // skip printf's "asterisk-fields" directives in the format-string buf
70 // Input : char string, with starting index *pos_p
71 // a basic_ios& merely to call its widen/narrow member function in the desired locale.
72 // Effects : advance *pos_p by skipping printf's asterisk fields.
73 // Returns : nothing
74 {
75 using namespace std;
76 BOOST_ASSERT( pos_p != 0);
77 if(*pos_p >= buf.size() ) return;
78 if(buf[ *pos_p]=='*') {
79 ++ (*pos_p);
80 while (*pos_p < buf.size() && wrap_isdigit(buf[*pos_p],os)) ++(*pos_p);
81 if(buf[*pos_p]=='$') ++(*pos_p);
82 }
83 }
84
85
86 inline void maybe_throw_exception( unsigned char exceptions)
87 // auxiliary func called by parse_printf_directive
88 // for centralising error handling
89 // it either throws if user sets the corresponding flag, or does nothing.
90 {
91 if(exceptions & io::bad_format_string_bit)
92 boost::throw_exception(io::bad_format_string());
93 }
94
95
96
97 bool parse_printf_directive(const std::string & buf,
98 std::string::size_type * pos_p,
99 detail::format_item * fpar,
100 BOOST_IO_STD ios &os,
101 unsigned char exceptions)
102 // Input : a 'printf-directive' in the format-string, starting at buf[ *pos_p ]
103 // a basic_ios& merely to call its widen/narrow member function in the desired locale.
104 // a bitset'excpetions' telling whether to throw exceptions on errors.
105 // Returns : true if parse somehow succeeded (possibly ignoring errors if exceptions disabled)
106 // false if it failed so bad that the directive should be printed verbatim
107 // Effects : - *pos_p is incremented so that buf[*pos_p] is the first char after the directive
108 // - *fpar is set with the parameters read in the directive
109 {
110 typedef format_item format_item_t;
111 BOOST_ASSERT( pos_p != 0);
112 std::string::size_type &i1 = *pos_p,
113 i0;
114 fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive
115
116 bool in_brackets=false;
117 if(buf[i1]=='|')
118 {
119 in_brackets=true;
120 if( ++i1 >= buf.size() ) {
121 maybe_throw_exception(exceptions);
122 return false;
123 }
124 }
125
126 // the flag '0' would be picked as a digit for argument order, but here it's a flag :
127 if(buf[i1]=='0')
128 goto parse_flags;
129
130 // handle argument order (%2$d) or possibly width specification: %2d
131 i0 = i1; // save position before digits
132 while (i1 < buf.size() && wrap_isdigit(buf[i1], os))
133 ++i1;
134 if (i1!=i0)
135 {
136 if( i1 >= buf.size() ) {
137 maybe_throw_exception(exceptions);
138 return false;
139 }
140 int n=str2int(buf,i0, os, int(0) );
141
142 // %N% case : this is already the end of the directive
143 if( buf[i1] == '%' )
144 {
145 fpar->argN_ = n-1;
146 ++i1;
147 if( in_brackets)
148 maybe_throw_exception(exceptions);
149 // but don't return. maybe "%" was used in lieu of '$', so we go on.
150 else return true;
151 }
152
153 if ( buf[i1]=='$' )
154 {
155 fpar->argN_ = n-1;
156 ++i1;
157 }
158 else
159 {
160 // non-positionnal directive
161 fpar->ref_state_.width_ = n;
162 fpar->argN_ = format_item_t::argN_no_posit;
163 goto parse_precision;
164 }
165 }
166
167 parse_flags:
168 // handle flags
169 while ( i1 <buf.size()) // as long as char is one of + - = # 0 l h or ' '
170 {
171 // misc switches
172 switch (buf[i1])
173 {
174 case '\'' : break; // no effect yet. (painful to implement)
175 case 'l':
176 case 'h': // short/long modifier : for printf-comaptibility (no action needed)
177 break;
178 case '-':
179 fpar->ref_state_.flags_ |= std::ios::left;
180 break;
181 case '=':
182 fpar->pad_scheme_ |= format_item_t::centered;
183 break;
184 case ' ':
185 fpar->pad_scheme_ |= format_item_t::spacepad;
186 break;
187 case '+':
188 fpar->ref_state_.flags_ |= std::ios::showpos;
189 break;
190 case '0':
191 fpar->pad_scheme_ |= format_item_t::zeropad;
192 // need to know alignment before really setting flags,
193 // so just add 'zeropad' flag for now, it will be processed later.
194 break;
195 case '#':
196 fpar->ref_state_.flags_ |= std::ios::showpoint | std::ios::showbase;
197 break;
198 default:
199 goto parse_width;
200 }
201 ++i1;
202 } // loop on flag.
203 if( i1>=buf.size()) {
204 maybe_throw_exception(exceptions);
205 return true;
206 }
207
208 parse_width:
209 // handle width spec
210 skip_asterisk(buf, &i1, os); // skips 'asterisk fields' : *, or *N$
211 i0 = i1; // save position before digits
212 while (i1<buf.size() && wrap_isdigit(buf[i1], os))
213 i1++;
214
215 if (i1!=i0)
216 { fpar->ref_state_.width_ = str2int( buf,i0, os, std::streamsize(0) ); }
217
218 parse_precision:
219 if( i1>=buf.size()) {
220 maybe_throw_exception(exceptions);
221 return true;
222 }
223 // handle precision spec
224 if (buf[i1]=='.')
225 {
226 ++i1;
227 skip_asterisk(buf, &i1, os);
228 i0 = i1; // save position before digits
229 while (i1<buf.size() && wrap_isdigit(buf[i1], os))
230 ++i1;
231
232 if(i1==i0)
233 fpar->ref_state_.precision_ = 0;
234 else
235 fpar->ref_state_.precision_ = str2int(buf,i0, os, std::streamsize(0) );
236 }
237
238 // handle formatting-type flags :
239 while( i1<buf.size() &&
240 ( buf[i1]=='l' || buf[i1]=='L' || buf[i1]=='h') )
241 ++i1;
242 if( i1>=buf.size()) {
243 maybe_throw_exception(exceptions);
244 return true;
245 }
246
247 if( in_brackets && buf[i1]=='|' )
248 {
249 ++i1;
250 return true;
251 }
252 switch (buf[i1])
253 {
254 case 'X':
255 fpar->ref_state_.flags_ |= std::ios::uppercase;
256 case 'p': // pointer => set hex.
257 case 'x':
258 fpar->ref_state_.flags_ &= ~std::ios::basefield;
259 fpar->ref_state_.flags_ |= std::ios::hex;
260 break;
261
262 case 'o':
263 fpar->ref_state_.flags_ &= ~std::ios::basefield;
264 fpar->ref_state_.flags_ |= std::ios::oct;
265 break;
266
267 case 'E':
268 fpar->ref_state_.flags_ |= std::ios::uppercase;
269 case 'e':
270 fpar->ref_state_.flags_ &= ~std::ios::floatfield;
271 fpar->ref_state_.flags_ |= std::ios::scientific;
272
273 fpar->ref_state_.flags_ &= ~std::ios::basefield;
274 fpar->ref_state_.flags_ |= std::ios::dec;
275 break;
276
277 case 'f':
278 fpar->ref_state_.flags_ &= ~std::ios::floatfield;
279 fpar->ref_state_.flags_ |= std::ios::fixed;
280 case 'u':
281 case 'd':
282 case 'i':
283 fpar->ref_state_.flags_ &= ~std::ios::basefield;
284 fpar->ref_state_.flags_ |= std::ios::dec;
285 break;
286
287 case 'T':
288 ++i1;
289 if( i1 >= buf.size())
290 maybe_throw_exception(exceptions);
291 else
292 fpar->ref_state_.fill_ = buf[i1];
293 fpar->pad_scheme_ |= format_item_t::tabulation;
294 fpar->argN_ = format_item_t::argN_tabulation;
295 break;
296 case 't':
297 fpar->ref_state_.fill_ = ' ';
298 fpar->pad_scheme_ |= format_item_t::tabulation;
299 fpar->argN_ = format_item_t::argN_tabulation;
300 break;
301
302 case 'G':
303 fpar->ref_state_.flags_ |= std::ios::uppercase;
304 break;
305 case 'g': // 'g' conversion is default for floats.
306 fpar->ref_state_.flags_ &= ~std::ios::basefield;
307 fpar->ref_state_.flags_ |= std::ios::dec;
308
309 // CLEAR all floatield flags, so stream will CHOOSE
310 fpar->ref_state_.flags_ &= ~std::ios::floatfield;
311 break;
312
313 case 'C':
314 case 'c':
315 fpar->truncate_ = 1;
316 break;
317 case 'S':
318 case 's':
319 fpar->truncate_ = fpar->ref_state_.precision_;
320 fpar->ref_state_.precision_ = -1;
321 break;
322 case 'n' :
323 fpar->argN_ = format_item_t::argN_ignored;
324 break;
325 default:
326 maybe_throw_exception(exceptions);
327 }
328 ++i1;
329
330 if( in_brackets )
331 {
332 if( i1<buf.size() && buf[i1]=='|' )
333 {
334 ++i1;
335 return true;
336 }
337 else maybe_throw_exception(exceptions);
338 }
339 return true;
340 }
341
342} // detail namespace
343} // io namespace
344
345
346// -----------------------------------------------
347// format :: parse(..)
348
349void basic_format::parse(const string_t & buf)
350 // parse the format-string
351{
352 using namespace std;
353 const char arg_mark = '%';
354 bool ordered_args=true;
355 int max_argN=-1;
356 string_t::size_type i1=0;
357 int num_items=0;
358
359 // A: find upper_bound on num_items and allocates arrays
360 i1=0;
361 while( (i1=buf.find(arg_mark,i1)) != string::npos )
362 {
363 if( i1+1 >= buf.size() ) {
364 if(exceptions() & io::bad_format_string_bit)
365 boost::throw_exception(io::bad_format_string()); // must not end in "bla bla %"
366 else break; // stop there, ignore last '%'
367 }
368 if(buf[i1+1] == buf[i1] ) { i1+=2; continue; } // escaped "%%" / "##"
369 ++i1;
370
371 // in case of %N% directives, dont count it double (wastes allocations..) :
372 while(i1 < buf.size() && io::detail::wrap_isdigit(buf[i1],oss_)) ++i1;
373 if( i1 < buf.size() && buf[i1] == arg_mark ) ++ i1;
374
375 ++num_items;
376 }
377 items_.assign( num_items, format_item_t() );
378
379 // B: Now the real parsing of the format string :
380 num_items=0;
381 i1 = 0;
382 string_t::size_type i0 = i1;
383 bool special_things=false;
384 int cur_it=0;
385 while( (i1=buf.find(arg_mark,i1)) != string::npos )
386 {
387 string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_;
388
389 if( buf[i1+1] == buf[i1] ) // escaped mark, '%%'
390 {
391 piece += buf.substr(i0, i1-i0) + buf[i1];
392 i1+=2; i0=i1;
393 continue;
394 }
395 BOOST_ASSERT( static_cast<unsigned int>(cur_it) < items_.size() || cur_it==0);
396
397 if(i1!=i0) piece += buf.substr(i0, i1-i0);
398 ++i1;
399
400 bool parse_ok;
401 parse_ok = io::detail::parse_printf_directive(buf, &i1, &items_[cur_it], oss_, exceptions());
402 if( ! parse_ok ) continue; // the directive will be printed verbatim
403
404 i0=i1;
405 items_[cur_it].compute_states(); // process complex options, like zeropad, into stream params.
406
407 int argN=items_[cur_it].argN_;
408 if(argN == format_item_t::argN_ignored)
409 continue;
410 if(argN ==format_item_t::argN_no_posit)
411 ordered_args=false;
412 else if(argN == format_item_t::argN_tabulation) special_things=true;
413 else if(argN > max_argN) max_argN = argN;
414 ++num_items;
415 ++cur_it;
416 } // loop on %'s
417 BOOST_ASSERT(cur_it == num_items);
418
419 // store the final piece of string
420 string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_;
421 piece += buf.substr(i0);
422
423 if( !ordered_args)
424 {
425 if(max_argN >= 0 ) // dont mix positional with non-positionnal directives
426 {
427 if(exceptions() & io::bad_format_string_bit)
428 boost::throw_exception(io::bad_format_string());
429 // else do nothing. => positionnal arguments are processed as non-positionnal
430 }
431 // set things like it would have been with positional directives :
432 int non_ordered_items = 0;
433 for(int i=0; i< num_items; ++i)
434 if(items_[i].argN_ == format_item_t::argN_no_posit)
435 {
436 items_[i].argN_ = non_ordered_items;
437 ++non_ordered_items;
438 }
439 max_argN = non_ordered_items-1;
440 }
441
442 // C: set some member data :
443 items_.resize(num_items);
444
445 if(special_things) style_ |= special_needs;
446 num_args_ = max_argN + 1;
447 if(ordered_args) style_ |= ordered;
448 else style_ &= ~ordered;
449}
450
451} // namespace boost
452
453
454#endif // BOOST_FORMAT_PARSING_HPP
diff --git a/nix/boost/throw_exception.hpp b/nix/boost/throw_exception.hpp
deleted file mode 100644
index 07b4ae5ceae..00000000000
--- a/nix/boost/throw_exception.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
2#define BOOST_THROW_EXCEPTION_HPP_INCLUDED
3
4// MS compatible compilers support #pragma once
5
6#if defined(_MSC_VER) && (_MSC_VER >= 1020)
7# pragma once
8#endif
9
10//
11// boost/throw_exception.hpp
12//
13// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
14//
15// Permission to copy, use, modify, sell and distribute this software
16// is granted provided this copyright notice appears in all copies.
17// This software is provided "as is" without express or implied
18// warranty, and with no claim as to its suitability for any purpose.
19//
20// http://www.boost.org/libs/utility/throw_exception.html
21//
22
23//#include <boost/config.hpp>
24
25#ifdef BOOST_NO_EXCEPTIONS
26# include <exception>
27#endif
28
29namespace boost
30{
31
32#ifdef BOOST_NO_EXCEPTIONS
33
34void throw_exception(std::exception const & e); // user defined
35
36#else
37
38template<class E> void throw_exception(E const & e)
39{
40 throw e;
41}
42
43#endif
44
45} // namespace boost
46
47#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED