File indexing completed on 2025-01-18 09:30:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_FORMAT_FUNCS_HPP
0014 #define BOOST_FORMAT_FUNCS_HPP
0015
0016 #include <boost/format/format_class.hpp>
0017 #include <boost/throw_exception.hpp>
0018
0019 namespace boost {
0020
0021 template<class Ch, class Tr, class Alloc> inline
0022 std::basic_string<Ch, Tr, Alloc> str(const basic_format<Ch, Tr, Alloc>& f) {
0023
0024 return f.str();
0025 }
0026 namespace io {
0027 using ::boost::str;
0028 }
0029
0030 #ifndef BOOST_NO_TEMPLATE_STD_STREAM
0031 template<class Ch, class Tr, class Alloc>
0032 std::basic_ostream<Ch, Tr> &
0033 operator<<( std::basic_ostream<Ch, Tr> & os,
0034 const basic_format<Ch, Tr, Alloc>& f)
0035 #else
0036 template<class Ch, class Tr, class Alloc>
0037 std::ostream &
0038 operator<<( std::ostream & os,
0039 const basic_format<Ch, Tr, Alloc>& f)
0040 #endif
0041
0042 {
0043 typedef boost::basic_format<Ch, Tr, Alloc> format_t;
0044 if(f.items_.size()==0)
0045 os << f.prefix_;
0046 else {
0047 if(f.cur_arg_ < f.num_args_)
0048 if( f.exceptions() & io::too_few_args_bit )
0049
0050 boost::throw_exception(io::too_few_args(f.cur_arg_, f.num_args_));
0051 if(f.style_ & format_t::special_needs)
0052 os << f.str();
0053 else {
0054
0055 os << f.prefix_;
0056 for(unsigned long i=0; i<f.items_.size(); ++i) {
0057 const typename format_t::format_item_t& item = f.items_[i];
0058 os << item.res_;
0059 os << item.appendix_;
0060 }
0061 }
0062 }
0063 f.dumped_=true;
0064 return os;
0065 }
0066
0067 }
0068
0069
0070 #endif