mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-31 06:05:50 +00:00
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d). This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#include <test/jtx/quality.h>
|
|
|
|
#include <xrpl/protocol/Quality.h>
|
|
#include <xrpl/protocol/SField.h>
|
|
|
|
namespace ripple {
|
|
namespace test {
|
|
namespace jtx {
|
|
|
|
qualityInPercent::qualityInPercent(double percent)
|
|
: qIn_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
|
|
{
|
|
assert(percent <= 400 && percent >= 0);
|
|
}
|
|
|
|
qualityOutPercent::qualityOutPercent(double percent)
|
|
: qOut_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
|
|
{
|
|
assert(percent <= 400 && percent >= 0);
|
|
}
|
|
|
|
static void
|
|
insertQualityIntoJtx(SField const& field, std::uint32_t value, JTx& jt)
|
|
{
|
|
jt.jv[field.jsonName] = value;
|
|
}
|
|
|
|
void
|
|
qualityIn::operator()(Env&, JTx& jt) const
|
|
{
|
|
insertQualityIntoJtx(sfQualityIn, qIn_, jt);
|
|
}
|
|
|
|
void
|
|
qualityInPercent::operator()(Env&, JTx& jt) const
|
|
{
|
|
insertQualityIntoJtx(sfQualityIn, qIn_, jt);
|
|
}
|
|
|
|
void
|
|
qualityOut::operator()(Env&, JTx& jt) const
|
|
{
|
|
insertQualityIntoJtx(sfQualityOut, qOut_, jt);
|
|
}
|
|
|
|
void
|
|
qualityOutPercent::operator()(Env&, JTx& jt) const
|
|
{
|
|
insertQualityIntoJtx(sfQualityOut, qOut_, jt);
|
|
}
|
|
|
|
} // namespace jtx
|
|
} // namespace test
|
|
} // namespace ripple
|