Format code based on clang format

This commit is contained in:
Thraix
2025-11-26 22:06:55 +01:00
parent 6976d330fc
commit 7c68a839fc
25 changed files with 1114 additions and 720 deletions
Executable → Regular
+40 -34
View File
@@ -1,68 +1,74 @@
#pragma once
#include "ConfigFile.h"
#include "FileUtils.h"
#include <iostream>
#include <filesystem>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include "ConfigFile.h"
#include "FileUtils.h"
struct CompareIncludeDeps;
class IncludeDeps
{
public:
std::map<std::string, IncludeDeps*> dependencies;
std::filesystem::path filepath;
bool projectHFile;
static std::set<std::string> printSet;
static int printCounter;
public:
std::map<std::string, IncludeDeps*> dependencies;
std::filesystem::path filepath;
bool projectHFile;
static std::set<std::string> printSet;
static int printCounter;
IncludeDeps(const std::string& filename, const std::set<HFile>& files, std::map<std::string, IncludeDeps*>& allDeps);
IncludeDeps(const std::string& filename, const std::set<HFile>& files, std::map<std::string, IncludeDeps*>& allDeps);
IncludeDeps(const std::string& filename, bool projectHFile, const std::set<HFile>& files, std::map<std::string, IncludeDeps*>& allDeps);
IncludeDeps(const std::string& filename,
bool projectHFile,
const std::set<HFile>& files,
std::map<std::string, IncludeDeps*>& allDeps);
std::string GetIncludeFile(const std::string& line);
std::string GetIncludeFile(const std::string& line);
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
{
std::string filePathInMakeFile = filepath;
if(!filepath.is_absolute())
filePathInMakeFile = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath.string(), "./").string();
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
{
std::string filePathInMakeFile = filepath;
if (!filepath.is_absolute())
filePathInMakeFile = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath.string(), "./").string();
if(printSet.find(filePathInMakeFile) != printSet.end())
return stream;
printSet.emplace(filePathInMakeFile);
printCounter++;
if(!projectHFile)
{
stream << " " << filePathInMakeFile;
}
for(auto it = dependencies.begin(); it != dependencies.end(); ++it)
{
(it->second)->Output(stream, conf);
}
printCounter--;
if(printCounter == 0)
printSet.clear();
if (printSet.find(filePathInMakeFile) != printSet.end())
return stream;
printSet.emplace(filePathInMakeFile);
printCounter++;
if (!projectHFile)
{
stream << " " << filePathInMakeFile;
}
for (auto it = dependencies.begin(); it != dependencies.end(); ++it)
{
(it->second)->Output(stream, conf);
}
printCounter--;
if (printCounter == 0)
printSet.clear();
return stream;
}
};
struct CompareIncludeDeps
{
using is_transparent = void;
bool operator()(const IncludeDeps* d1, const IncludeDeps* d2) const
{
return d1->filepath < d2->filepath;
}
bool operator()(const IncludeDeps* d, const std::string& filepath) const
{
return d->filepath < filepath;
}
bool operator()(const std::string& filepath, const IncludeDeps* d) const
{
return filepath < d->filepath;