LLVM API Documentation

Compression.h
Go to the documentation of this file.
00001 //===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains basic functions for compression/uncompression.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_SUPPORT_COMPRESSION_H
00015 #define LLVM_SUPPORT_COMPRESSION_H
00016 
00017 #include "llvm/Support/DataTypes.h"
00018 #include <memory>
00019 #include "llvm/ADT/SmallVector.h"
00020 
00021 namespace llvm {
00022 
00023 class StringRef;
00024 
00025 namespace zlib {
00026 
00027 enum CompressionLevel {
00028   NoCompression,
00029   DefaultCompression,
00030   BestSpeedCompression,
00031   BestSizeCompression
00032 };
00033 
00034 enum Status {
00035   StatusOK,
00036   StatusUnsupported,    // zlib is unavailable
00037   StatusOutOfMemory,    // there was not enough memory
00038   StatusBufferTooShort, // there was not enough room in the output buffer
00039   StatusInvalidArg,     // invalid input parameter
00040   StatusInvalidData     // data was corrupted or incomplete
00041 };
00042 
00043 bool isAvailable();
00044 
00045 Status compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
00046                 CompressionLevel Level = DefaultCompression);
00047 
00048 Status uncompress(StringRef InputBuffer,
00049                   SmallVectorImpl<char> &UncompressedBuffer,
00050                   size_t UncompressedSize);
00051 
00052 uint32_t crc32(StringRef Buffer);
00053 
00054 }  // End of namespace zlib
00055 
00056 } // End of namespace llvm
00057 
00058 #endif
00059