V-Gears 0
Free Final Fantasy VII engine.
VGearsLGPArchiveSerializer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include "VGearsSerializer.h"
19#include "VGearsLGPArchive.h"
20
21namespace VGears{
22
27
28 public:
29
34
38 virtual ~LGPArchiveSerializer();
39
46 virtual void ImportLGPArchive(
47 Ogre::DataStreamPtr &stream, LGPArchive* dest
48 );
49
50 enum {
55
60 };
61
63
65
66 protected:
67
73 virtual void ReadFileHeader(Ogre::DataStreamPtr &stream);
74
81 virtual void readObject(
82 Ogre::DataStreamPtr &stream, FileEntry& file_entry
83 );
84
85 template<typename ValueType> void ReadVector(
86 Ogre::DataStreamPtr &stream, std::vector<ValueType> &dest,
87 size_t count
88 ){
89 dest.clear();
90 dest.reserve( count );
91 for (size_t i(count); i --;){
92 ValueType in_tmp;
93 readObject(stream, in_tmp);
94 dest.push_back(in_tmp);
95 }
96 }
97
98 };
99}
Manages LGP archives serialization.
Definition: VGearsLGPArchiveSerializer.h:26
@ MAGIC_STRING_LENGTH
Magic MIME string length.
Definition: VGearsLGPArchiveSerializer.h:54
@ FILE_NAME_LENGTH
Max file name length.
Definition: VGearsLGPArchiveSerializer.h:59
virtual void ImportLGPArchive(Ogre::DataStreamPtr &stream, LGPArchive *dest)
Imports an A file.
Definition: VGearsLGPArchiveSerializer.cpp:26
LGPArchive::FileEntry FileEntry
Definition: VGearsLGPArchiveSerializer.h:62
void ReadVector(Ogre::DataStreamPtr &stream, std::vector< ValueType > &dest, size_t count)
Definition: VGearsLGPArchiveSerializer.h:85
virtual void readObject(Ogre::DataStreamPtr &stream, FileEntry &file_entry)
Reads an object as a LGP archive.
Definition: VGearsLGPArchiveSerializer.cpp:50
LGPArchive::FileList FileList
Definition: VGearsLGPArchiveSerializer.h:64
LGPArchiveSerializer()
Constructor.
Definition: VGearsLGPArchiveSerializer.cpp:22
virtual void ReadFileHeader(Ogre::DataStreamPtr &stream)
Reads an archive header and sets the instance data.
Definition: VGearsLGPArchiveSerializer.cpp:45
virtual ~LGPArchiveSerializer()
Destructor.
Definition: VGearsLGPArchiveSerializer.cpp:24
Handles LZS compressed archives.
Definition: VGearsLGPArchive.h:26
std::vector< FileEntry > FileList
Definition: VGearsLGPArchive.h:204
Handles file serialization.
Definition: VGearsSerializer.h:30
Definition: FF7NameLookup.h:24
A file in a LGP archive.
Definition: VGearsLGPArchive.h:166