OpenXcom
1.0
Open-source clone of the original X-Com
src
Engine
CatFile.h
1
/*
2
* Copyright 2010-2014 OpenXcom Developers.
3
*
4
* This file is part of OpenXcom.
5
*
6
* OpenXcom is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* OpenXcom is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef OPENXCOM_CATFILE_H
21
#define OPENXCOM_CATFILE_H
22
23
#include <fstream>
24
25
namespace
OpenXcom
26
{
27
31
class
CatFile
:
protected
std::ifstream
32
{
33
private
:
34
unsigned
int
_amount, *_offset, *_size;
35
public
:
37
CatFile
(
const
char
*path);
39
~CatFile
();
41
bool
operator !
()
const
42
{
43
return
std::ifstream::operator!();
44
}
46
int
getAmount
()
const
47
{
48
return
_amount;
49
}
51
unsigned
int
getObjectSize
(
unsigned
int
i)
const
52
{
53
return
(i < _amount) ? _size[i] : 0;
54
}
56
char
*
load
(
unsigned
int
i,
bool
name =
false
);
57
};
58
59
}
60
61
#endif
OpenXcom
COPYING:
Definition:
BaseInfoState.cpp:41
OpenXcom::CatFile::operator!
bool operator!() const
Inherit operator.
Definition:
CatFile.h:41
OpenXcom::CatFile::~CatFile
~CatFile()
Cleans up the stream.
Definition:
CatFile.cpp:62
OpenXcom::CatFile
Subclass of std::ifstream to handle CAT files.
Definition:
CatFile.h:32
OpenXcom::CatFile::getObjectSize
unsigned int getObjectSize(unsigned int i) const
Get object size.
Definition:
CatFile.h:51
OpenXcom::CatFile::load
char * load(unsigned int i, bool name=false)
Load an object into memory.
Definition:
CatFile.cpp:76
OpenXcom::CatFile::getAmount
int getAmount() const
Get amount of objects.
Definition:
CatFile.h:46
OpenXcom::CatFile::CatFile
CatFile(const char *path)
Creates a CAT file stream.
Definition:
CatFile.cpp:32
Generated by
1.8.20