1//===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains basic functions for compression/uncompression.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_SUPPORT_COMPRESSION_H
15#define LLVM_SUPPORT_COMPRESSION_H
16
17#include "llvm/Support/DataTypes.h"
18
19namespace llvm {
20template <typename T> class SmallVectorImpl;
21class StringRef;
22
23namespace zlib {
24
25enum CompressionLevel {
26  NoCompression,
27  DefaultCompression,
28  BestSpeedCompression,
29  BestSizeCompression
30};
31
32enum Status {
33  StatusOK,
34  StatusUnsupported,    // zlib is unavailable
35  StatusOutOfMemory,    // there was not enough memory
36  StatusBufferTooShort, // there was not enough room in the output buffer
37  StatusInvalidArg,     // invalid input parameter
38  StatusInvalidData     // data was corrupted or incomplete
39};
40
41bool isAvailable();
42
43Status compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
44                CompressionLevel Level = DefaultCompression);
45
46Status uncompress(StringRef InputBuffer,
47                  SmallVectorImpl<char> &UncompressedBuffer,
48                  size_t UncompressedSize);
49
50uint32_t crc32(StringRef Buffer);
51
52}  // End of namespace zlib
53
54} // End of namespace llvm
55
56#endif
57
58