V-Gears 0
Free Final Fantasy VII engine.
VGearsMapListFile.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 <OgreResourceManager.h>
19#include "VGearsPrerequisites.h"
21#include "VGearsSerializer.h"
22
23namespace VGears{
24
29 public Ogre::ResourceManager, public Ogre::Singleton<MapListFileManager>
30 {
31
32 // TODO: Move to it's own file?
33
34 public:
35
40
44 virtual ~MapListFileManager();
45
50
55
56 protected:
57
75 virtual Ogre::Resource *createImpl(
76 const Ogre::String &name, Ogre::ResourceHandle handle,
77 const Ogre::String &group, bool is_manual,
78 Ogre::ManualResourceLoader *loader,
79 const Ogre::NameValuePairList *create_params
80 ) override;
81 };
82
86 class MapListFile : public Resource{
87
88 public:
89
109 Ogre::ResourceManager* creator, const String &name,
110 Ogre::ResourceHandle handle, const String& group,
111 bool is_manual = false,
112 Ogre::ManualResourceLoader* loader = nullptr
113 );
114
118 virtual ~MapListFile();
119
123 static const String RESOURCE_TYPE;
124
130 const std::vector<std::string> GetMapList() const{return map_list_;}
131
132 protected:
133
137 virtual void loadImpl() override;
138
142 virtual void unloadImpl() override;
143
150 virtual size_t calculateSize(void) const override;
151
152 private:
153
155
159 std::vector<std::string> map_list_;
160 };
161
166
167 // TODO: Move to it's own file?
168
169 public:
170
175
183 Ogre::DataStreamPtr &stream, MapListFile& dest
184 );
185 };
186
187 typedef Ogre::SharedPtr<MapListFile> MapListFilePtr;
188}
A manager for map list files.
Definition: VGearsMapListFile.h:30
static MapListFileManager & GetSingleton()
Retrieves a singleton to the manager.
Definition: VGearsMapListFile.cpp:45
MapListFileManager()
Constructor.
Definition: VGearsMapListFile.cpp:29
virtual Ogre::Resource * createImpl(const Ogre::String &name, Ogre::ResourceHandle handle, const Ogre::String &group, bool is_manual, Ogre::ManualResourceLoader *loader, const Ogre::NameValuePairList *create_params) override
Loads the manager.
Definition: VGearsMapListFile.cpp:78
virtual ~MapListFileManager()
Destructor.
Definition: VGearsMapListFile.cpp:39
static MapListFileManager * GetSingletonPtr()
Retrieves a pointer to the manager singleton.
Definition: VGearsMapListFile.cpp:50
Handles the serialization of map list files.
Definition: VGearsMapListFile.h:165
void ImportMapListFile(Ogre::DataStreamPtr &stream, MapListFile &dest)
Imports a map list file.
Definition: VGearsMapListFile.cpp:87
MapListFileSerializer()=default
Constructor.
Handles map list files.
Definition: VGearsMapListFile.h:86
const std::vector< std::string > GetMapList() const
Retrieves the list of maps.
Definition: VGearsMapListFile.h:130
std::vector< std::string > map_list_
The list of maps.
Definition: VGearsMapListFile.h:159
virtual ~MapListFile()
Destructor.
Definition: VGearsMapListFile.cpp:62
virtual void loadImpl() override
Loads the file.
Definition: VGearsMapListFile.cpp:64
virtual size_t calculateSize(void) const override
Calculates the size of the map list.
Definition: VGearsMapListFile.cpp:72
MapListFile(Ogre::ResourceManager *creator, const String &name, Ogre::ResourceHandle handle, const String &group, bool is_manual=false, Ogre::ManualResourceLoader *loader=nullptr)
Constructor.
Definition: VGearsMapListFile.cpp:54
virtual void unloadImpl() override
Unloads the file.
Definition: VGearsMapListFile.cpp:70
static const String RESOURCE_TYPE
The type of resource.
Definition: VGearsMapListFile.h:123
A resource.
Definition: VGearsResource.h:29
Handles file serialization.
Definition: VGearsSerializer.h:30
Definition: FF7NameLookup.h:24
Ogre::SharedPtr< MapListFile > MapListFilePtr
Definition: VGearsMapListFile.h:187
Ogre::String String
Definition: TypeDefine.h:37