File indexing completed on 2025-01-19 09:25:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_BEAST_UNIT_TEST_AMOUNT_HPP
0011 #define BOOST_BEAST_UNIT_TEST_AMOUNT_HPP
0012
0013 #include <cstddef>
0014 #include <ostream>
0015 #include <string>
0016
0017 namespace boost {
0018 namespace beast {
0019 namespace unit_test {
0020
0021
0022 class amount
0023 {
0024 private:
0025 std::size_t n_;
0026 std::string const& what_;
0027
0028 public:
0029 amount(amount const&) = default;
0030 amount& operator=(amount const&) = delete;
0031
0032 template<class = void>
0033 amount(std::size_t n, std::string const& what);
0034
0035 friend
0036 std::ostream&
0037 operator<<(std::ostream& s, amount const& t);
0038 };
0039
0040 template<class>
0041 amount::amount(std::size_t n, std::string const& what)
0042 : n_(n)
0043 , what_(what)
0044 {
0045 }
0046
0047 inline
0048 std::ostream&
0049 operator<<(std::ostream& s, amount const& t)
0050 {
0051 s << t.n_ << " " << t.what_ <<((t.n_ != 1) ? "s" : "");
0052 return s;
0053 }
0054
0055 }
0056 }
0057 }
0058
0059 #endif