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:
Oliver Hamlet
2017-02-06 18:02:18 +00:00
parent 15c1c91750
commit 174dea8b8d
20 changed files with 390 additions and 317 deletions
+1 -6
View File
@@ -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_;
-3
View File
@@ -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;