Reformat code with clang format

This commit is contained in:
Clang Format
2023-11-19 15:28:38 +01:00
committed by Jan
parent 22e17272fd
commit 6b4f5d94a8
1099 changed files with 16763 additions and 18076 deletions

View File

@ -1,11 +1,11 @@
#include "ZoneCreatorIW3.h"
#include <iostream>
#include "ObjLoading.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "Game/IW3/GameIW3.h"
#include "Game/IW3/GameAssetPoolIW3.h"
#include "Game/IW3/GameIW3.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW3;

View File

@ -1,10 +1,10 @@
#pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW3
{
class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace IW3
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
}
} // namespace IW3

View File

@ -1,10 +1,10 @@
#include "ZoneCreatorIW4.h"
#include <iostream>
#include "ObjLoading.h"
#include "Game/IW4/GameIW4.h"
#include "Game/IW4/GameAssetPoolIW4.h"
#include "Game/IW4/GameIW4.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW4;

View File

@ -1,10 +1,10 @@
#pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW4
{
class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace IW4
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
}
} // namespace IW4

View File

@ -1,10 +1,10 @@
#include "ZoneCreatorIW5.h"
#include <iostream>
#include "ObjLoading.h"
#include "Game/IW5/GameIW5.h"
#include "Game/IW5/GameAssetPoolIW5.h"
#include "Game/IW5/GameIW5.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW5;

View File

@ -1,10 +1,10 @@
#pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW5
{
class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace IW5
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
}
} // namespace IW5

View File

@ -1,11 +1,11 @@
#include "ZoneCreatorT5.h"
#include <iostream>
#include "ObjLoading.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "Game/T5/GameT5.h"
#include "Game/T5/GameAssetPoolT5.h"
#include "Game/T5/GameT5.h"
#include "ObjLoading.h"
#include <iostream>
using namespace T5;

View File

@ -1,10 +1,10 @@
#pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace T5
{
class ZoneCreator final : public IZoneCreator
@ -22,4 +22,4 @@ namespace T5
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
}
} // namespace T5

View File

@ -1,12 +1,12 @@
#include "ZoneCreatorT6.h"
#include <iostream>
#include "ObjLoading.h"
#include "Game/T6/CommonT6.h"
#include "Game/T6/T6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/GameAssetPoolT6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/T6.h"
#include "ObjLoading.h"
#include <iostream>
using namespace T6;
@ -87,12 +87,7 @@ void ZoneCreator::HandleMetadata(Zone* zone, const ZoneCreationContext& context)
keyHash = Common::Com_HashKey(strValue.c_str(), 64);
}
KeyValuePair kvp
{
keyHash,
Common::Com_HashKey(zone->m_name.c_str(), 64),
zone->GetMemory()->Dup(metaData->m_value.c_str())
};
KeyValuePair kvp{keyHash, Common::Com_HashKey(zone->m_name.c_str(), 64), zone->GetMemory()->Dup(metaData->m_value.c_str())};
kvpList.push_back(kvp);
}
}

View File

@ -1,10 +1,10 @@
#pragma once
#include <unordered_map>
#include <string>
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace T6
{
class ZoneCreator final : public IZoneCreator
@ -23,4 +23,4 @@ namespace T6
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
}
} // namespace T6

View File

