Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
1.1 KiB

//========= 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