LLVM  4.0.0
Compression.h
Go to the documentation of this file.
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 template <typename T> class SmallVectorImpl;
21 class StringRef;
22 
23 namespace zlib {
24 
30 };
31 
32 enum Status {
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 
41 bool isAvailable();
42 
43 Status compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
45 
46 Status uncompress(StringRef InputBuffer, char *UncompressedBuffer,
47  size_t &UncompressedSize);
48 
49 Status uncompress(StringRef InputBuffer,
50  SmallVectorImpl<char> &UncompressedBuffer,
51  size_t UncompressedSize);
52 
53 uint32_t crc32(StringRef Buffer);
54 
55 } // End of namespace zlib
56 
57 } // End of namespace llvm
58 
59 #endif
60 
Status compress(StringRef InputBuffer, SmallVectorImpl< char > &CompressedBuffer, CompressionLevel Level=DefaultCompression)
Definition: Compression.cpp:49
Status uncompress(StringRef InputBuffer, char *UncompressedBuffer, size_t &UncompressedSize)
Definition: Compression.cpp:65
bool isAvailable()
Definition: Compression.cpp:48
uint32_t crc32(StringRef Buffer)
Definition: Compression.cpp:86
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47