mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add cppcoreguidelines-explicit-virtual-functions clang-tidy check
Fix the warnings it emits
This commit is contained in:
@@ -487,6 +487,7 @@ if(RUN_CLANG_TIDY)
|
||||
set(CLANG_TIDY_COMMON_CHECKS
|
||||
"cppcoreguidelines-avoid-c-arrays"
|
||||
"cppcoreguidelines-c-copy-assignment-signature"
|
||||
"cppcoreguidelines-explicit-virtual-functions"
|
||||
"cppcoreguidelines-interfaces-global-init"
|
||||
"cppcoreguidelines-macro-usage"
|
||||
"cppcoreguidelines-narrowing-conventions"
|
||||
|
||||
+18
-16
@@ -41,41 +41,43 @@ namespace loot {
|
||||
struct ApiDatabase final : public DatabaseInterface {
|
||||
explicit ApiDatabase(std::shared_ptr<ConditionEvaluator> conditionEvaluator);
|
||||
|
||||
void LoadLists(const std::filesystem::path& masterlist_path,
|
||||
const std::filesystem::path& userlist_path = "",
|
||||
const std::filesystem::path& masterlist_prelude_path = "");
|
||||
void LoadLists(
|
||||
const std::filesystem::path& masterlist_path,
|
||||
const std::filesystem::path& userlist_path = "",
|
||||
const std::filesystem::path& masterlist_prelude_path = "") override;
|
||||
|
||||
void WriteUserMetadata(const std::filesystem::path& outputFile,
|
||||
const bool overwrite) const;
|
||||
const bool overwrite) const override;
|
||||
|
||||
void WriteMinimalList(const std::filesystem::path& outputFile,
|
||||
const bool overwrite) const;
|
||||
const bool overwrite) const override;
|
||||
|
||||
std::vector<std::string> GetKnownBashTags() const;
|
||||
std::vector<std::string> GetKnownBashTags() const override;
|
||||
|
||||
std::vector<Message> GetGeneralMessages(
|
||||
bool evaluateConditions = false) const;
|
||||
bool evaluateConditions = false) const override;
|
||||
|
||||
std::vector<Group> GetGroups(bool includeUserMetadata = true) const;
|
||||
std::vector<Group> GetUserGroups() const;
|
||||
std::vector<Group> GetGroups(bool includeUserMetadata = true) const override;
|
||||
std::vector<Group> GetUserGroups() const override;
|
||||
void SetUserGroups(const std::vector<Group>& groups);
|
||||
std::vector<Vertex> GetGroupsPath(const std::string& fromGroupName,
|
||||
const std::string& toGroupName) const;
|
||||
std::vector<Vertex> GetGroupsPath(
|
||||
const std::string& fromGroupName,
|
||||
const std::string& toGroupName) const override;
|
||||
|
||||
std::optional<PluginMetadata> GetPluginMetadata(
|
||||
const std::string& plugin,
|
||||
bool includeUserMetadata = true,
|
||||
bool evaluateConditions = false) const;
|
||||
bool evaluateConditions = false) const override;
|
||||
|
||||
std::optional<PluginMetadata> GetPluginUserMetadata(
|
||||
const std::string& plugin,
|
||||
bool evaluateConditions = false) const;
|
||||
bool evaluateConditions = false) const override;
|
||||
|
||||
void SetPluginUserMetadata(const PluginMetadata& pluginMetadata);
|
||||
void SetPluginUserMetadata(const PluginMetadata& pluginMetadata) override;
|
||||
|
||||
void DiscardPluginUserMetadata(const std::string& plugin);
|
||||
void DiscardPluginUserMetadata(const std::string& plugin) override;
|
||||
|
||||
void DiscardAllUserMetadata();
|
||||
void DiscardAllUserMetadata() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ConditionEvaluator> conditionEvaluator_;
|
||||
|
||||
+13
-11
@@ -52,29 +52,31 @@ public:
|
||||
// Game Interface Methods //
|
||||
////////////////////////////
|
||||
|
||||
std::shared_ptr<DatabaseInterface> GetDatabase();
|
||||
std::shared_ptr<DatabaseInterface> GetDatabase() override;
|
||||
|
||||
bool IsValidPlugin(const std::string& plugin) const;
|
||||
bool IsValidPlugin(const std::string& plugin) const override;
|
||||
|
||||
void LoadPlugins(const std::vector<std::string>& plugins,
|
||||
bool loadHeadersOnly);
|
||||
bool loadHeadersOnly) override;
|
||||
|
||||
std::shared_ptr<const PluginInterface> GetPlugin(
|
||||
const std::string& pluginName) const;
|
||||
const std::string& pluginName) const override;
|
||||
|
||||
std::vector<std::shared_ptr<const PluginInterface>> GetLoadedPlugins() const;
|
||||
std::vector<std::shared_ptr<const PluginInterface>> GetLoadedPlugins()
|
||||
const override;
|
||||
|
||||
void IdentifyMainMasterFile(const std::string& masterFile);
|
||||
void IdentifyMainMasterFile(const std::string& masterFile) override;
|
||||
|
||||
std::vector<std::string> SortPlugins(const std::vector<std::string>& plugins);
|
||||
std::vector<std::string> SortPlugins(
|
||||
const std::vector<std::string>& plugins) override;
|
||||
|
||||
void LoadCurrentLoadOrderState();
|
||||
void LoadCurrentLoadOrderState() override;
|
||||
|
||||
bool IsPluginActive(const std::string& pluginName) const;
|
||||
bool IsPluginActive(const std::string& pluginName) const override;
|
||||
|
||||
std::vector<std::string> GetLoadOrder() const;
|
||||
std::vector<std::string> GetLoadOrder() const override;
|
||||
|
||||
void SetLoadOrder(const std::vector<std::string>& loadOrder);
|
||||
void SetLoadOrder(const std::vector<std::string>& loadOrder) override;
|
||||
|
||||
private:
|
||||
void CacheArchives();
|
||||
|
||||
+12
-12
@@ -47,21 +47,21 @@ public:
|
||||
std::filesystem::path pluginPath,
|
||||
const bool headerOnly);
|
||||
|
||||
std::string GetName() const;
|
||||
std::optional<float> GetHeaderVersion() const;
|
||||
std::optional<std::string> GetVersion() const;
|
||||
std::vector<std::string> GetMasters() const;
|
||||
std::vector<Tag> GetBashTags() const;
|
||||
std::optional<uint32_t> GetCRC() const;
|
||||
std::string GetName() const override;
|
||||
std::optional<float> GetHeaderVersion() const override;
|
||||
std::optional<std::string> GetVersion() const override;
|
||||
std::vector<std::string> GetMasters() const override;
|
||||
std::vector<Tag> GetBashTags() const override;
|
||||
std::optional<uint32_t> GetCRC() const override;
|
||||
|
||||
bool IsMaster() const;
|
||||
bool IsMaster() const override;
|
||||
|
||||
bool IsLightPlugin() const;
|
||||
bool IsLightPlugin() const override;
|
||||
|
||||
bool IsValidAsLightPlugin() const;
|
||||
bool IsEmpty() const;
|
||||
bool LoadsArchive() const;
|
||||
bool DoFormIDsOverlap(const PluginInterface& plugin) const;
|
||||
bool IsValidAsLightPlugin() const override;
|
||||
bool IsEmpty() const override;
|
||||
bool LoadsArchive() const override;
|
||||
bool DoFormIDsOverlap(const PluginInterface& plugin) const override;
|
||||
size_t GetOverlapSize(
|
||||
const std::vector<std::shared_ptr<const Plugin>> plugins) const;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ protected:
|
||||
errorMessage("Obsolete. Remove this and install Enhanced Weather."),
|
||||
generalMasterlistMessage("A general masterlist message.") {}
|
||||
|
||||
virtual void SetUp() {
|
||||
virtual void SetUp() override {
|
||||
CommonGameTestFixture::SetUp();
|
||||
|
||||
ASSERT_FALSE(std::filesystem::exists(masterlistPath));
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
localPathJunctionLink(localPath.string() + ".junction"),
|
||||
originalWorkingDirectory(std::filesystem::current_path()) {}
|
||||
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
using std::filesystem::file_type;
|
||||
using std::filesystem::status;
|
||||
CommonGameTestFixture::SetUp();
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
std::filesystem::current_path(dataPath.parent_path().parent_path());
|
||||
}
|
||||
|
||||
void TearDown() { std::filesystem::current_path(originalWorkingDirectory); }
|
||||
void TearDown() override { std::filesystem::current_path(originalWorkingDirectory); }
|
||||
|
||||
std::shared_ptr<GameInterface> handle_;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
generalUserlistMessage("A general userlist message."),
|
||||
db_(nullptr) {}
|
||||
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
ApiGameOperationsTest::SetUp();
|
||||
|
||||
db_ = handle_->GetDatabase();
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
{metadataFilesPath / "invalid" / "non_map_root.yaml",
|
||||
metadataFilesPath / "invalid" / "non_unique.yaml"}) {}
|
||||
|
||||
inline virtual void SetUp() {
|
||||
inline virtual void SetUp() override {
|
||||
CommonGameTestFixture::SetUp();
|
||||
|
||||
using std::filesystem::copy;
|
||||
|
||||
@@ -43,7 +43,7 @@ protected:
|
||||
GetArchiveFileExtension(GetParam())),
|
||||
game_(GetParam(), dataPath.parent_path(), localPath) {}
|
||||
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
CommonGameTestFixture::SetUp();
|
||||
|
||||
game_.LoadCurrentLoadOrderState();
|
||||
@@ -138,21 +138,23 @@ private:
|
||||
|
||||
class OtherPluginType final : public PluginInterface {
|
||||
public:
|
||||
std::string GetName() const { return ""; }
|
||||
std::optional<float> GetHeaderVersion() const { return 0.0f; }
|
||||
std::optional<std::string> GetVersion() const { return std::nullopt; }
|
||||
std::vector<std::string> GetMasters() const {
|
||||
std::string GetName() const override { return ""; }
|
||||
std::optional<float> GetHeaderVersion() const override { return 0.0f; }
|
||||
std::optional<std::string> GetVersion() const override {
|
||||
return std::nullopt;
|
||||
}
|
||||
std::vector<std::string> GetMasters() const override {
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
std::vector<Tag> GetBashTags() const { return std::vector<Tag>(); }
|
||||
std::optional<uint32_t> GetCRC() const { return std::nullopt; }
|
||||
std::vector<Tag> GetBashTags() const override { return std::vector<Tag>(); }
|
||||
std::optional<uint32_t> GetCRC() const override { return std::nullopt; }
|
||||
|
||||
bool IsMaster() const { return false; }
|
||||
bool IsLightPlugin() const { return false; }
|
||||
bool IsValidAsLightPlugin() const { return false; }
|
||||
bool IsEmpty() const { return false; }
|
||||
bool LoadsArchive() const { return false; }
|
||||
bool DoFormIDsOverlap(const PluginInterface&) const { return true; }
|
||||
bool IsMaster() const override { return false; }
|
||||
bool IsLightPlugin() const override { return false; }
|
||||
bool IsValidAsLightPlugin() const override { return false; }
|
||||
bool IsEmpty() const override { return false; }
|
||||
bool LoadsArchive() const override { return false; }
|
||||
bool DoFormIDsOverlap(const PluginInterface&) const override { return true; }
|
||||
};
|
||||
|
||||
// Pass an empty first argument, as it's a prefix for the test instantation,
|
||||
|
||||
Reference in New Issue
Block a user