1#ifndef XRPL_PROTOCOL_STEXCHANGE_H_INCLUDED
2#define XRPL_PROTOCOL_STEXCHANGE_H_INCLUDED
4#include <xrpl/basics/Blob.h>
5#include <xrpl/basics/Buffer.h>
6#include <xrpl/basics/Slice.h>
7#include <xrpl/basics/contract.h>
8#include <xrpl/protocol/SField.h>
9#include <xrpl/protocol/STBlob.h>
10#include <xrpl/protocol/STInteger.h>
11#include <xrpl/protocol/STObject.h>
22template <
class U,
class T>
25template <
class U,
class T>
95template <
class T,
class U>
104 if (
id == STI_NOTPRESENT)
106 auto const u =
dynamic_cast<U const*
>(b);
109 Throw<std::runtime_error>(
"Wrong field type");
118 return get<typename U::value_type>(st, f);
123template <
class U,
class T>
140template <
class =
void>
Like std::vector<char> but better.
std::size_t size() const noexcept
Returns the number of bytes in the buffer.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
A type which can be exported to a well known binary format.
virtual SerializedTypeID getSType() const
std::uint8_t const * data() const
value_type value() const noexcept
STBase const * peekAtPField(SField const &field) const
void makeFieldAbsent(SField const &field)
void set(SOTemplate const &)
An immutable linear range of bytes.
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.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
void erase(STObject &st, TypedField< U > const &f)
Remove a field in an STObject.
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
static std::unique_ptr< STBlob > set(TypedField< STBlob > const &f, Buffer const &t)
static std::unique_ptr< STBlob > set(TypedField< STBlob > const &f, Buffer &&t)
static void get(std::optional< Buffer > &t, STBlob const &u)
static void get(std::optional< value_type > &t, STBlob const &u)
static std::unique_ptr< STBlob > set(TypedField< STBlob > const &f, Slice const &t)
static void get(std::optional< T > &t, STInteger< U > const &u)
static std::unique_ptr< STInteger< U > > set(SField const &f, T const &t)
Convert between serialized type U and C++ type T.
A field with a type known at compile time.