summaryrefslogtreecommitdiff
path: root/replay/compression.h
blob: 4807f23b56581af4a7229e1734926a108045cae5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//

#ifndef COMPRESSION_H
#define COMPRESSION_H

//----------------------------------------------------------------------------------------

#include "platform.h"

//----------------------------------------------------------------------------------------

class ICompressor
{
public:
	virtual ~ICompressor() {}
	virtual bool	Compress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
	virtual bool	Decompress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;

	virtual int		GetEstimatedCompressionSize( unsigned int nSourceLen ) = 0;
};

//----------------------------------------------------------------------------------------

enum CompressorType_t
{
	COMPRESSORTYPE_INVALID = -1,

	COMPRESSORTYPE_LZSS,
	COMPRESSORTYPE_BZ2,

	NUM_COMPRESSOR_TYPES
};

//----------------------------------------------------------------------------------------

extern const char *g_pCompressorTypes[ NUM_COMPRESSOR_TYPES ];

//----------------------------------------------------------------------------------------

ICompressor *CreateCompressor( CompressorType_t nType );
const char *GetCompressorNameSafe( CompressorType_t nType );

//----------------------------------------------------------------------------------------

#endif // COMPRESSION_H