mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
CREATE_PROJECT: use C++11-style for each loops instead of iterators
This commit is contained in:
1 parent
2e3b977142
commit
b054ef0ecc
7 files changed
+223
-233
No files matched your search
@@ -265,8 +265,8 @@ void XcodeProvider::addResourceFiles(const BuildSetup &setup, StringList &includ
|
||||
}
|
||||
|
||||
ValueList &resources = getResourceFiles(setup);
|
||||
for (ValueList::iterator it = resources.begin(); it != resources.end(); ++it) {
|
||||
includeList.push_back(setup.srcDir + "/" + *it);
|
||||
for (const auto &resource : resources) {
|
||||
includeList.push_back(setup.srcDir + "/" + resource);
|
||||
}
|
||||
|
||||
StringList pchDirs, pchEx;
|
||||
@@ -376,9 +376,7 @@ void XcodeProvider::writeFileListToProject(const FileNode &dir, std::ostream &pr
|
||||
|
||||
// Ensure that top-level groups are generated for i.e. engines/
|
||||
Group *group = touchGroupsForPath(filePrefix);
|
||||
for (FileNode::NodeList::const_iterator i = dir.children.begin(); i != dir.children.end(); ++i) {
|
||||
const FileNode *node = *i;
|
||||
|
||||
for (const auto *node : dir.children) {
|
||||
// Iff it is a file, then add (build) file references. Since we're using Groups and not File References
|
||||
// for folders, we shouldn't add folders as file references, obviously.
|
||||
if (node->children.empty()) {
|
||||
@@ -697,13 +695,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
|
||||
frameworks_osx.push_back(getLibString(libSDL + "_net", setup.useXCFramework));
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator framework = frameworks_osx.begin(); framework != frameworks_osx.end(); framework++) {
|
||||
std::string id = "Frameworks_" + *framework + "_osx";
|
||||
std::string comment = *framework + " in Frameworks";
|
||||
for (const auto &framework : frameworks_osx) {
|
||||
std::string id = "Frameworks_" + framework + "_osx";
|
||||
std::string comment = framework + " in Frameworks";
|
||||
|
||||
ADD_SETTING_ORDER_NOVALUE(osx_files, getHash(id), comment, order++);
|
||||
ADD_BUILD_FILE(id, *framework, getHash(*framework), comment);
|
||||
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
|
||||
ADD_BUILD_FILE(id, framework, getHash(framework), comment);
|
||||
ADD_FILE_REFERENCE(framework, framework, properties[framework]);
|
||||
}
|
||||
|
||||
framework_OSX->_properties["files"] = osx_files;
|
||||
@@ -820,13 +818,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator framework = frameworks_iOS.begin(); framework != frameworks_iOS.end(); framework++) {
|
||||
std::string id = "Frameworks_" + *framework + "_iphone";
|
||||
std::string comment = *framework + " in Frameworks";
|
||||
for (const auto &framework : frameworks_iOS) {
|
||||
std::string id = "Frameworks_" + framework + "_iphone";
|
||||
std::string comment = framework + " in Frameworks";
|
||||
|
||||
ADD_SETTING_ORDER_NOVALUE(iOS_files, getHash(id), comment, order++);
|
||||
ADD_BUILD_FILE(id, *framework, getHash(*framework), comment);
|
||||
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
|
||||
ADD_BUILD_FILE(id, framework, getHash(framework), comment);
|
||||
ADD_FILE_REFERENCE(framework, framework, properties[framework]);
|
||||
}
|
||||
|
||||
framework_iPhone->_properties["files"] = iOS_files;
|
||||
@@ -939,13 +937,13 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator framework = frameworks_tvOS.begin(); framework != frameworks_tvOS.end(); framework++) {
|
||||
std::string id = "Frameworks_" + *framework + "_appletv";
|
||||
std::string comment = *framework + " in Frameworks";
|
||||
for (const auto &framework : frameworks_tvOS) {
|
||||
std::string id = "Frameworks_" + framework + "_appletv";
|
||||
std::string comment = framework + " in Frameworks";
|
||||
|
||||
ADD_SETTING_ORDER_NOVALUE(tvOS_files, getHash(id), comment, order++);
|
||||
ADD_BUILD_FILE(id, *framework, getHash(*framework), comment);
|
||||
ADD_FILE_REFERENCE(*framework, *framework, properties[*framework]);
|
||||
ADD_BUILD_FILE(id, framework, getHash(framework), comment);
|
||||
ADD_FILE_REFERENCE(framework, framework, properties[framework]);
|
||||
}
|
||||
|
||||
framework_tvOS->_properties["files"] = tvOS_files;
|
||||
@@ -960,28 +958,28 @@ void XcodeProvider::setupNativeTarget() {
|
||||
// Just use a hardcoded id for the Products-group
|
||||
Group *productsGroup = new Group(this, "Products", "PBXGroup_CustomTemplate_Products_" , "");
|
||||
// Output native target section
|
||||
for (unsigned int i = 0; i < _targets.size(); i++) {
|
||||
Object *target = new Object(this, "PBXNativeTarget_" + _targets[i], "PBXNativeTarget", "PBXNativeTarget", "", _targets[i]);
|
||||
for (const auto &_target : _targets) {
|
||||
Object *target = new Object(this, "PBXNativeTarget_" + _target, "PBXNativeTarget", "PBXNativeTarget", "", _target);
|
||||
|
||||
target->addProperty("buildConfigurationList", getHash("XCConfigurationList_" + _targets[i]), "Build configuration list for PBXNativeTarget \"" + _targets[i] + "\"", kSettingsNoValue);
|
||||
target->addProperty("buildConfigurationList", getHash("XCConfigurationList_" + _target), "Build configuration list for PBXNativeTarget \"" + _target + "\"", kSettingsNoValue);
|
||||
|
||||
Property buildPhases;
|
||||
buildPhases._hasOrder = true;
|
||||
buildPhases._flags = kSettingsAsList;
|
||||
buildPhases._settings[getHash("PBXResourcesBuildPhase_" + _targets[i])] = Setting("", "Resources", kSettingsNoValue, 0, 0);
|
||||
buildPhases._settings[getHash("PBXSourcesBuildPhase_" + _targets[i])] = Setting("", "Sources", kSettingsNoValue, 0, 1);
|
||||
buildPhases._settings[getHash("PBXFrameworksBuildPhase_" + _targets[i])] = Setting("", "Frameworks", kSettingsNoValue, 0, 2);
|
||||
buildPhases._settings[getHash("PBXResourcesBuildPhase_" + _target)] = Setting("", "Resources", kSettingsNoValue, 0, 0);
|
||||
buildPhases._settings[getHash("PBXSourcesBuildPhase_" + _target)] = Setting("", "Sources", kSettingsNoValue, 0, 1);
|
||||
buildPhases._settings[getHash("PBXFrameworksBuildPhase_" + _target)] = Setting("", "Frameworks", kSettingsNoValue, 0, 2);
|
||||
target->_properties["buildPhases"] = buildPhases;
|
||||
|
||||
target->addProperty("buildRules", "", "", kSettingsNoValue | kSettingsAsList);
|
||||
|
||||
target->addProperty("dependencies", "", "", kSettingsNoValue | kSettingsAsList);
|
||||
|
||||
target->addProperty("name", _targets[i], "", kSettingsNoValue | kSettingsQuoteVariable);
|
||||
target->addProperty("name", _target, "", kSettingsNoValue | kSettingsQuoteVariable);
|
||||
target->addProperty("productName", PROJECT_NAME, "", kSettingsNoValue);
|
||||
addProductFileReference("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i], PROJECT_DESCRIPTION ".app");
|
||||
productsGroup->addChildByHash(getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i]), PROJECT_DESCRIPTION ".app");
|
||||
target->addProperty("productReference", getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _targets[i]), PROJECT_DESCRIPTION ".app", kSettingsNoValue);
|
||||
addProductFileReference("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _target, PROJECT_DESCRIPTION ".app");
|
||||
productsGroup->addChildByHash(getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _target), PROJECT_DESCRIPTION ".app");
|
||||
target->addProperty("productReference", getHash("PBXFileReference_" PROJECT_DESCRIPTION ".app_" + _target), PROJECT_DESCRIPTION ".app", kSettingsNoValue);
|
||||
target->addProperty("productType", "com.apple.product-type.application", "", kSettingsNoValue | kSettingsQuoteVariable);
|
||||
|
||||
_nativeTarget.add(target);
|
||||
@@ -1164,8 +1162,8 @@ XcodeProvider::ValueList& XcodeProvider::getResourceFiles(const BuildSetup &setu
|
||||
files.push_back("NEWS.md");
|
||||
files.push_back("README.md");
|
||||
|
||||
for (int i = 0; i < kEngineDataGroupCount; i++) {
|
||||
for (const std::string &filename : _engineDataGroupDefs[i].dataFiles) {
|
||||
for (const auto &engineDataGroupDef : _engineDataGroupDefs) {
|
||||
for (const std::string &filename : engineDataGroupDef.dataFiles) {
|
||||
if (std::find(files.begin(), files.end(), filename) != files.end())
|
||||
error("Resource file " + filename + " was included multiple times");
|
||||
|
||||
@@ -1193,8 +1191,8 @@ void XcodeProvider::setupResourcesBuildPhase(const BuildSetup &setup) {
|
||||
ValueList &files_list = getResourceFiles(setup);
|
||||
|
||||
// Same as for containers: a rule for each native target
|
||||
for (unsigned int i = 0; i < _targets.size(); i++) {
|
||||
Object *resource = new Object(this, "PBXResourcesBuildPhase_" + _targets[i], "PBXResourcesBuildPhase", "PBXResourcesBuildPhase", "", "Resources");
|
||||
for (const auto &target : _targets) {
|
||||
Object *resource = new Object(this, "PBXResourcesBuildPhase_" + target, "PBXResourcesBuildPhase", "PBXResourcesBuildPhase", "", "Resources");
|
||||
|
||||
resource->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
|
||||
|
||||
@@ -1204,13 +1202,13 @@ void XcodeProvider::setupResourcesBuildPhase(const BuildSetup &setup) {
|
||||
files._flags = kSettingsAsList;
|
||||
|
||||
int order = 0;
|
||||
for (ValueList::iterator file = files_list.begin(); file != files_list.end(); file++) {
|
||||
if (shouldSkipFileForTarget(*file, _targets[i], *file)) {
|
||||
for (const auto &file : files_list) {
|
||||
if (shouldSkipFileForTarget(file, target, file)) {
|
||||
continue;
|
||||
}
|
||||
std::string resourceAbsolutePath = _projectRoot + "/" + *file;
|
||||
std::string resourceAbsolutePath = _projectRoot + "/" + file;
|
||||
std::string file_id = "FileReference_" + resourceAbsolutePath;
|
||||
std::string base = basename(*file);
|
||||
std::string base = basename(file);
|
||||
std::string comment = base + " in Resources";
|
||||
addBuildFile(resourceAbsolutePath, base, getHash(file_id), comment);
|
||||
ADD_SETTING_ORDER_NOVALUE(files, getHash(resourceAbsolutePath), comment, order++);
|
||||
@@ -1228,9 +1226,9 @@ void XcodeProvider::setupSourcesBuildPhase() {
|
||||
_sourcesBuildPhase._comment = "PBXSourcesBuildPhase";
|
||||
|
||||
// Same as for containers: a rule for each native target
|
||||
for (unsigned int i = 0; i < _targets.size(); i++) {
|
||||
const std::string &targetName = _targets[i];
|
||||
Object *source = new Object(this, "PBXSourcesBuildPhase_" + _targets[i], "PBXSourcesBuildPhase", "PBXSourcesBuildPhase", "", "Sources");
|
||||
for (const auto &target : _targets) {
|
||||
const std::string &targetName = target;
|
||||
Object *source = new Object(this, "PBXSourcesBuildPhase_" + target, "PBXSourcesBuildPhase", "PBXSourcesBuildPhase", "", "Sources");
|
||||
|
||||
source->addProperty("buildActionMask", "2147483647", "", kSettingsNoValue);
|
||||
|
||||
@@ -1239,16 +1237,16 @@ void XcodeProvider::setupSourcesBuildPhase() {
|
||||
files._flags = kSettingsAsList;
|
||||
|
||||
int order = 0;
|
||||
for (std::vector<Object *>::iterator file = _buildFile._objects.begin(); file != _buildFile._objects.end(); ++file) {
|
||||
const std::string &fileName = (*file)->_name;
|
||||
if (shouldSkipFileForTarget((*file)->_id, targetName, fileName)) {
|
||||
for (const auto *object : _buildFile._objects) {
|
||||
const std::string &fileName = object->_name;
|
||||
if (shouldSkipFileForTarget(object->_id, targetName, fileName)) {
|
||||
continue;
|
||||
}
|
||||
if (!producesObjectFileOnOSX(fileName)) {
|
||||
continue;
|
||||
}
|
||||
std::string comment = fileName + " in Sources";
|
||||
ADD_SETTING_ORDER_NOVALUE(files, getHash((*file)->_id), comment, order++);
|
||||
ADD_SETTING_ORDER_NOVALUE(files, getHash(object->_id), comment, order++);
|
||||
}
|
||||
|
||||
setupAdditionalSources(targetName, files, order);
|
||||
@@ -1393,8 +1391,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
*/
|
||||
ADD_SETTING_QUOTE(scummvmOSX_Debug, "GCC_VERSION", "");
|
||||
ValueList scummvmOSX_HeaderPaths;
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
scummvmOSX_HeaderPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
scummvmOSX_HeaderPaths.push_back("\"" + includeDir + "\"");
|
||||
scummvmOSX_HeaderPaths.push_back("/usr/local/include/" + libSDL);
|
||||
scummvmOSX_HeaderPaths.push_back("/opt/homebrew/include/" + libSDL);
|
||||
scummvmOSX_HeaderPaths.push_back("/opt/local/include/" + libSDL);
|
||||
@@ -1410,8 +1408,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ADD_SETTING_LIST(scummvmOSX_Debug, "HEADER_SEARCH_PATHS", scummvmOSX_HeaderPaths, kSettingsQuoteVariable | kSettingsAsList, 5);
|
||||
ADD_SETTING_QUOTE(scummvmOSX_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/macosx/Info.plist");
|
||||
ValueList scummvmOSX_LibPaths;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
scummvmOSX_LibPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
scummvmOSX_LibPaths.push_back("\"" + libraryDir + "\"");
|
||||
scummvmOSX_LibPaths.push_back("/usr/local/lib");
|
||||
scummvmOSX_LibPaths.push_back("/opt/homebrew/lib");
|
||||
scummvmOSX_LibPaths.push_back("/opt/local/lib");
|
||||
@@ -1469,8 +1467,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ValueList iPhone_HeaderSearchPaths;
|
||||
iPhone_HeaderSearchPaths.push_back("$(SRCROOT)/engines/");
|
||||
iPhone_HeaderSearchPaths.push_back("$(SRCROOT)");
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + includeDir + "\"");
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "\"");
|
||||
if (!setup.useXCFramework) {
|
||||
iPhone_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "/include\"");
|
||||
@@ -1481,8 +1479,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ADD_SETTING_LIST(iPhone_Debug, "HEADER_SEARCH_PATHS", iPhone_HeaderSearchPaths, kSettingsAsList | kSettingsQuoteVariable, 5);
|
||||
ADD_SETTING_QUOTE(iPhone_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/ios7/Info.plist");
|
||||
ValueList iPhone_LibPaths;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
iPhone_LibPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
iPhone_LibPaths.push_back("\"" + libraryDir + "\"");
|
||||
iPhone_LibPaths.push_back("$(inherited)");
|
||||
if (!setup.useXCFramework)
|
||||
iPhone_LibPaths.push_back("\"" + projectOutputDirectory + "/lib\"");
|
||||
@@ -1555,8 +1553,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ValueList tvOS_HeaderSearchPaths;
|
||||
tvOS_HeaderSearchPaths.push_back("$(SRCROOT)/engines/");
|
||||
tvOS_HeaderSearchPaths.push_back("$(SRCROOT)");
|
||||
for (StringList::const_iterator i = setup.includeDirs.begin(); i != setup.includeDirs.end(); ++i)
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &includeDir : setup.includeDirs)
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + includeDir + "\"");
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "\"");
|
||||
tvOS_HeaderSearchPaths.push_back("\"" + projectOutputDirectory + "/include\"");
|
||||
if (CONTAINS_DEFINE(setup.defines, "USE_SDL_NET")) {
|
||||
@@ -1565,8 +1563,8 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
ADD_SETTING_LIST(tvOS_Debug, "HEADER_SEARCH_PATHS", tvOS_HeaderSearchPaths, kSettingsAsList | kSettingsQuoteVariable, 5);
|
||||
ADD_SETTING_QUOTE(tvOS_Debug, "INFOPLIST_FILE", "$(SRCROOT)/dists/tvos/Info.plist");
|
||||
ValueList tvOS_LibPaths;
|
||||
for (StringList::const_iterator i = setup.libraryDirs.begin(); i != setup.libraryDirs.end(); ++i)
|
||||
tvOS_LibPaths.push_back("\"" + *i + "\"");
|
||||
for (const auto &libraryDir : setup.libraryDirs)
|
||||
tvOS_LibPaths.push_back("\"" + libraryDir + "\"");
|
||||
tvOS_LibPaths.push_back("$(inherited)");
|
||||
tvOS_LibPaths.push_back("\"" + projectOutputDirectory + "/lib\"");
|
||||
ADD_SETTING_LIST(tvOS_Debug, "LIBRARY_SEARCH_PATHS", tvOS_LibPaths, kSettingsAsList, 5);
|
||||
@@ -1611,15 +1609,15 @@ void XcodeProvider::setupBuildConfiguration(const BuildSetup &setup) {
|
||||
}
|
||||
|
||||
// Warning: This assumes we have all configurations with a Debug & Release pair
|
||||
for (std::vector<Object *>::iterator config = _buildConfiguration._objects.begin(); config != _buildConfiguration._objects.end(); config++) {
|
||||
for (const auto *config : _buildConfiguration._objects) {
|
||||
|
||||
Object *configList = new Object(this, "XCConfigurationList_" + (*config)->_name, (*config)->_name, "XCConfigurationList", "", "Build configuration list for " + (*config)->_refType + " \"" + (*config)->_name + "\"");
|
||||
Object *configList = new Object(this, "XCConfigurationList_" + config->_name, config->_name, "XCConfigurationList", "", "Build configuration list for " + config->_refType + " \"" + config->_name + "\"");
|
||||
|
||||
Property buildConfigs;
|
||||
buildConfigs._flags = kSettingsAsList;
|
||||
|
||||
buildConfigs._settings[getHash((*config)->_id)] = Setting("", "Debug", kSettingsNoValue, 0, 0);
|
||||
buildConfigs._settings[getHash((*(++config))->_id)] = Setting("", "Release", kSettingsNoValue, 0, 1);
|
||||
buildConfigs._settings[getHash(config->_id)] = Setting("", "Debug", kSettingsNoValue, 0, 0);
|
||||
buildConfigs._settings[getHash((++config)->_id)] = Setting("", "Release", kSettingsNoValue, 0, 1);
|
||||
|
||||
configList->_properties["buildConfigurations"] = buildConfigs;
|
||||
|
||||
@@ -1664,8 +1662,8 @@ void XcodeProvider::setupAdditionalSources(std::string targetName, Property &fil
|
||||
// Setup global defines
|
||||
void XcodeProvider::setupDefines(const BuildSetup &setup) {
|
||||
|
||||
for (StringList::const_iterator i = setup.defines.begin(); i != setup.defines.end(); ++i) {
|
||||
ADD_DEFINE(_defines, *i);
|
||||
for (const auto &define : setup.defines) {
|
||||
ADD_DEFINE(_defines, define);
|
||||
}
|
||||
// Add special defines for Mac support
|
||||
// TODO: check if it's still needed
|
||||
@@ -1764,11 +1762,11 @@ std::string XcodeProvider::writeProperty(const std::string &variable, Property &
|
||||
output += (prop._flags & kSettingsAsList) ? "(\n" : "{\n";
|
||||
|
||||
OrderedSettingList settings = prop.getOrderedSettingList();
|
||||
for (OrderedSettingList::const_iterator setting = settings.begin(); setting != settings.end(); ++setting) {
|
||||
for (const auto &setting : settings) {
|
||||
if (settings.size() > 1 || (prop._flags & kSettingsSingleItem))
|
||||
output += (flags & kSettingsSingleItem ? " " : "\t\t\t\t");
|
||||
|
||||
output += writeSetting(setting->first, setting->second);
|
||||
output += writeSetting(setting.first, setting.second);
|
||||
|
||||
// The combination of kSettingsAsList, and kSettingsSingleItem should use "," and not ";" (i.e children
|
||||
// in PBXGroup, so we special case that case here.
|
||||
|
||||
Reference in new issue
Block a user