-
Notifications
You must be signed in to change notification settings - Fork 0
/
minecraft_object.h
70 lines (52 loc) · 1.61 KB
/
minecraft_object.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef MINECRAFT_OBJECT_H
#define MINECRAFT_OBJECT_H
#include <QString>
#include "mc_variable.h"
#include "mc_hash.h"
//A minecraft object
class MinecraftObject : public McHash<McVariable>
{
public:
//Default size
static const int DEFAULT_SIZE = 65536;
//Holds my buffer size, used for inserting names
static const int NAME_BUFFER_SIZE = 256;
private:
//Holds the name
QString Name;
//Holds a buffer for outputing values
char Tmp[ NAME_BUFFER_SIZE];
//Loads my endian specific data into memory
void loadShort( short v, char* buf );
void loadInt( int v, char* buf );
void loadLong( qlonglong v, char* buf );
void loadFloat( float v, char* buf );
void loadDouble( double v, char* buf );
//Used to make offsets when printing
void offset( int depth );
public:
//Construct a minecraft object from a hash
MinecraftObject();
//Construct a minecraft object from a hash
MinecraftObject( McVariable& obj );
//Store the object name
void storeName( QString name );
//Read back the name
QString name();
//Dump the contents of this file
void dump();
private:
//Dump the contents of this file
void dumpHash( McHash<McVariable>* hash, int depth );
//Dump the contents of this list
void dumpList( McList<McVariable>& list, int depth );
public:
//Load the contence of the object into a byte array
int load( QByteArray& data );
private:
//Dump the contents of this file
void loadHash( QByteArray& data, McHash<McVariable>* hash );
//Dump the contents of this list
void loadList( QByteArray& data, McList<McVariable>& list );
};
#endif