Skip to content

Commit ab5d5d5

Browse files
author
Felix Faber
committed
Trying to fix up whitespace and formatting
1 parent 641e22c commit ab5d5d5

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
@@ -725,16 +725,16 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
725725
printError(std::string("Visual Studio project file is not a valid XML - ") + tinyxml2::XMLDocument::ErrorIDToName(error));
726726
return false;
727727
}
728-
const tinyxml2::XMLElement* const rootnode = doc.FirstChildElement();
728+
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
729729
if (rootnode == nullptr) {
730730
printError("Visual Studio project file has no XML root node");
731731
return false;
732732
}
733-
for (const tinyxml2::XMLElement* node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
733+
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
734734
if (std::strcmp(node->Name(), "ItemGroup") == 0) {
735-
const char* labelAttribute = node->Attribute("Label");
735+
const char *labelAttribute = node->Attribute("Label");
736736
if (labelAttribute && std::strcmp(labelAttribute, "ProjectConfigurations") == 0) {
737-
for (const tinyxml2::XMLElement* cfg = node->FirstChildElement(); cfg; cfg = cfg->NextSiblingElement()) {
737+
for (const tinyxml2::XMLElement *cfg = node->FirstChildElement(); cfg; cfg = cfg->NextSiblingElement()) {
738738
if (std::strcmp(cfg->Name(), "ProjectConfiguration") == 0) {
739739
const ProjectConfiguration p(cfg);
740740
if (p.platform != ProjectConfiguration::Unknown) {
@@ -743,11 +743,10 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
743743
}
744744
}
745745
}
746-
}
747-
else {
748-
for (const tinyxml2::XMLElement* e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
746+
} else {
747+
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
749748
if (std::strcmp(e->Name(), "ClCompile") == 0) {
750-
const char* include = e->Attribute("Include");
749+
const char *include = e->Attribute("Include");
751750
if (include && Path::acceptFile(include)) {
752751
std::string toInclude = Path::simplifyPath(Path::isAbsolute(include) ? include : Path::getPathFromFilename(filename) + include);
753752
compileList.emplace_back(toInclude);
@@ -769,13 +768,11 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
769768
loadVisualStudioProperties(projectAttribute, variables, includePath, additionalIncludeDirectories, itemDefinitionGroupList);
770769
}
771770
}
772-
}
773-
else if (labelAttribute && std::strcmp(labelAttribute, "Shared") == 0) {
774-
for (const tinyxml2::XMLElement* e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
771+
} else if (labelAttribute && std::strcmp(labelAttribute, "Shared") == 0) {
772+
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
775773
if (std::strcmp(e->Name(), "Import") == 0) {
776-
const char* projectAttribute = e->Attribute("Project");
777-
if (projectAttribute)
778-
{
774+
const char *projectAttribute = e->Attribute("Project");
775+
if (projectAttribute) {
779776
// Path to shared items project is relative to current project directory,
780777
// unless the string starts with $(SolutionDir)
781778
std::string pathToSharedItemsFile;
@@ -788,9 +785,9 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
788785
printError("Could not simplify path to referenced shared items project");
789786
exit(-1);
790787
}
788+
791789
SharedItemsProject toAdd = importVcxitems(pathToSharedItemsFile, fileFilters, cache);
792-
if (!toAdd.successFull)
793-
{
790+
if (!toAdd.successFull) {
794791
printError("Could not load shared items project \"" + pathToSharedItemsFile + "\" from original path \"" + std::string(projectAttribute) + "\".");
795792
return false;
796793
}
@@ -805,27 +802,27 @@ bool ImportProject::importVcxproj(const std::string &filename, std::map<std::str
805802
// Include shared items project files
806803
std::vector<std::string> sharedItemsIncludePaths{};
807804
for (const auto& sharedProject : sharedItemsProjects) {
808-
for (const auto& file : sharedProject.sourceFiles) {
805+
for (const auto &file : sharedProject.sourceFiles) {
809806
std::string pathToFile = Path::simplifyPath(Path::getPathFromFilename(sharedProject.pathToProjectFile) + file);
810807
compileList.emplace_back(std::move(pathToFile));
811808
}
812-
for (const auto& p : sharedProject.includePaths) {
809+
for (const auto &p : sharedProject.includePaths) {
813810
std::string path = Path::simplifyPath(Path::getPathFromFilename(sharedProject.pathToProjectFile) + p);
814811
sharedItemsIncludePaths.emplace_back(std::move(path));
815812
}
816813
}
817814

818815
// Project files
819-
for (const std::string& cfilename : compileList) {
816+
for (const std::string &cfilename : compileList) {
820817
if (!fileFilters.empty() && !matchglobs(fileFilters, cfilename))
821818
continue;
822819

823-
for (const ProjectConfiguration& p : projectConfigurationList) {
820+
for (const ProjectConfiguration &p : projectConfigurationList) {
824821

825822
if (!guiProject.checkVsConfigs.empty()) {
826823
const bool doChecking = std::any_of(guiProject.checkVsConfigs.cbegin(), guiProject.checkVsConfigs.cend(), [&](const std::string& c) {
827824
return c == p.configuration;
828-
});
825+
});
829826
if (!doChecking)
830827
continue;
831828
}
@@ -885,10 +882,8 @@ static std::string stringReplace(const std::string& original, const std::string&
885882

886883
ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::string& filename, const std::vector<std::string>& fileFilters, std::vector<SharedItemsProject> &cache)
887884
{
888-
for (const auto& entry : cache)
889-
{
890-
if (filename == entry.pathToProjectFile)
891-
{
885+
for (const auto &entry : cache) {
886+
if (filename == entry.pathToProjectFile) {
892887
return entry;
893888
}
894889
}
@@ -902,14 +897,14 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
902897
printError(std::string("Visual Studio project file is not a valid XML - ") + tinyxml2::XMLDocument::ErrorIDToName(error));
903898
return result;
904899
}
905-
const tinyxml2::XMLElement* const rootnode = doc.FirstChildElement();
900+
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
906901
if (rootnode == nullptr) {
907902
printError("Visual Studio project file has no XML root node");
908903
return result;
909904
}
910-
for (const tinyxml2::XMLElement* node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
905+
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
911906
if (std::strcmp(node->Name(), "ItemGroup") == 0) {
912-
for (const tinyxml2::XMLElement* e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
907+
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
913908
if (std::strcmp(e->Name(), "ClCompile") == 0) {
914909
const char* include = e->Attribute("Include");
915910
if (include && Path::acceptFile(include)) {
@@ -926,8 +921,7 @@ ImportProject::SharedItemsProject ImportProject::importVcxitems(const std::strin
926921
}
927922
}
928923
}
929-
}
930-
else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) {
924+
} else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) {
931925
ItemDefinitionGroup temp(node, "");
932926
for (const auto& includePath : toStringList(temp.additionalIncludePaths)) {
933927
if (includePath == std::string("%(AdditionalIncludeDirectories)"))

0 commit comments

Comments
 (0)