1#include <xrpl/conditions/Fulfillment.h>
3#include <xrpl/basics/Slice.h>
4#include <xrpl/basics/safe_cast.h>
5#include <xrpl/conditions/Condition.h>
6#include <xrpl/conditions/detail/PreimageSha256.h>
7#include <xrpl/conditions/detail/error.h>
8#include <xrpl/conditions/detail/utils.h>
62 auto const p = parsePreamble(s, ec);
67 if (!isConstructed(p) || !isContextSpecific(p))
73 if (p.length > s.
size())
79 if (p.length < s.
size())
93 using TagType =
decltype(p.tag);
An immutable linear range of bytes.
std::size_t length() const noexcept
bool empty() const noexcept
Return true if the byte range is empty.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
std::size_t size() const noexcept
Returns the number of bytes in the storage.
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Parse the payload for a PreimageSha256 condition.
bool match(Fulfillment const &f, Condition const &c)
Determine whether the given fulfillment and condition match.
bool validate(Fulfillment const &f, Condition const &c, Slice m)
Verify if the given message satisfies the fulfillment.
constexpr std::enable_if_t< std::is_integral_v< Dest > &&std::is_integral_v< Src >, Dest > safeCast(Src s) noexcept
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Load a fulfillment from its binary form.
virtual Condition condition() const =0
Returns the condition associated with the given fulfillment.
virtual Type type() const =0
Returns the type of this condition.
virtual bool validate(Slice data) const =0
Validates a fulfillment.
static constexpr std::size_t kMaxSerializedFulfillment
The largest binary fulfillment we support.