mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Move condition evaluation out of metadata classes
So that the API doesn't expose any references to the Game class. Evaluation is now done in the ConditionEvaluator class. This complicates evaluating conditions for Plugin objects, these have been checked to ensure that metadata is only merged into them after evaluation.
This commit is contained in:
@@ -27,21 +27,16 @@
|
||||
#include <string>
|
||||
|
||||
namespace loot {
|
||||
class Game;
|
||||
|
||||
class ConditionalMetadata {
|
||||
public:
|
||||
ConditionalMetadata();
|
||||
ConditionalMetadata(const std::string& condition);
|
||||
|
||||
bool IsConditional() const;
|
||||
bool EvalCondition(Game& game) const;
|
||||
void ParseCondition() const; // Throws error on parsing failure.
|
||||
void ParseCondition() const;
|
||||
|
||||
std::string Condition() const;
|
||||
private:
|
||||
bool ParseCondition(Game * game) const; // Throws error on parsing failure.
|
||||
|
||||
std::string condition_;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include "loot/metadata/message.h"
|
||||
|
||||
namespace loot {
|
||||
class Game;
|
||||
|
||||
class PluginCleaningData {
|
||||
public:
|
||||
PluginCleaningData();
|
||||
@@ -56,8 +54,6 @@ public:
|
||||
|
||||
MessageContent ChooseInfo(const LanguageCode language) const;
|
||||
Message AsMessage() const;
|
||||
|
||||
bool EvalCondition(Game& game, const std::string& pluginName) const;
|
||||
private:
|
||||
uint32_t crc_;
|
||||
unsigned int itm_;
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
#include "loot/metadata/tag.h"
|
||||
|
||||
namespace loot {
|
||||
class Game;
|
||||
|
||||
class PluginMetadata {
|
||||
public:
|
||||
PluginMetadata();
|
||||
@@ -84,7 +82,6 @@ public:
|
||||
void CleanInfo(const std::set<PluginCleaningData>& info);
|
||||
void Locations(const std::set<Location>& locations);
|
||||
|
||||
PluginMetadata& EvalAllConditions(Game& game);
|
||||
bool HasNameOnly() const;
|
||||
bool IsRegexPlugin() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user