diff options
Diffstat (limited to 'include/bsdiff/compressor_interface.h')
-rw-r--r-- | include/bsdiff/compressor_interface.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/bsdiff/compressor_interface.h b/include/bsdiff/compressor_interface.h new file mode 100644 index 0000000..c0ff18d --- /dev/null +++ b/include/bsdiff/compressor_interface.h @@ -0,0 +1,40 @@ +// Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _BSDIFF_COMPRESSOR_INTERFACE_H_ +#define _BSDIFF_COMPRESSOR_INTERFACE_H_ + +#include <stddef.h> +#include <stdint.h> + +#include <memory> +#include <vector> + +#include "bsdiff/constants.h" + +namespace bsdiff { + +class CompressorInterface { + public: + virtual ~CompressorInterface() = default; + + // Compress and write |size| bytes of input data starting from |buf|. + virtual bool Write(const uint8_t* buf, size_t size) = 0; + + // Finish the compression step. + virtual bool Finish() = 0; + + // Return the compressed data. This method must be only called after Finish(). + virtual const std::vector<uint8_t>& GetCompressedData() = 0; + + // Return the type of the current compressor. + virtual CompressorType Type() const = 0; + + protected: + CompressorInterface() = default; +}; + +} // namespace bsdiff + +#endif // _BSDIFF_COMPRESSOR_INTERFACE_H_ |