1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00
vcmi/lib/filesystem/CMappedFileLoader.cpp
Ivan Savenko f82122d9be second part of c++11 update. gcc 4.5 and VS 2010 are no longer supported
- BOOST_FOREACH -> for
- replaced several boost classes with std (e.g. unordered)
- removed gcc-4.5 workarounds
- ran clang c++11 migration tool to detect some cases:
- - pointer initialized with "0" to nullptr
- - replace for with iterators with range-based for
- - use auto in some situations (type name specified twice, avoid long iterators type names)
2013-06-29 13:05:48 +00:00

46 lines
1021 B
C++

#include "StdInc.h"
#include "CMappedFileLoader.h"
#include "CResourceLoader.h"
#include "../JsonNode.h"
CMappedFileLoader::CMappedFileLoader(const JsonNode &config)
{
for(auto entry : config.Struct())
{
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
{
for(auto & elem : fileList)
{
if(elem.second == resourceName)
{
return true;
}
}
return false;
}
std::unordered_map<ResourceID, std::string> CMappedFileLoader::getEntries() const
{
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));
}