free_funcs.hpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // free_funcs.hpp : implementation of the free functions of boost::format
3 // ----------------------------------------------------------------------------
4 
5 // Copyright Samuel Krempp 2003. Use, modification, and distribution are
6 // subject to the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 // See http://www.boost.org/libs/format for library home page
10 
11 // ----------------------------------------------------------------------------
12 
13 #ifndef BOOST_FORMAT_FUNCS_HPP
14 #define BOOST_FORMAT_FUNCS_HPP
15 
18 
19 namespace boost {
20 
21  template<class Ch, class Tr, class Alloc> inline
22  std::basic_string<Ch, Tr, Alloc> str(const basic_format<Ch, Tr, Alloc>& f) {
23  // adds up all pieces of strings and converted items, and return the formatted string
24  return f.str();
25  }
26  namespace io {
27  using ::boost::str; // keep compatibility with when it was defined in this N.S.
28  } // - namespace io
29 
30 #ifndef BOOST_NO_TEMPLATE_STD_STREAM
31  template<class Ch, class Tr, class Alloc>
32  std::basic_ostream<Ch, Tr> &
33  operator<<( std::basic_ostream<Ch, Tr> & os,
35 #else
36  template<class Ch, class Tr, class Alloc>
37  std::ostream &
38  operator<<( std::ostream & os,
40 #endif
41  // effect: "return os << str(f);" but we can do it faster
42  {
43  typedef boost::basic_format<Ch, Tr, Alloc> format_t;
44  if(f.items_.size()==0)
45  os << f.prefix_;
46  else {
47  if(f.cur_arg_ < f.num_args_)
49  // not enough variables supplied
51  if(f.style_ & format_t::special_needs)
52  os << f.str();
53  else {
54  // else we dont have to count chars output, so we dump directly to os :
55  os << f.prefix_;
56  for(unsigned long i=0; i<f.items_.size(); ++i) {
57  const typename format_t::format_item_t& item = f.items_[i];
58  os << item.res_;
59  os << item.appendix_;
60  }
61  }
62  }
63  f.dumped_=true;
64  return os;
65  }
66 
67 } // namespace boost
68 
69 
70 #endif // BOOST_FORMAT_FUNCS_HPP
unsigned char exceptions() const
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
BOOST_NORETURN void throw_exception(E const &e)
std::vector< format_item_t > items_
GLdouble f
std::basic_string< Ch, Tr, Alloc > str(const basic_format< Ch, Tr, Alloc > &f)
Definition: free_funcs.hpp:22
string_type str() const
int i


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:14