1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include "MapResourceManager.h"
#include "ifilesystem.h"
#include "ifiletypes.h"
#include "itextstream.h"
#include "os/path.h"
#include "module/StaticModule.h"
#include "MapResource.h"
#include "ArchivedMapResource.h"
#include "VersionControlLib.h"
#include "VcsMapResource.h"
namespace map
{
IMapResourcePtr MapResourceManager::createFromPath(const std::string& path)
{
if (vcs::pathIsVcsUri(path))
{
return std::make_shared<VcsMapResource>(path);
}
return std::make_shared<MapResource>(path);
}
IMapResourcePtr MapResourceManager::createFromArchiveFile(const std::string& archivePath,
const std::string& filePathWithinArchive)
{
return std::make_shared<ArchivedMapResource>(archivePath, filePathWithinArchive);
}
MapResourceManager::ExportEvent& MapResourceManager::signal_onResourceExporting()
{
return _resourceExporting;
}
MapResourceManager::ExportEvent& MapResourceManager::signal_onResourceExported()
{
return _resourceExported;
}
const std::string& MapResourceManager::getName() const
{
static std::string _name(MODULE_MAPRESOURCEMANAGER);
return _name;
}
const StringSet& MapResourceManager::getDependencies() const
{
static StringSet _dependencies;
if (_dependencies.empty())
{
_dependencies.insert(MODULE_VIRTUALFILESYSTEM);
_dependencies.insert(MODULE_FILETYPES);
_dependencies.insert("Doom3MapLoader");
}
return _dependencies;
}
void MapResourceManager::initialiseModule(const IApplicationContext& ctx)
{
}
// Define the MapResourceManager registerable module
module::StaticModuleRegistration<MapResourceManager> mapResourceManagerModule;
} // namespace
|