rippled
Loading...
Searching...
No Matches
MPTAmount.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2024 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#include <xrpl/protocol/MPTAmount.h>
21
22namespace ripple {
23
24MPTAmount&
26{
27 value_ += other.value();
28 return *this;
29}
30
33{
34 value_ -= other.value();
35 return *this;
36}
37
40{
41 return MPTAmount{-value_};
42}
43
44bool
46{
47 return value_ == other.value_;
48}
49
50bool
52{
53 return value_ == other;
54}
55
56bool
57MPTAmount::operator<(MPTAmount const& other) const
58{
59 return value_ < other.value_;
60}
61
67
68} // namespace ripple
constexpr value_type value() const
Returns the underlying value.
Definition MPTAmount.h:133
bool operator==(MPTAmount const &other) const
Definition MPTAmount.cpp:45
MPTAmount & operator-=(MPTAmount const &other)
Definition MPTAmount.cpp:32
MPTAmount operator-() const
Definition MPTAmount.cpp:39
bool operator<(MPTAmount const &other) const
Definition MPTAmount.cpp:57
value_type value_
Definition MPTAmount.h:45
MPTAmount & operator+=(MPTAmount const &other)
Definition MPTAmount.cpp:25
static MPTAmount minPositiveAmount()
Definition MPTAmount.cpp:63
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25