mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Remove unused PluginMetadata::DiffMetadata function
This commit is contained in:
@@ -51,11 +51,6 @@ public:
|
||||
//For 'enabled' and 'priority' metadata, use the given plugin's values, but if the 'priority' user value is zero, ignore it.
|
||||
void MergeMetadata(const PluginMetadata& plugin);
|
||||
|
||||
//Returns the difference in metadata between the two plugins.
|
||||
//For 'enabled', use this plugin's value.
|
||||
//For 'priority', use 0 if the two plugin priorities are equal, and make it not explicit. Otherwise use this plugin's value.
|
||||
PluginMetadata DiffMetadata(const PluginMetadata& plugin) const;
|
||||
|
||||
// Returns metadata in this plugin not in the given plugin.
|
||||
//For 'enabled', use this plugin's value.
|
||||
//For 'priority', use 0 if the two plugin priorities are equal, and make it not explicit. Otherwise use this plugin's value.
|
||||
|
||||
+21
-21
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LOOT 0.10.3\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
|
||||
"POT-Creation-Date: 2017-01-26 21:09+0000\n"
|
||||
"POT-Creation-Date: 2017-01-29 11:37+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -674,18 +674,18 @@ msgid ""
|
||||
"Fallout 3, Fallout: New Vegas and Fallout 4."
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/get_game_data_query.h:44
|
||||
#: src/gui/query/get_game_data_query.h:43
|
||||
msgid "Parsing, merging and evaluating metadata..."
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/get_game_data_query.h:80
|
||||
#: src/gui/query/get_game_data_query.h:79
|
||||
msgid ""
|
||||
"An error occurred while parsing the masterlist: %1%. This probably happened "
|
||||
"because an update to LOOT changed its metadata syntax support. Try updating "
|
||||
"your masterlist to resolve the error."
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/get_game_data_query.h:95
|
||||
#: src/gui/query/get_game_data_query.h:94
|
||||
msgid ""
|
||||
"An error occurred while parsing the userlist: %1%. This probably happened "
|
||||
"because an update to LOOT changed its metadata syntax support. Your user "
|
||||
@@ -700,25 +700,25 @@ msgid ""
|
||||
"[LOOT's website](https://loot.github.io/)."
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/metadata_query.h:91 src/gui/query/metadata_query.h:92
|
||||
#: src/gui/query/metadata_query.h:90 src/gui/query/metadata_query.h:91
|
||||
msgid "N/A: No masterlist present"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/metadata_query.h:95 src/gui/query/metadata_query.h:96
|
||||
#: src/gui/query/metadata_query.h:94 src/gui/query/metadata_query.h:95
|
||||
msgid "Unknown: Git repository missing"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/metadata_query.h:119
|
||||
#: src/gui/query/metadata_query.h:118
|
||||
msgid ""
|
||||
"A global message contains a condition that could not be evaluated. Details: "
|
||||
"%1%"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/metadata_query.h:145 src/backend/plugin/plugin_sorter.cpp:217
|
||||
#: src/gui/query/metadata_query.h:144 src/backend/plugin/plugin_sorter.cpp:219
|
||||
msgid "\"%1%\" contains a condition that could not be evaluated. Details: %2%"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/query/metadata_query.h:176 src/gui/query/metadata_query.h:177
|
||||
#: src/gui/query/metadata_query.h:175 src/gui/query/metadata_query.h:176
|
||||
msgid "(edited)"
|
||||
msgstr ""
|
||||
|
||||
@@ -742,19 +742,19 @@ msgid ""
|
||||
"%3%"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/state/loot_state.cpp:130
|
||||
#: src/gui/state/loot_state.cpp:131
|
||||
msgid "Error: Could not create LOOT settings file. %1%"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/state/loot_state.cpp:137
|
||||
#: src/gui/state/loot_state.cpp:138
|
||||
msgid "Error: Settings parsing failed. %1%"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/state/loot_state.cpp:198
|
||||
#: src/gui/state/loot_state.cpp:199
|
||||
msgid "Error: Game-specific settings could not be initialised. %1%"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/game/game_cache.cpp:119
|
||||
#: src/backend/game/game_cache.cpp:117
|
||||
msgid "You have not sorted your load order this session."
|
||||
msgstr ""
|
||||
|
||||
@@ -807,42 +807,42 @@ msgstr ""
|
||||
msgid "%1% found %2%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/plugin/plugin.cpp:115
|
||||
#: src/backend/plugin/plugin.cpp:116
|
||||
msgid "Cannot read \"%1%\". Details: %2%"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/plugin/plugin.cpp:221 src/backend/plugin/plugin.cpp:232
|
||||
#: src/backend/plugin/plugin.cpp:226 src/backend/plugin/plugin.cpp:237
|
||||
msgid "This plugin requires \"%1%\" to be installed, but it is missing."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/plugin/plugin.cpp:224
|
||||
#: src/backend/plugin/plugin.cpp:229
|
||||
msgid "This plugin requires \"%1%\" to be active, but it is inactive."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/plugin/plugin.cpp:238
|
||||
#: src/backend/plugin/plugin.cpp:243
|
||||
msgid "This plugin is incompatible with \"%1%\", but both are present."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:45
|
||||
#: src/backend/masterlist.cpp:46
|
||||
msgid ""
|
||||
"An error occurred while trying to read the local masterlist's version. If "
|
||||
"this error happens again, try deleting the \".git\" folder in %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:117 src/backend/masterlist.cpp:131
|
||||
#: src/backend/masterlist.cpp:114 src/backend/masterlist.cpp:128
|
||||
msgid ""
|
||||
"An error occurred while trying to access the local masterlist repository. If "
|
||||
"this error happens again, try deleting the \".git\" folder in %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:238
|
||||
#: src/backend/masterlist.cpp:235
|
||||
msgid ""
|
||||
"An error occurred while trying to read information on the updated "
|
||||
"masterlist. If this error happens again, try deleting the \".git\" folder in "
|
||||
"%1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:252
|
||||
#: src/backend/masterlist.cpp:249
|
||||
msgid ""
|
||||
"Masterlist revision %1%: %2%. The latest masterlist revision contains a "
|
||||
"syntax error, LOOT is using the most recent valid revision instead. Syntax "
|
||||
|
||||
@@ -89,90 +89,6 @@ void PluginMetadata::MergeMetadata(const PluginMetadata& plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
PluginMetadata PluginMetadata::DiffMetadata(const PluginMetadata& plugin) const {
|
||||
using std::set_symmetric_difference;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Calculating metadata difference for: " << name_;
|
||||
PluginMetadata p(*this);
|
||||
|
||||
if (localPriority_ == plugin.localPriority_)
|
||||
p.localPriority_ = Priority();
|
||||
|
||||
if (globalPriority_ == plugin.globalPriority_)
|
||||
p.globalPriority_ = Priority();
|
||||
|
||||
//Compare this plugin against the given plugin.
|
||||
set<File> filesDiff;
|
||||
set_symmetric_difference(begin(loadAfter_),
|
||||
end(loadAfter_),
|
||||
begin(plugin.loadAfter_),
|
||||
end(plugin.loadAfter_),
|
||||
inserter(filesDiff, begin(filesDiff)));
|
||||
p.LoadAfter(filesDiff);
|
||||
|
||||
filesDiff.clear();
|
||||
set_symmetric_difference(begin(requirements_),
|
||||
end(requirements_),
|
||||
begin(plugin.requirements_),
|
||||
end(plugin.requirements_),
|
||||
inserter(filesDiff, begin(filesDiff)));
|
||||
p.Reqs(filesDiff);
|
||||
|
||||
filesDiff.clear();
|
||||
set_symmetric_difference(begin(incompatibilities_),
|
||||
end(incompatibilities_),
|
||||
begin(plugin.incompatibilities_),
|
||||
end(plugin.incompatibilities_),
|
||||
inserter(filesDiff, begin(filesDiff)));
|
||||
p.Incs(filesDiff);
|
||||
|
||||
vector<Message> msgs1 = plugin.Messages();
|
||||
vector<Message> msgs2 = messages_;
|
||||
std::sort(begin(msgs1), end(msgs1));
|
||||
std::sort(begin(msgs2), end(msgs2));
|
||||
vector<Message> mDiff;
|
||||
set_symmetric_difference(begin(msgs2),
|
||||
end(msgs2),
|
||||
begin(msgs1),
|
||||
end(msgs1),
|
||||
inserter(mDiff, begin(mDiff)));
|
||||
p.Messages(mDiff);
|
||||
|
||||
set<Tag> tagDiff;
|
||||
set_symmetric_difference(begin(tags_),
|
||||
end(tags_),
|
||||
begin(plugin.tags_),
|
||||
end(plugin.tags_),
|
||||
inserter(tagDiff, begin(tagDiff)));
|
||||
p.Tags(tagDiff);
|
||||
|
||||
set<PluginCleaningData> dirtDiff;
|
||||
set_symmetric_difference(begin(dirtyInfo_),
|
||||
end(dirtyInfo_),
|
||||
begin(plugin.dirtyInfo_),
|
||||
end(plugin.dirtyInfo_),
|
||||
inserter(dirtDiff, begin(dirtDiff)));
|
||||
p.DirtyInfo(dirtDiff);
|
||||
|
||||
set<PluginCleaningData> cleanDiff;
|
||||
set_symmetric_difference(begin(cleanInfo_),
|
||||
end(cleanInfo_),
|
||||
begin(plugin.cleanInfo_),
|
||||
end(plugin.cleanInfo_),
|
||||
inserter(cleanDiff, begin(cleanDiff)));
|
||||
p.CleanInfo(cleanDiff);
|
||||
|
||||
set<Location> locationsDiff;
|
||||
set_symmetric_difference(begin(locations_),
|
||||
end(locations_),
|
||||
begin(plugin.locations_),
|
||||
end(plugin.locations_),
|
||||
inserter(locationsDiff, begin(locationsDiff)));
|
||||
p.Locations(locationsDiff);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
PluginMetadata PluginMetadata::NewMetadata(const PluginMetadata& plugin) const {
|
||||
using std::set_difference;
|
||||
|
||||
|
||||
@@ -298,188 +298,6 @@ TEST_P(PluginMetadataTest, mergeMetadataShouldMergeLocationData) {
|
||||
EXPECT_EQ(std::set<Location>({location1, location2}), plugin1.Locations());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldUseSourcePluginName) {
|
||||
PluginMetadata plugin1(blankEsm);
|
||||
PluginMetadata plugin2(blankDifferentEsm);
|
||||
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(blankEsm, diff.Name());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldUseSourcePluginEnabledState) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
plugin2.Enabled(false);
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_TRUE(diff.Enabled());
|
||||
|
||||
plugin1.Enabled(false);
|
||||
diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_FALSE(diff.Enabled());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldUseSourcePluginLocalPriorityIfItDiffersFromTheTargetPluginLocalPriority) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
plugin2.LocalPriority(Priority(5));
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(0, diff.LocalPriority().getValue());
|
||||
EXPECT_FALSE(diff.LocalPriority().isExplicit());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldUseSourcePluginGlobalPriorityIfItDiffersFromTheTargetPluginGlobalPriority) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
plugin2.GlobalPriority(Priority(5));
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(0, diff.GlobalPriority().getValue());
|
||||
EXPECT_FALSE(diff.GlobalPriority().isExplicit());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputDefaultLocalPriorityIfTheSourceAndTargetPluginLocalPrioritiesMatch) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
plugin1.LocalPriority(Priority(5));
|
||||
plugin2.LocalPriority(Priority(5));
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(0, diff.LocalPriority().getValue());
|
||||
EXPECT_FALSE(diff.LocalPriority().isExplicit());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputDefaultGlobalPriorityIfTheSourceAndTargetPluginGlobalPrioritiesMatch) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
plugin1.GlobalPriority(Priority(5));
|
||||
plugin2.GlobalPriority(Priority(5));
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(0, diff.GlobalPriority().getValue());
|
||||
EXPECT_FALSE(diff.GlobalPriority().isExplicit());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputLoadAfterDataThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
File file1(blankEsm);
|
||||
File file2(blankDifferentEsm);
|
||||
File file3(blankEsp);
|
||||
|
||||
plugin1.LoadAfter({file1, file2});
|
||||
plugin2.LoadAfter({file1, file3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<File>({file2, file3}), diff.LoadAfter());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputRequirementsDataThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
File file1(blankEsm);
|
||||
File file2(blankDifferentEsm);
|
||||
File file3(blankEsp);
|
||||
|
||||
plugin1.Reqs({file1, file2});
|
||||
plugin2.Reqs({file1, file3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<File>({file2, file3}), diff.Reqs());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputIncompatibilityDataThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
File file1(blankEsm);
|
||||
File file2(blankDifferentEsm);
|
||||
File file3(blankEsp);
|
||||
|
||||
plugin1.Incs({file1, file2});
|
||||
plugin2.Incs({file1, file3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<File>({file2, file3}), diff.Incs());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputMessagesThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
Message message1(MessageType::say, "content1");
|
||||
Message message2(MessageType::say, "content2");
|
||||
Message message3(MessageType::say, "content3");
|
||||
|
||||
plugin1.Messages({message1, message2});
|
||||
plugin2.Messages({message1, message3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::vector<Message>({message2, message3}), diff.Messages());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputTagsThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
Tag tag1("Relev");
|
||||
Tag tag2("Relev", false);
|
||||
Tag tag3("Delev");
|
||||
|
||||
plugin1.Tags({tag1, tag2});
|
||||
plugin2.Tags({tag1, tag3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<Tag>({tag2, tag3}), diff.Tags());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputDirtyInfoObjectsThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginCleaningData info1(0x5, "utility", info_, 1, 2, 3);
|
||||
PluginCleaningData info2(0xA, "utility", info_, 1, 2, 3);
|
||||
PluginCleaningData info3(0x1, "utility", info_, 1, 2, 3);
|
||||
|
||||
plugin1.DirtyInfo({info1, info2});
|
||||
plugin2.DirtyInfo({info1, info3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({info2, info3}), diff.DirtyInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputCleanInfoObjectsThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginCleaningData info1(0x5, "utility");
|
||||
PluginCleaningData info2(0xA, "utility");
|
||||
PluginCleaningData info3(0x1, "utility");
|
||||
|
||||
plugin1.CleanInfo({info1, info2});
|
||||
plugin2.CleanInfo({info1, info3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({info2, info3}), diff.CleanInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputLocationsThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
Location location1("http://www.example.com/1");
|
||||
Location location2("http://www.example.com/2");
|
||||
Location location3("http://www.example.com/3");
|
||||
|
||||
plugin1.Locations({location1, location2});
|
||||
plugin2.Locations({location1, location3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<Location>({location2, location3}), diff.Locations());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, newMetadataShouldUseSourcePluginName) {
|
||||
PluginMetadata plugin1(blankEsm);
|
||||
PluginMetadata plugin2(blankDifferentEsm);
|
||||
|
||||
Reference in New Issue
Block a user