OpenMoHAA
0.82.0
Loading...
Searching...
No Matches
memarchiver.h
1
/*
2
===========================================================================
3
Copyright (C) 2023 the OpenMoHAA team
4
5
This file is part of OpenMoHAA source code.
6
7
OpenMoHAA source code is free software; you can redistribute it
8
and/or modify it under the terms of the GNU General Public License as
9
published by the Free Software Foundation; either version 2 of the License,
10
or (at your option) any later version.
11
12
OpenMoHAA source code is distributed in the hope that it will be
13
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with OpenMoHAA source code; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
===========================================================================
21
*/
22
23
// DESCRIPTION:
24
// In-memory archiver
25
26
#include "cg_local.h"
27
28
class
Vector
;
29
class
str
;
30
31
typedef
enum
{
32
MEMARC_WRITING,
33
MEMARC_READING
34
} archiverState_e;
35
36
class
MemArchiver {
37
public
:
38
MemArchiver();
39
~MemArchiver();
40
41
void
SetupForWriting(
size_t
initialSize);
42
void
SetupForReading(
byte
* buffer,
size_t
size);
43
void
SetBaseTime(
unsigned
int
time);
44
size_t
BufferSize()
const
;
45
byte
* ConfiscateBuffer();
46
bool
IsReading()
const
;
47
bool
IsWriting()
const
;
48
bool
FinishedReading()
const
;
49
50
void
ArchiveByte(
byte
* value);
51
void
ArchiveBoolean(qboolean* value);
52
void
ArchiveChar(
char
* value);
53
void
ArchiveUChar(
unsigned
char
* value);
54
void
ArchiveShort(
short
* value);
55
void
ArchiveInteger(
int
* value);
56
void
ArchiveSize(
size_t
* value);
57
void
ArchiveFloat(
float
* value);
58
void
ArchiveVec3(vec3_t value);
59
void
ArchiveVector(
Vector
* value);
60
void
ArchiveString(
str
* value);
61
void
ArchiveTime(
int
* value);
62
void
ArchiveRaw(
void
* buffer,
size_t
size);
63
void
ArchiveReadRaw(
void
* buffer,
size_t
size);
64
void
ArchiveWriteRaw(
const
void
* buffer,
size_t
size);
65
66
private
:
67
archiverState_e state;
68
byte
* buffer;
69
size_t
bufferSize;
70
size_t
allocatedSize;
71
int
svsTime;
72
};
Vector
Definition
vector.h:61
str
Definition
str.h:77
code
cgame
memarchiver.h
Generated by
1.13.2