OpenMoHAA
0.82.1
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
{
38
public
:
39
MemArchiver();
40
~MemArchiver();
41
42
void
SetupForWriting(
size_t
initialSize);
43
void
SetupForReading(
byte
*buffer,
size_t
size);
44
void
SetBaseTime(
unsigned
int
time);
45
size_t
BufferSize()
const
;
46
byte
*ConfiscateBuffer();
47
bool
IsReading()
const
;
48
bool
IsWriting()
const
;
49
bool
FinishedReading()
const
;
50
51
void
ArchiveByte(
byte
*value);
52
void
ArchiveBoolean(qboolean *value);
53
void
ArchiveChar(
char
*value);
54
void
ArchiveUChar(
unsigned
char
*value);
55
void
ArchiveShort(
short
*value);
56
void
ArchiveInteger(
int
*value);
57
void
ArchiveSize(
size_t
*value);
58
void
ArchiveFloat(
float
*value);
59
void
ArchiveVec3(vec3_t value);
60
void
ArchiveVector(
Vector
*value);
61
void
ArchiveString(
str
*value);
62
void
ArchiveTime(
int
*value);
63
void
ArchiveRaw(
void
*buffer,
size_t
size);
64
void
ArchiveReadRaw(
void
*buffer,
size_t
size);
65
void
ArchiveWriteRaw(
const
void
*buffer,
size_t
size);
66
67
private
:
68
archiverState_e state;
69
byte
*buffer;
70
size_t
bufferSize;
71
size_t
allocatedSize;
72
int
svsTime;
73
};
Vector
Definition
vector.h:61
str
Definition
str.h:77
code
cgame
memarchiver.h
Generated by
1.13.2