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
14class Amount
15{
16private:
19
20public:
21 Amount(Amount const&) = default;
22 Amount&
23 operator=(Amount const&) = delete;
24
25 template <class = void>
26 Amount(std::size_t n, std::string const& what);
27
28 friend std::ostream&
29 operator<<(std::ostream& s, Amount const& t);
30};
31
32template <class>
33Amount::Amount(std::size_t n, std::string const& what) : n_(n), what_(what)
34{
35}
36
38operator<<(std::ostream& s, Amount const& t)
39{
40 s << t.n_ << " " << t.what_ << ((t.n_ != 1) ? "s" : "");
41 return s;
42}
43
44} // 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)