2013-05-04 13:14:23 +00:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "CMappedFileLoader.h"
|
|
|
|
#include "CResourceLoader.h"
|
|
|
|
#include "../JsonNode.h"
|
|
|
|
|
|
|
|
CMappedFileLoader::CMappedFileLoader(const JsonNode &config)
|
|
|
|
{
|
2013-06-29 13:05:48 +00:00
|
|
|
for(auto entry : config.Struct())
|
2013-05-04 13:14:23 +00:00
|
|
|
{
|
|
|
|
fileList[ResourceID(entry.first)] = entry.second.String();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<CInputStream> CMappedFileLoader::load(const std::string & resourceName) const
|
|
|
|
{
|
|
|
|
return CResourceHandler::get()->load(ResourceID(resourceName));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CMappedFileLoader::existsEntry(const std::string & resourceName) const
|
|
|
|
{
|
2013-06-29 13:05:48 +00:00
|
|
|
for(auto & elem : fileList)
|
2013-05-04 13:14:23 +00:00
|
|
|
{
|
2013-06-29 13:05:48 +00:00
|
|
|
if(elem.second == resourceName)
|
2013-05-04 13:14:23 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-06-29 13:05:48 +00:00
|
|
|
std::unordered_map<ResourceID, std::string> CMappedFileLoader::getEntries() const
|
2013-05-04 13:14:23 +00:00
|
|
|
{
|
|
|
|
return fileList;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string CMappedFileLoader::getOrigin() const
|
|
|
|
{
|
|
|
|
return ""; // does not have any meaning with this type of data source
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string CMappedFileLoader::getFullName(const std::string & resourceName) const
|
|
|
|
{
|
|
|
|
return CResourceHandler::get()->getResourceName(ResourceID(resourceName));
|
|
|
|
}
|