blob: 976ffa2f57cdab27f27ba97c170e27249ab1748a (
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
48
49
50
51
52
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
//
// MessageBuffer - handy for packing and upacking
// structures to be sent as messages
//
#ifndef _MESSAGEBUFFER
#define _MESSAGEBUFFER
#include <stdio.h>
#define DEFAULT_MESSAGE_BUFFER_SIZE 2048
class MessageBuffer {
public:
char * data;
MessageBuffer();
MessageBuffer(int size);
~MessageBuffer();
int getSize();
int getLen();
int setLen(int len);
int getOffset();
int setOffset(int offset);
int write(void const * p, int bytes);
int update(int loc, void const * p, int bytes);
int extract(int loc, void * p, int bytes);
int read(void * p, int bytes);
int WriteString( const char *pString );
int ReadString( char *pOut, int bufferLength );
void clear();
void clear(int minsize);
void reset(int minsize);
void print(FILE * ofile, int num);
private:
void resize(int minsize);
int size;
int offset;
int len;
};
#endif
|