TrinityCore
Loading...
Searching...
No Matches
cascfile.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef MPQ_H
19#define MPQ_H
20
21#include "CascHandles.h"
22#include <memory>
23#include <string>
24
26{
27 bool eof;
28 char *buffer;
29 size_t pointer,size;
30
31 // disable copying
32 CASCFile(const CASCFile &f) = delete;
33 CASCFile& operator=(const CASCFile &f) = delete;
34
35public:
36 CASCFile(std::shared_ptr<CASC::Storage const> casc, const char* filename, bool warnNoExist = true); // filenames are not case sensitive
37 CASCFile(std::shared_ptr<CASC::Storage const> casc, uint32 fileDataId, std::string const& description, bool warnNoExist = true);
39 void init(CASC::File* file, const char* description);
40 size_t read(void* dest, size_t bytes);
41 size_t getSize() { return size; }
42 size_t getPos() { return pointer; }
43 char* getBuffer() { return buffer; }
44 char* getPointer() { return buffer + pointer; }
45 bool isEof() { return eof; }
46 void seek(int offset);
47 void seekRelative(int offset);
48 void close();
49};
50
51#endif
uint32_t uint32
Definition Define.h:154
char * buffer
Definition cascfile.h:28
~CASCFile()
Definition cascfile.h:38
bool eof
Definition cascfile.h:27
void seekRelative(int offset)
Definition cascfile.cpp:105
bool isEof()
Definition cascfile.h:45
CASCFile(const CASCFile &f)=delete
char * getPointer()
Definition cascfile.h:44
void seek(int offset)
Definition cascfile.cpp:99
size_t size
Definition cascfile.h:29
size_t read(void *dest, size_t bytes)
Definition cascfile.cpp:80
size_t pointer
Definition cascfile.h:29
size_t getPos()
Definition cascfile.h:42
char * getBuffer()
Definition cascfile.h:43
CASCFile & operator=(const CASCFile &f)=delete
size_t getSize()
Definition cascfile.h:41
void init(CASC::File *file, const char *description)
Definition cascfile.cpp:58
void close()
Definition cascfile.cpp:111