mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
f82122d9be
- 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)
46 lines
1021 B
C++
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));
|
|
}
|