2013-04-23 08:28:39 +00:00
|
|
|
//===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains basic functions for compression/uncompression.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_SUPPORT_COMPRESSION_H
|
|
|
|
#define LLVM_SUPPORT_COMPRESSION_H
|
|
|
|
|
|
|
|
#include "llvm/Support/DataTypes.h"
|
2014-03-06 05:51:42 +00:00
|
|
|
#include <memory>
|
2014-04-05 21:26:44 +00:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2013-04-23 08:28:39 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class StringRef;
|
|
|
|
|
|
|
|
namespace zlib {
|
|
|
|
|
|
|
|
enum CompressionLevel {
|
|
|
|
NoCompression,
|
|
|
|
DefaultCompression,
|
|
|
|
BestSpeedCompression,
|
|
|
|
BestSizeCompression
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Status {
|
|
|
|
StatusOK,
|
2014-01-24 17:20:08 +00:00
|
|
|
StatusUnsupported, // zlib is unavailable
|
|
|
|
StatusOutOfMemory, // there was not enough memory
|
|
|
|
StatusBufferTooShort, // there was not enough room in the output buffer
|
|
|
|
StatusInvalidArg, // invalid input parameter
|
|
|
|
StatusInvalidData // data was corrupted or incomplete
|
2013-04-23 08:28:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
bool isAvailable();
|
|
|
|
|
2014-04-05 21:53:04 +00:00
|
|
|
Status compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
|
2013-04-23 08:28:39 +00:00
|
|
|
CompressionLevel Level = DefaultCompression);
|
|
|
|
|
|
|
|
Status uncompress(StringRef InputBuffer,
|
2014-04-05 21:26:44 +00:00
|
|
|
SmallVectorImpl<char> &UncompressedBuffer,
|
2013-04-23 08:28:39 +00:00
|
|
|
size_t UncompressedSize);
|
|
|
|
|
2013-08-14 16:03:29 +00:00
|
|
|
uint32_t crc32(StringRef Buffer);
|
|
|
|
|
2013-04-23 08:28:39 +00:00
|
|
|
} // End of namespace zlib
|
|
|
|
|
|
|
|
} // End of namespace llvm
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|