Remove plugin priorities

This commit is contained in:
Oliver Hamlet
2018-03-28 19:08:26 +01:00
parent 95896ed64b
commit 523dc87f04
18 changed files with 21 additions and 882 deletions
+6 -39
View File
@@ -36,7 +36,6 @@
#include "loot/metadata/location.h"
#include "loot/metadata/message.h"
#include "loot/metadata/plugin_cleaning_data.h"
#include "loot/metadata/priority.h"
#include "loot/metadata/tag.h"
namespace loot {
@@ -64,10 +63,9 @@ public:
* Merge metadata from the given PluginMetadata object into this object.
*
* If an equal metadata object already exists in this PluginMetadata object,
* it is not duplicated. This object's priorities are replaced if the given
* PluginMetadata object's priorities are explicit. This object's enabled
* state is replaced by the given object's state. This object's group is
* replaced by the given object's group if the latter is explicit.
* it is not duplicated. This object's enabled state is replaced by the given
* object's state. This object's group is replaced by the given object's group
* if the latter is explicit.
* @param plugin
* The plugin metadata to merge.
*/
@@ -80,10 +78,7 @@ public:
* The PluginMetadata object to compare against.
* @return A PluginMetadata object containing the metadata in this object that
* is not in the given object. The returned object inherits this
* object's enabled state and group. The returned object also inherits
* this plugin's priorities, unless a priority is equal to the given
* object's priority, in which case the returned object is given
* an implicit zero priority instead.
* object's enabled state and group.
*/
LOOT_API PluginMetadata NewMetadata(const PluginMetadata& plugin) const;
@@ -118,18 +113,6 @@ public:
*/
LOOT_API bool IsGroupExplicit() const;
/**
* Get the plugin's local priority metadata.
* @return The plugin's local priority metadata.
*/
LOOT_API Priority GetLocalPriority() const;
/**
* Get the plugin's global priority metadata.
* @return The plugin's global priority metadata.
*/
LOOT_API Priority GetGlobalPriority() const;
/**
* Get the plugins that the plugin must load after.
* @return The plugins that the plugin must load after.
@@ -201,20 +184,6 @@ public:
*/
LOOT_API void SetGroup(const std::string& group);
/**
* Set the plugin's local priority.
* @param priority
* The value to set.
*/
LOOT_API void SetLocalPriority(const Priority& priority);
/**
* Set the plugin's local priority.
* @param priority
* The value to set.
*/
LOOT_API void SetGlobalPriority(const Priority& priority);
/**
* Set the files that the plugin must load after.
* @param after
@@ -273,8 +242,8 @@ public:
/**
* Check if no plugin metadata is set.
* @return True if the group and local and global priorities are implicit and
* the metadata containers are all empty, false otherwise.
* @return True if the group is implicit and the metadata containers are all
* empty, false otherwise.
*/
LOOT_API bool HasNameOnly() const;
@@ -320,8 +289,6 @@ private:
bool enabled_;
std::string group_;
bool isGroupExplicit_;
Priority localPriority_;
Priority globalPriority_;
std::set<File> loadAfter_;
std::set<File> requirements_;
std::set<File> incompatibilities_;
-118
View File
@@ -1,118 +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
<http://www.gnu.org/licenses/>.
*/
#ifndef LOOT_METADATA_PRIORITY
#define LOOT_METADATA_PRIORITY
#include <cstdint>
#include "loot/api_decorator.h"
namespace loot {
/**
* Represents the priority of a plugin in the load order.
*
* Plugins have a default implicit priority of zero. Lower priority values cause
* plugins to be loaded earlier, and higher priority values cause plugins to be
* loaded later.
*/
class Priority {
public:
/**
* Construct a Priority object with an implicit value of zero.
* @return A Priority object.
*/
LOOT_API Priority();
// Take an int to prevent literals that are too large for one byte from
// wrapping around to negative values.
/**
* Construct a Priority object with the given priority value.
*
* If the given value is zero, it is marked as being set explicitly. This
* affects how priority metadata values get merged in PluginMetadata objects.
* @param value
* The priority value to set. The valid range of values is -127 to 127
* inclusive, and values passed to the constructor that lie outside
* this range are clamped. The input type is an int to avoid invalid
* values from implicitly wrapping around.
* @return A Priority object.
*/
LOOT_API explicit Priority(const int value);
/**
* Get the stored priority value.
* @return The priority value. While the valid value range fits in 8 bits,
* a short is returned to avoid interpreting the value as a character.
*/
LOOT_API short GetValue() const;
/**
* Check if the priority value is explicit or not.
* @return Returns true if the value is non-zero or was explicitly set to
* zero, and false otherwise.
*/
LOOT_API bool IsExplicit() const;
/**
* Check if this Priority object is less than another.
* @return True if this Priority object's value is less than the given
* Priority object's value.
*/
LOOT_API bool operator<(const Priority& rhs) const;
/**
* Check if this Priority object is greater than another.
* @return True if this Priority object's value is greater than the given
* Priority object's value, false otherwise.
*/
LOOT_API bool operator>(const Priority& rhs) const;
/**
* Check if this Priority object is greater than or equal to another.
* @return True if this Priority object's value is greater than or equal to
* the given Priority object's value, false otherwise.
*/
LOOT_API bool operator>=(const Priority& rhs) const;
/**
* Check if this Priority object is equal to another.
* @return True if this Priority object's value is equal to the given
* Priority object's value, false otherwise.
*/
LOOT_API bool operator==(const Priority& rhs) const;
/**
* Check if this Priority object is greater than a given priority value.
* @return True if this Priority object's value is greater than the given
* value, false otherwise.
*/
LOOT_API bool operator>(const uint8_t rhs) const;
private:
bool isExplicitZeroValue_;
int8_t value_;
};
}
#endif