1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-05 23:28:14 +02:00

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)
This commit is contained in:
Ivan Savenko
2013-06-29 13:05:48 +00:00
parent 262f956a16
commit f82122d9be
88 changed files with 2065 additions and 2062 deletions

View File

@@ -141,7 +141,7 @@ bool CResourceLoader::createResource(std::string URI, bool update)
{
std::string filename = URI;
boost::to_upper(URI);
BOOST_REVERSE_FOREACH (const LoaderEntry & entry, loaders)
for (auto & entry : boost::adaptors::reverse(loaders))
{
if (entry.writeable && boost::algorithm::starts_with(URI, entry.prefix))
{
@@ -172,11 +172,11 @@ void CResourceLoader::addLoader(std::string mountPoint, shared_ptr<ISimpleResour
loaders.push_back(loaderEntry);
// Get entries and add them to the resources list
const boost::unordered_map<ResourceID, std::string> & entries = loader->getEntries();
const std::unordered_map<ResourceID, std::string> & entries = loader->getEntries();
boost::to_upper(mountPoint);
BOOST_FOREACH (auto & entry, entries)
for (auto & entry : entries)
{
// Create identifier and locator and add them to the resources list
ResourceID ident(mountPoint, entry.first.getName(), entry.first.getType());
@@ -316,7 +316,7 @@ void CResourceHandler::initialize()
auto recurseInDir = [](std::string URI, int depth)
{
auto resources = initialLoader->getResourcesWithName(ResourceID(URI, EResType::DIRECTORY));
BOOST_FOREACH(const ResourceLocator & entry, resources)
for(const ResourceLocator & entry : resources)
{
std::string filename = entry.getLoader()->getOrigin() + '/' + entry.getResourceName();
if (!filename.empty())
@@ -363,7 +363,7 @@ void CResourceHandler::loadDirectory(const std::string &prefix, const std::strin
auto resources = initialLoader->getResourcesWithName(ResourceID(URI, EResType::DIRECTORY));
BOOST_FOREACH(const ResourceLocator & entry, resources)
for(const ResourceLocator & entry : resources)
{
std::string filename = entry.getLoader()->getOrigin() + '/' + entry.getResourceName();
resourceLoader->addLoader(mountPoint,
@@ -407,9 +407,9 @@ void CResourceHandler::loadFileSystem(const std::string & prefix, const std::str
void CResourceHandler::loadFileSystem(const std::string & prefix, const JsonNode &fsConfig)
{
BOOST_FOREACH(auto & mountPoint, fsConfig.Struct())
for(auto & mountPoint : fsConfig.Struct())
{
BOOST_FOREACH(auto & entry, mountPoint.second.Vector())
for(auto & entry : mountPoint.second.Vector())
{
CStopWatch timer;
logGlobal->debugStream() << "\t\tLoading resource at " << prefix + entry["path"].String();
@@ -476,7 +476,7 @@ void CResourceHandler::setActiveMods(std::vector<std::string> enabledMods)
defaultFS[""].Vector()[0]["type"].String() = "dir";
defaultFS[""].Vector()[0]["path"].String() = "/Content";
BOOST_FOREACH(std::string & modName, enabledMods)
for(std::string & modName : enabledMods)
{
ResourceID modConfFile("all/mods/" + modName + "/mod", EResType::TEXT);
auto fsConfigData = initialLoader->loadData(modConfFile);