PageRenderTime 35ms CodeModel.GetById 27ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/ghost-legacy/packed.h

http://ghostcb.googlecode.com/
C++ Header | 79 lines | 47 code | 10 blank | 22 comment | 0 complexity | e15d71b64e6ebc311c46a309c8282292 MD5 | raw file
 1/*
 2
 3   Copyright [2008] [Trevor Hogan]
 4
 5   Licensed under the Apache License, Version 2.0 (the "License");
 6   you may not use this file except in compliance with the License.
 7   You may obtain a copy of the License at
 8
 9       http://www.apache.org/licenses/LICENSE-2.0
10
11   Unless required by applicable law or agreed to in writing, software
12   distributed under the License is distributed on an "AS IS" BASIS,
13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16
17   CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
18
19*/
20
21#ifndef PACKED_H
22#define PACKED_H
23
24//
25// CPacked
26//
27
28class CCRC32;
29
30class CPacked
31{
32public:
33	CCRC32 *m_CRC;
34
35protected:
36	bool m_Valid;
37	string m_Compressed;
38	string m_Decompressed;
39	uint32_t m_HeaderSize;
40	uint32_t m_CompressedSize;
41	uint32_t m_HeaderVersion;
42	uint32_t m_DecompressedSize;
43	uint32_t m_NumBlocks;
44	uint32_t m_War3Identifier;
45	uint32_t m_War3Version;
46	uint16_t m_BuildNumber;
47	uint16_t m_Flags;
48	uint32_t m_ReplayLength;
49
50public:
51	CPacked( );
52	virtual ~CPacked( );
53
54	virtual bool GetValid( )				{ return m_Valid; }
55	virtual uint32_t GetHeaderSize( )		{ return m_HeaderSize; }
56	virtual uint32_t GetCompressedSize( )	{ return m_CompressedSize; }
57	virtual uint32_t GetHeaderVersion( )	{ return m_HeaderVersion; }
58	virtual uint32_t GetDecompressedSize( )	{ return m_DecompressedSize; }
59	virtual uint32_t GetNumBlocks( )		{ return m_NumBlocks; }
60	virtual uint32_t GetWar3Identifier( )	{ return m_War3Identifier; }
61	virtual uint32_t GetWar3Version( )		{ return m_War3Version; }
62	virtual uint16_t GetBuildNumber( )		{ return m_BuildNumber; }
63	virtual uint16_t GetFlags( )			{ return m_Flags; }
64	virtual uint32_t GetReplayLength( )		{ return m_ReplayLength; }
65
66	virtual void SetWar3Version( uint32_t nWar3Version )			{ m_War3Version = nWar3Version; }
67	virtual void SetBuildNumber( uint16_t nBuildNumber )			{ m_BuildNumber = nBuildNumber; }
68	virtual void SetFlags( uint16_t nFlags )						{ m_Flags = nFlags; }
69	virtual void SetReplayLength( uint32_t nReplayLength )			{ m_ReplayLength = nReplayLength; }
70
71	virtual void Load( string fileName, bool allBlocks );
72	virtual bool Save( bool TFT, string fileName );
73	virtual bool Extract( string inFileName, string outFileName );
74	virtual bool Pack( bool TFT, string inFileName, string outFileName );
75	virtual void Decompress( bool allBlocks );
76	virtual void Compress( bool TFT );
77};
78
79#endif