]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/llvm/include/llvm/Support/Compression.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / llvm / include / llvm / Support / Compression.h
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
19 namespace llvm {
20
21 class MemoryBuffer;
22 template<typename T> class OwningPtr;
23 class StringRef;
24
25 namespace zlib {
26
27 enum CompressionLevel {
28   NoCompression,
29   DefaultCompression,
30   BestSpeedCompression,
31   BestSizeCompression
32 };
33
34 enum Status {
35   StatusOK,
36   StatusUnsupported,  // zlib is unavaliable
37   StatusOutOfMemory,  // there was not enough memory
38   StatusBufferTooShort,  // there was not enough room in the output buffer
39   StatusInvalidArg,  // invalid input parameter
40   StatusInvalidData  // data was corrupted or incomplete
41 };
42
43 bool isAvailable();
44
45 Status compress(StringRef InputBuffer,
46                 OwningPtr<MemoryBuffer> &CompressedBuffer,
47                 CompressionLevel Level = DefaultCompression);
48
49 Status uncompress(StringRef InputBuffer,
50                   OwningPtr<MemoryBuffer> &UncompressedBuffer,
51                   size_t UncompressedSize);
52
53 }  // End of namespace zlib
54
55 } // End of namespace llvm
56
57 #endif
58