45template <
typename T>
inline T
consume(std::istream& src) {
47 src.read(
reinterpret_cast<char*
>(&val),
sizeof(T));
65template <>
LIBKEEPASS_API std::string consume<std::string>(std::istream& src);
68template <>
LIBKEEPASS_API std::vector<char> consume<std::vector<char>>(std::istream& src);
71template <>
LIBKEEPASS_API std::vector<uint8_t> consume<std::vector<uint8_t>>(std::istream& src);
81template <
typename T>
void conserve(std::ostream& dst,
const T& val) {
82 dst.write(
reinterpret_cast<const char*
>(&val),
sizeof(T));
86template <>
LIBKEEPASS_API void conserve<std::string>(std::ostream& dst,
const std::string& val);
90LIBKEEPASS_API void conserve<std::vector<char>>(std::ostream& dst,
const std::vector<char>& val);
95 const std::vector<uint8_t>& val);
107using ::keepass::array_iostreambuf;
108using ::keepass::encrypt_ostreambuf;
109using ::keepass::gzip_istreambuf;
110using ::keepass::gzip_ostreambuf;
111using ::keepass::hashed_istreambuf;
112using ::keepass::hashed_ostreambuf;
113using ::keepass::hmac_istreambuf;
114using ::keepass::hmac_ostreambuf;
Thrown for input/output errors while reading or writing databases.
Definition exception.hh:147
Exception types thrown by the library.
Visibility/export macro for the shared library.
#define LIBKEEPASS_API
Marks a class, function or variable as part of the public ABI.
Definition export.hh:43
LIBKEEPASS_API std::streamsize RemainingBytes(std::istream &src)
Returns the number of bytes available from the current position of the stream up to its end,...
T consume(std::istream &src)
Reads and returns a value of type T from the stream.
Definition io.hh:45
void conserve(std::ostream &dst, const T &val)
Writes a value of type T to the stream.
Definition io.hh:81
Stream buffer adapters for hashed, HMAC, and gzip I/O.