|
xrpld
|


Static Public Member Functions | |
| static bool | sane (Buffer const &b) |
| static void | checkEmptyAfterMove (Buffer const &buf) |
| Check the state Buffer documents for a moved-from buffer: "the other buffer is reset", i.e. | |
Public Attributes | |
| Buffer const | emptyBuffer |
| Buffer const | firstHalf {kRandomData.data(), kHalf} |
| Buffer const | secondHalf {kRandomData.data() + kHalf, kHalf} |
| Buffer const | whole {kRandomData.data(), kRandomData.size()} |
Static Public Attributes | |
| static constexpr auto | kRandomData |
| static constexpr std::size_t | kHalf = kRandomData.size() / 2 |
Definition at line 19 of file Buffer.cpp.
|
static |
Definition at line 29 of file Buffer.cpp.
|
static |
Check the state Buffer documents for a moved-from buffer: "the other buffer is reset", i.e.
empty and sane.
Zeroing the size is not incidental tidiness. Moving the member unique_ptr nulls the data pointer whether Buffer wants it or not, so a moved-from buffer that kept its old size would lie about itself everywhere: alloc() would take its n == size_ early-out and hand back a null pointer while still reporting the old size, fill() would run std::fill_n over a null pointer, and the Slice conversion would publish {nullptr, oldSize} to callers. A moved-from Buffer has to be a usable empty Buffer rather than a landmine, which is why the tests below assert this state instead of treating a moved-from buffer as untouchable.
Definition at line 50 of file Buffer.cpp.
|
staticconstexpr |
Definition at line 21 of file Buffer.cpp.
|
staticconstexpr |
Definition at line 26 of file Buffer.cpp.
| Buffer const xrpl::test::BufferTest::emptyBuffer |
Definition at line 56 of file Buffer.cpp.
Definition at line 57 of file Buffer.cpp.
Definition at line 58 of file Buffer.cpp.
| Buffer const xrpl::test::BufferTest::whole {kRandomData.data(), kRandomData.size()} |
Definition at line 59 of file Buffer.cpp.