This patch makes the Boost.Format library work when exceptions is not
present. It is done the same way as with the smart pointers.

Please apply.

Index: boost/format/feed_args.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/format/feed_args.hpp,v
retrieving revision 1.4
diff -u -p -r1.4 feed_args.hpp
--- boost/format/feed_args.hpp	10 Oct 2002 11:17:18 -0000	1.4
+++ boost/format/feed_args.hpp	20 Nov 2002 13:22:45 -0000
@@ -25,6 +25,7 @@
 #include "boost/format/group.hpp"
 
 #include "boost/format/msvc_disambiguater.hpp"
+#include "boost/throw_exception.hpp"
 
 namespace boost {
 namespace io {
@@ -221,7 +222,7 @@ void distribute(basic_format<Ch,Tr>& sel
     if(self.cur_arg_ >= self.num_args_)
       {
         if( self.exceptions() & too_many_args_bit )
-          throw too_many_args(); // too many variables have been supplied !
+          boost::throw_exception(too_many_args()); // too many variables have been supplied !
         else return;
       }
     for(unsigned long i=0; i < self.items_.size(); ++i)
Index: boost/format/format_implementation.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/format/format_implementation.hpp,v
retrieving revision 1.3
diff -u -p -r1.3 format_implementation.hpp
--- boost/format/format_implementation.hpp	10 Oct 2002 11:17:18 -0000	1.3
+++ boost/format/format_implementation.hpp	20 Nov 2002 13:22:46 -0000
@@ -23,6 +23,7 @@
 #include <cassert>
 
 #include "boost/format/format_class.hpp"
+#include "boost/throw_exception.hpp"
 
 namespace boost {
 
@@ -151,7 +152,7 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr>
     if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) 
       {
         if( exceptions() & out_of_range_bit )
-          throw out_of_range(); // arg not in range.
+          boost::throw_exception(out_of_range()); // arg not in range.
         else return *this;
       }
     bound_[argN-1]=false;
@@ -169,7 +170,7 @@ std::basic_string<Ch,Tr> basic_format<Ch
     return prefix_;
   if( cur_arg_ < num_args_)
       if( exceptions() & io::too_few_args_bit )
-        throw io::too_few_args(); // not enough variables have been supplied !
+        boost::throw_exception(io::too_few_args()); // not enough variables have been supplied !
 
   unsigned long sz = prefix_.size();
   unsigned long i;
@@ -209,7 +210,7 @@ basic_format<Ch, Tr>&  bind_arg_body( ba
     if(argN<1 || argN > self.num_args_) 
       {
         if( self.exceptions() & out_of_range_bit )
-          throw out_of_range(); // arg not in range.
+          boost::throw_exception(out_of_range()); // arg not in range.
         else return self;
       }
     if(self.bound_.size()==0) 
@@ -246,7 +247,7 @@ basic_format<Ch, Tr>&  modify_item_body(
   if(itemN<1 || itemN >= static_cast<signed int>(self.items_.size() )) 
     {
       if( self.exceptions() & out_of_range_bit ) 
-        throw out_of_range(); // item not in range.
+        boost::throw_exception(out_of_range()); // item not in range.
       else return self;
     }
   self.items_[itemN-1].ref_state_.apply_manip( manipulator );
Index: boost/format/free_funcs.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/format/free_funcs.hpp,v
retrieving revision 1.3
diff -u -p -r1.3 free_funcs.hpp
--- boost/format/free_funcs.hpp	10 Oct 2002 11:17:18 -0000	1.3
+++ boost/format/free_funcs.hpp	20 Nov 2002 13:22:46 -0000
@@ -20,6 +20,7 @@
 #define BOOST_FORMAT_FUNCS_HPP
 
 #include "boost/format/format_class.hpp"
+#include "boost/throw_exception.hpp"
 
 namespace boost {
 
@@ -44,7 +45,7 @@ operator<<( BOOST_IO_STD basic_ostream<C
   else {
     if(f.cur_arg_ < f.num_args_)
       if( f.exceptions() & io::too_few_args_bit )
-        throw io::too_few_args(); // not enough variables have been supplied !
+        boost::throw_exception(io::too_few_args()); // not enough variables have been supplied !
     if(f.style_ & format_t::special_needs) 
         os << f.str();
     else {
Index: boost/format/parsing.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/format/parsing.hpp,v
retrieving revision 1.5
diff -u -p -r1.5 parsing.hpp
--- boost/format/parsing.hpp	10 Oct 2002 11:17:18 -0000	1.5
+++ boost/format/parsing.hpp	20 Nov 2002 13:22:46 -0000
@@ -32,6 +32,7 @@
 
 
 #include "boost/format/format_class.hpp"
+#include "boost/throw_exception.hpp"
 
 namespace boost {
 namespace io {
@@ -84,7 +85,7 @@ namespace detail {
     // it either throws if user sets the corresponding flag, or does nothing.
   {
     if(exceptions & io::bad_format_string_bit)
-          throw io::bad_format_string();
+          boost::throw_exception(io::bad_format_string());
   }
     
 
@@ -359,7 +360,7 @@ void basic_format<Ch, Traits> ::parse(co
     {
       if( i1+1 >= buf.size() ) {
         if(exceptions() & io::bad_format_string_bit)
-          throw io::bad_format_string(); // must not end in "bla bla %"
+          boost::throw_exception(io::bad_format_string()); // must not end in "bla bla %"
         else break; // stop there, ignore last '%'
       }
       if(buf[i1+1] == buf[i1] ) { i1+=2; continue; } // escaped "%%" / "##"
@@ -421,7 +422,7 @@ void basic_format<Ch, Traits> ::parse(co
       if(max_argN >= 0 )  // dont mix positional with non-positionnal directives
         {
           if(exceptions() & io::bad_format_string_bit)
-            throw io::bad_format_string();
+            boost::throw_exception(io::bad_format_string());
           // else do nothing. => positionnal arguments are processed as non-positionnal
         }
       // set things like it would have been with positional directives :
-- 
        Lgb
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to