forked from hitmen047/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkvpacker.h
49 lines (42 loc) · 1.31 KB
/
kvpacker.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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef KVPACKER_H
#define KVPACKER_H
#ifdef _WIN32
#pragma once
#endif
#include "KeyValues.h"
//-----------------------------------------------------------------------------
// Purpose: Handles packing KeyValues binary packing and unpacking in a a
// consistent way across all branches, including Steam. If you change
// this packing format you need to do so in a backward compatible way
// so that the Steam servers and all the various GCs can still talk to
// each other.
//-----------------------------------------------------------------------------
class KVPacker
{
public:
bool WriteAsBinary( KeyValues *pNode, CUtlBuffer &buffer );
bool ReadAsBinary( KeyValues *pNode, CUtlBuffer &buffer );
private:
// These types are used for serialization of KeyValues nodes.
// Do not renumber them or you will break serialization across
// branches.
enum EPackType
{
PACKTYPE_NONE = 0,
PACKTYPE_STRING,
PACKTYPE_INT,
PACKTYPE_FLOAT,
PACKTYPE_PTR,
PACKTYPE_WSTRING,
PACKTYPE_COLOR,
PACKTYPE_UINT64,
PACKTYPE_NULLMARKER, // used to mark the end of a block in the binary format
};
};
#endif // KVPACKER_H