Skip to content

Commit 9ccc741

Browse files
author
Felix Faber
committed
Trying to fix up whitespace and formatting
1 parent d1d4697 commit 9ccc741

1 file changed

Lines changed: 24 additions & 30 deletions

File tree

lib/importproject.cpp

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -724,16 +724,16 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
724724
printError(std::string("Visual Studio project file is not a valid XML - ") + tinyxml2::XMLDocument::ErrorIDToName(error));
725725
return false;
726726
}
727-
const tinyxml2::XMLElement* const rootnode = doc.FirstChildElement();
727+
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
728728
if (rootnode == nullptr) {
729729
printError("Visual Studio project file has no XML root node");
730730
return false;
731731
}
732-
for (const tinyxml2::XMLElement* node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
732+
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
733733
if (std::strcmp(node->Name(), "ItemGroup") == 0) {
734-
const char* labelAttribute = node->Attribute("Label");
734+
const char *labelAttribute = node->Attribute("Label");
735735
if (labelAttribute && std::strcmp(labelAttribute, "ProjectConfigurations") == 0) {
736-
for (const tinyxml2::XMLElement* cfg = node->FirstChildElement(); cfg; cfg = cfg->NextSiblingElement()) {
736+
for (const tinyxml2::XMLElement *cfg = node->FirstChildElement(); cfg; cfg = cfg->NextSiblingElement()) {
737737
if (std::strcmp(cfg->Name(), "ProjectConfiguration") == 0) {
738738
const ProjectConfiguration p(cfg);
739739
if (p.platform != ProjectConfiguration::Unknown) {
@@ -742,11 +742,10 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
742742
}
743743
}
744744
}
745-
}
746-
else {
747-
for (const tinyxml2::XMLElement* e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
745+
} else {
746+
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
748747
if (std::strcmp(e->Name(), "ClCompile") == 0) {
749-
const char* include = e->Attribute("Include");
748+
const char *include = e->Attribute("Include");
750749
if (include && Path::acceptFile(include)) {
751750
std::string toInclude = Path::simplifyPath(Path::isAbsolute(include) ? include : Path::getPathFromFilename(filename) + include);
752751
compileList.emplace_back(toInclude);
@@ -768,13 +767,11 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
768767
loadVisualStudioProperties(projectAttribute, variables, includePath, additionalIncludeDirectories, itemDefinitionGroupList);
769768
}
770769
}
771-
}
772-
else if (labelAttribute && std::strcmp(labelAttribute, "Shared") == 0) {
773-
for (const tinyxml2::XMLElement* e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
770+
} else if (labelAttribute && std::strcmp(labelAttribute, "Shared") == 0) {
771+
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
774772
if (std::strcmp(e->Name(), "Import") == 0) {
775-
const char* projectAttribute = e->Attribute("Project");
776-
if (projectAttribute)
777-
{
773+
const char *projectAttribute = e->Attribute("Project");
774+
if (projectAttribute) {
778775
// Path to shared items project is relative to current project directory,
779776
// unless the string starts with $(SolutionDir)
780777
std::string pathToSharedItemsFile;
@@ -787,9 +784,9 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
787784
printError("Could not simplify path to referenced shared items project");
788785
exit(-1);
789786
}
787+
790788
SharedItemsProject toAdd = importVcxitems(pathToSharedItemsFile, fileFilters, cache);
791-
if (!toAdd.successFull)
792-
{
789+
if (!toAdd.successFull) {
793790
printError("Could not load shared items project \"" + pathToSharedItemsFile + "\" from original path \"" + std::string(projectAttribute) + "\".");
794791
return false;
795792
}
@@ -804,27 +801,27 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
804801
// Include shared items project files
805802
std::vector<std::string> sharedItemsIncludePaths{};
806803
for (const auto& sharedProject : sharedItemsProjects) {
807-
for (const auto& file : sharedProject.sourceFiles) {
804+
for (const auto &file : sharedProject.sourceFiles) {
808805
std::string pathToFile = Path::simplifyPath(Path::getPathFromFilename(sharedProject.pathToProjectFile) + file);
809806
compileList.emplace_back(std::move(pathToFile));
810807
}
811-
for (const auto& p : sharedProject.includePaths) {
808+
for (const auto &p : sharedProject.includePaths) {
812809
std::string path = Path::simplifyPath(Path::getPathFromFilename(sharedProject.pathToProjectFile) + p);
813810
sharedItemsIncludePaths.emplace_back(std::move(path));
814811
}
815812
}
816813

817814
// Project files
818-
for (const std::string& cfilename : compileList) {
815+
for (const std::string &cfilename : compileList) {
819816
if (!fileFilters.empty() && !matchglobs(fileFilters, cfilename))
820817
continue;
821818

822-
for (const ProjectConfiguration& p : projectConfigurationList) {
819+
for (const ProjectConfiguration &p : projectConfigurationList) {
823820

824821
if (!guiProject.checkVsConfigs.empty()) {
825822
const bool doChecking = std::any_of(guiProject.checkVsConfigs.cbegin(), guiProject.checkVsConfigs.cend(), [&](const std::string& c) {
826823
return c == p.configuration;
827-
});
824+
});
828825
if (!doChecking)
829826
continue;
830827
}
@@ -884,10 +881,8 @@ static std::string stringReplace(const std::string& original, const std::string&
884881

885882
ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::string& filename, const std::vector<std::string>& fileFilters, std::vector<SharedItemsProject> &cache)
886883
{
887-
for (const auto& entry : cache)
888-
{
889-
if (filename == entry.pathToProjectFile)
890-
{
884+
for (const auto &entry : cache) {
885+
if (filename == entry.pathToProjectFile) {
891886
return entry;
892887
}
893888
}
@@ -901,14 +896,14 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
901896
printError(std::string("Visual Studio project file is not a valid XML - ") + tinyxml2::XMLDocument::ErrorIDToName(error));
902897
return result;
903898
}
904-
const tinyxml2::XMLElement* const rootnode = doc.FirstChildElement();
899+
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
905900
if (rootnode == nullptr) {
906901
printError("Visual Studio project file has no XML root node");
907902
return result;
908903
}
909-
for (const tinyxml2::XMLElement* node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
904+
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
910905
if (std::strcmp(node->Name(), "ItemGroup") == 0) {
911-
for (const tinyxml2::XMLElement* e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
906+
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
912907
if (std::strcmp(e->Name(), "ClCompile") == 0) {
913908
const char* include = e->Attribute("Include");
914909
if (include && Path::acceptFile(include)) {
@@ -925,8 +920,7 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
925920
}
926921
}
927922
}
928-
}
929-
else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) {
923+
} else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) {
930924
ItemDefinitionGroup temp(node, "");
931925
for (const auto& includePath : toStringList(temp.additionalIncludePaths)) {
932926
if (includePath == std::string("%(AdditionalIncludeDirectories)"))

0 commit comments

Comments
 (0)