diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-06-12 16:15:37 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-06-12 16:15:37 +0100 |
commit | 6fe3b7eb73fb11e1cba27b28add5b14430b66259 (patch) | |
tree | e2e526e4f5593cb8d978f1b8955b80c9c2d88b4e /include/axolotl/account.hh | |
parent | 28541dd82a9e4a99661ba32905b8488d35e70fe3 (diff) |
Move utils for pickling into a separate file
Diffstat (limited to 'include/axolotl/account.hh')
-rw-r--r-- | include/axolotl/account.hh | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/include/axolotl/account.hh b/include/axolotl/account.hh index dd9c819..0e65a7e 100644 --- a/include/axolotl/account.hh +++ b/include/axolotl/account.hh @@ -41,22 +41,24 @@ struct Account { LocalKey const * lookup_key( std::uint32_t id ); +}; - /** The number of bytes needed to persist this account. */ - std::size_t pickle_length(); - /** Persists an account as a sequence of bytes - * Returns the number of output bytes used. */ - std::size_t pickle( - std::uint8_t * output, std::size_t output_length - ); +std::size_t pickle_length( + Account const & value +); - /** Loads an account from a sequence of bytes. - * Returns 0 on success, or std::size_t(-1) on failure. */ - std::size_t unpickle( - std::uint8_t * input, std::size_t input_length - ); -}; + +std::uint8_t * pickle( + std::uint8_t * pos, + Account const & value +); + + +std::uint8_t const * unpickle( + std::uint8_t const * pos, std::uint8_t const * end, + Account & value +); } // namespace axolotl |