Remove ConditionalMetadata

While it makes sense, it doesn't really add any value and there is value in having all the relevant data and methods in a single class.
This commit is contained in:
Oliver Hamlet
2025-06-08 20:26:07 +01:00
parent 11bd321861
commit 649b4748bd
13 changed files with 34 additions and 193 deletions
@@ -1,34 +0,0 @@
/* LOOT
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
Fallout: New Vegas.
Copyright (C) 2012-2016 WrinklyNinja
This file is part of LOOT.
LOOT is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
LOOT is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LOOT. If not, see
<https://www.gnu.org/licenses/>.
*/
#include "loot/metadata/conditional_metadata.h"
namespace loot {
ConditionalMetadata::ConditionalMetadata(std::string_view condition) :
condition_(condition) {}
bool ConditionalMetadata::IsConditional() const { return !condition_.empty(); }
std::string ConditionalMetadata::GetCondition() const { return condition_; }
}
+3 -1
View File
@@ -30,10 +30,10 @@ File::File(std::string_view name,
std::string_view condition,
const std::vector<MessageContent>& detail,
std::string_view constraint) :
ConditionalMetadata(condition),
name_(Filename(name)),
display_(display),
detail_(detail),
condition_(condition),
constraint_(constraint) {}
Filename File::GetName() const { return name_; }
@@ -42,6 +42,8 @@ std::string File::GetDisplayName() const { return display_; }
std::vector<MessageContent> File::GetDetail() const { return detail_; }
std::string File::GetCondition() const { return condition_; }
std::string File::GetConstraint() const { return constraint_; }
bool operator==(const File& lhs, const File& rhs) {
+4 -4
View File
@@ -30,14 +30,12 @@ namespace loot {
Message::Message(const MessageType type,
std::string_view content,
std::string_view condition) :
ConditionalMetadata(condition),
type_(type),
content_({MessageContent(content)}) {}
type_(type), content_({MessageContent(content)}), condition_(condition) {}
Message::Message(const MessageType type,
const std::vector<MessageContent>& content,
std::string_view condition) :
ConditionalMetadata(condition), type_(type), content_(content) {
type_(type), content_(content), condition_(condition) {
if (content.size() > 1) {
bool englishStringExists = false;
for (const auto& mc : content) {
@@ -55,6 +53,8 @@ MessageType Message::GetType() const { return type_; }
std::vector<MessageContent> Message::GetContent() const { return content_; }
std::string Message::GetCondition() const { return condition_; }
bool operator==(const Message& lhs, const Message& rhs) {
return lhs.GetType() == rhs.GetType() &&
lhs.GetCondition() == rhs.GetCondition() &&
+3 -1
View File
@@ -28,12 +28,14 @@ namespace loot {
Tag::Tag(std::string_view tag,
const bool isAddition,
std::string_view condition) :
ConditionalMetadata(condition), name_(tag), addTag_(isAddition) {}
name_(tag), addTag_(isAddition), condition_(condition) {}
bool Tag::IsAddition() const { return addTag_; }
std::string Tag::GetName() const { return name_; }
std::string Tag::GetCondition() const { return condition_; }
bool operator==(const Tag& lhs, const Tag& rhs) {
return lhs.IsAddition() == rhs.IsAddition() &&
lhs.GetName() == rhs.GetName() &&