xrpld
Loading...
Searching...
No Matches
include/xrpl/beast/unit_test/amount.h
1// Distributed under the Boost Software License, Version 1.0. (See accompanying
2// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
3//
4
5#pragma once
6
7#include <cstddef>
8#include <ostream>
9#include <string>
10
12
16class Amount
17{
18private:
21
22public:
23 Amount(Amount const&) = default;
24 Amount&
25 operator=(Amount const&) = delete;
26
27 template <class = void>
28 Amount(std::size_t n, std::string const& what);
29
30 friend std::ostream&
31 operator<<(std::ostream& s, Amount const& t);
32};
33
34template <class>
35Amount::Amount(std::size_t n, std::string const& what) : n_(n), what_(what)
36{
37}
38
40operator<<(std::ostream& s, Amount const& t)
41{
42 s << t.n_ << " " << t.what_ << ((t.n_ != 1) ? "s" : "");
43 return s;
44}
45
46} // namespace beast::unit_test
Amount & operator=(Amount const &)=delete
Amount(Amount const &)=default
friend std::ostream & operator<<(std::ostream &s, Amount const &t)
std::ostream & operator<<(std::ostream &s, Amount const &t)