@ -1,45 +1,43 @@
#include "Linker.h"
#include <set>
#include <regex>
#include <filesystem>
#include <fstream>
#include <deque>
#include "Utils/ClassUtils.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "ZoneLoading.h"
#include "ObjWriting.h"
#include "ObjLoading.h"
#include "SearchPath/SearchPaths.h"
#include "ObjContainer/IWD/IWD.h"
#include "LinkerArgs.h"
#include "LinkerSearchPaths.h"
#include "ZoneWriting.h"
#include "Game/IW3/ZoneCreatorIW3.h"
#include "ZoneCreation/ZoneCreationContext.h"
#include "ZoneCreation/IZoneCreator.h"
#include "Game/IW4/ZoneCreatorIW4.h"
#include "Game/IW5/ZoneCreatorIW5.h"
#include "Game/T5/ZoneCreatorT5.h"
#include "Game/T6/ZoneCreatorT6.h"
#include "LinkerArgs.h"
#include "LinkerSearchPaths.h"
#include "ObjContainer/IPak/IPakWriter.h"
#include "ObjContainer/IWD/IWD.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "SearchPath/SearchPaths.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Utils/ObjFileStream.h"
#include "Utils/StringUtils.h"
#include "Zone/AssetList/AssetList.h"
#include "Zone/AssetList/AssetListStream.h"
#include "Zone/Definition/ZoneDefinitionStream.h"
#include "ZoneCreation/IZoneCreator.h"
#include "ZoneCreation/ZoneCreationContext.h"
#include "ZoneLoading.h"
#include "ZoneWriting.h"
#include <deque>
#include <filesystem>
#include <fstream>
#include <regex>
#include <set>
namespace fs = std::filesystem;
const IZoneCreator* const ZONE_CREATORS[]
{
const IZoneCreator* const ZONE_CREATORS[]{
new IW3::ZoneCreator(),
new IW4::ZoneCreator(),
new IW5::ZoneCreator(),
new T5::ZoneCreator(),
new T6::ZoneCreator()
new T6::ZoneCreator(),
};
enum class ProjectType
@ -51,11 +49,10 @@ enum class ProjectType
MAX
};
constexpr const char* PROJECT_TYPE_NAMES[static_cast<unsigned>(ProjectType::MAX)]
{
constexpr const char* PROJECT_TYPE_NAMES[static_cast<unsigned>(ProjectType::MAX)]{
"none",
"fastfile",
"ipak"
"ipak",
};
class LinkerImpl final : public Linker
@ -294,7 +291,7 @@ class LinkerImpl final : public Linker
if (projectType != parsedProjectType)
{
std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast<unsigned>(projectType)]
<< " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << std::endl;
<< " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << std::endl;
return false;
}
}
@ -367,7 +364,10 @@ class LinkerImpl final : public Linker
return true;
}
std::unique_ptr<Zone> CreateZoneForDefinition(const std::string& targetName, ZoneDefinition& zoneDefinition, ISearchPath* assetSearchPath, ISearchPath* gdtSearchPath,
std::unique_ptr<Zone> CreateZoneForDefinition(const std::string& targetName,
ZoneDefinition& zoneDefinition,
ISearchPath* assetSearchPath,
ISearchPath* gdtSearchPath,
ISearchPath* sourceSearchPath) const
{
const auto context = std::make_unique<ZoneCreationContext>(assetSearchPath, &zoneDefinition);
@ -412,7 +412,11 @@ class LinkerImpl final : public Linker
return true;
}
bool BuildFastFile(const std::string& projectName, const std::string& targetName, ZoneDefinition& zoneDefinition, SearchPaths& assetSearchPaths, SearchPaths& gdtSearchPaths,
bool BuildFastFile(const std::string& projectName,
const std::string& targetName,
ZoneDefinition& zoneDefinition,
SearchPaths& assetSearchPaths,
SearchPaths& gdtSearchPaths,
SearchPaths& sourceSearchPaths) const
{
const auto zone = CreateZoneForDefinition(targetName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths);
@ -460,17 +464,19 @@ class LinkerImpl final : public Linker
bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition)
{
return std::all_of(zoneDefinition.m_targets_to_build.begin(), zoneDefinition.m_targets_to_build.end(), [this, &projectName, &targetName](const std::string& buildTargetName)
{
if (buildTargetName == targetName)
{
std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n";
return false;
}
return std::all_of(zoneDefinition.m_targets_to_build.begin(),
zoneDefinition.m_targets_to_build.end(),
[this, &projectName, &targetName](const std::string& buildTargetName)
{
if (buildTargetName == targetName)
{
std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n";
return false;
}
std::cout << "Building referenced target \"" << buildTargetName << "\"\n";
return BuildProject(projectName, buildTargetName);
});
std::cout << "Building referenced target \"" << buildTargetName << "\"\n";
return BuildProject(projectName, buildTargetName);
});
}
bool BuildProject(const std::string& projectName, const std::string& targetName)

View File

@ -1,16 +1,17 @@
#include "LinkerArgs.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "Utils/Arguments/UsageInformation.h"
#include "Utils/FileUtils.h"
#include <filesystem>
#include <regex>
#include <type_traits>
#include "Utils/Arguments/UsageInformation.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "Utils/FileUtils.h"
namespace fs = std::filesystem;
// clang-format off
const CommandLineOption* const OPTION_HELP =
CommandLineOption::Builder::Create()
.WithShortName("?")
@ -79,11 +80,13 @@ const CommandLineOption* const OPTION_MENU_PERMISSIVE =
const CommandLineOption* const OPTION_MENU_NO_OPTIMIZATION =
CommandLineOption::Builder::Create()
.WithLongName("menu-no-optimization")
.WithDescription("Refrain from applying optimizations to parsed menus. (Optimizations increase menu performance and size. May result in less source information when dumped though.)")
.WithDescription("Refrain from applying optimizations to parsed menus. (Optimizations increase menu performance and size. May result in less source "
"information when dumped though.)")
.Build();
const CommandLineOption* const COMMAND_LINE_OPTIONS[]
{
// clang-format on
const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP,
OPTION_VERBOSE,
OPTION_BASE_FOLDER,
@ -93,7 +96,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]
OPTION_SOURCE_SEARCH_PATH,
OPTION_LOAD,
OPTION_MENU_PERMISSIVE,
OPTION_MENU_NO_OPTIMIZATION
OPTION_MENU_NO_OPTIMIZATION,
};
LinkerArgs::LinkerArgs()
@ -182,14 +185,14 @@ std::set<std::string> LinkerArgs::GetSearchPathsForProject(const std::set<std::s
for (const auto& path : set)
{
if (path.find(PATTERN_GAME) == std::string::npos
&& path.find(PATTERN_PROJECT) == std::string::npos
if (path.find(PATTERN_GAME) == std::string::npos && path.find(PATTERN_PROJECT) == std::string::npos
&& (!m_base_folder_depends_on_project || path.find(PATTERN_BASE) == std::string::npos))
{
continue;
}
out.emplace(std::regex_replace(std::regex_replace(std::regex_replace(path, m_project_pattern, projectName), m_game_pattern, gameName), m_base_pattern, basePath));
out.emplace(std::regex_replace(
std::regex_replace(std::regex_replace(path, m_project_pattern, projectName), m_game_pattern, gameName), m_base_pattern, basePath));
}
return out;

View File

@ -1,12 +1,12 @@
#pragma once
#include <vector>
#include <set>
#include <regex>
#include "Utils/ClassUtils.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Zone/Zone.h"
#include <regex>
#include <set>
#include <vector>
class LinkerArgs
{
public:
@ -37,12 +37,13 @@ private:
_NODISCARD std::string GetBasePathForProject(const std::string& projectName) const;
void SetDefaultBasePath();
_NODISCARD std::set<std::string> GetProjectIndependentSearchPaths(const std::set<std::string>& set) const;
_NODISCARD std::set<std::string> GetSearchPathsForProject(const std::set<std::string>& set, const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string>
GetSearchPathsForProject(const std::set<std::string>& set, const std::string& gameName, const std::string& projectName) const;
public:
std::vector<std::string> m_zones_to_load;
std::vector<std::string> m_project_specifiers_to_build;
std::string m_base_folder;
std::string m_out_folder;
bool m_base_folder_depends_on_project;
@ -67,7 +68,7 @@ public:
_NODISCARD std::set<std::string> GetProjectIndependentAssetSearchPaths() const;
_NODISCARD std::set<std::string> GetProjectIndependentGdtSearchPaths() const;
_NODISCARD std::set<std::string> GetProjectIndependentSourceSearchPaths() const;
_NODISCARD std::set<std::string> GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string> GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string> GetSourceSearchPathsForProject(const std::string& projectName) const;

View File

@ -1,12 +1,12 @@
#include "LinkerSearchPaths.h"
#include "ObjContainer/IWD/IWD.h"
#include "ObjLoading.h"
#include "SearchPath/SearchPathFilesystem.h"
#include <filesystem>
#include <iostream>
#include "ObjLoading.h"
#include "ObjContainer/IWD/IWD.h"
#include "SearchPath/SearchPathFilesystem.h"
namespace fs = std::filesystem;
LinkerSearchPaths::LinkerSearchPaths(const LinkerArgs& args)
@ -178,7 +178,6 @@ bool LinkerSearchPaths::BuildProjectIndependentSearchPaths()
return true;
}
void LinkerSearchPaths::UnloadProjectSpecificSearchPaths()
{
for (const auto& loadedSearchPath : m_loaded_project_search_paths)

View File

@ -1,11 +1,10 @@
#pragma once
#include "LinkerArgs.h"
#include "SearchPath/SearchPaths.h"
#include <memory>
#include <vector>
#include "LinkerArgs.h"
class LinkerSearchPaths
{
public:

View File

@ -1,9 +1,9 @@
#pragma once
#include <string>
#include "Utils/ClassUtils.h"
#include "ZoneCreationContext.h"
#include "Zone/Zone.h"
#include "ZoneCreationContext.h"
#include <string>
class IZoneCreator
{

View File

@ -1,13 +1,13 @@
#pragma once
#include <string>
#include <vector>
#include <memory>
#include "SearchPath/ISearchPath.h"
#include "Obj/Gdt/Gdt.h"
#include "SearchPath/ISearchPath.h"
#include "Zone/AssetList/AssetList.h"
#include "Zone/Definition/ZoneDefinition.h"
#include <memory>
#include <string>
#include <vector>
class ZoneCreationContext
{
public: