Skip to content

v0.2.48..v0.2.49 changeset SetTagValueVisitor.h

Garret Voltz edited this page Oct 2, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/visitors/SetTagValueVisitor.h b/hoot-core/src/main/cpp/hoot/core/visitors/SetTagValueVisitor.h
index 762a384..a9e5344 100644
--- a/hoot-core/src/main/cpp/hoot/core/visitors/SetTagValueVisitor.h
+++ b/hoot-core/src/main/cpp/hoot/core/visitors/SetTagValueVisitor.h
@@ -28,10 +28,9 @@
 #define SETTAGVALUEVISITOR_H
 
 // hoot
-#include <hoot/core/criterion/ElementCriterionConsumer.h>
 #include <hoot/core/util/Configurable.h>
-#include <hoot/core/elements/ElementVisitor.h>
 #include <hoot/core/info/OperationStatusInfo.h>
+#include <hoot/core/visitors/MultipleCriterionConsumerVisitor.h>
 
 namespace hoot
 {
@@ -40,8 +39,8 @@ namespace hoot
  * Sets tags on any elements with the specified key to the specified value or adds a new tag, if
  * the tag doesn't exist on the element.
  */
-class SetTagValueVisitor : public ElementVisitor, public Configurable,
-  public ElementCriterionConsumer, public OperationStatusInfo
+class SetTagValueVisitor : public MultipleCriterionConsumerVisitor, public Configurable,
+  public OperationStatusInfo
 {
 public:
 
@@ -50,25 +49,19 @@ public:
   SetTagValueVisitor();
   SetTagValueVisitor(
     const QStringList& keys, const QStringList& values, bool appendToExistingValue = false,
-    const QString& criterionName = "", const bool overwriteExistingTag = true,
-    const bool negateCriterion = false);
+    const QStringList& criteriaClassNames = QStringList(), const bool overwriteExistingTag = true,
+    const bool negateCriteria = false);
   SetTagValueVisitor(
     const QString& key, const QString& value, bool appendToExistingValue = false,
-    const QString& criterionName = "", const bool overwriteExistingTag = true,
-    const bool negateCriterion = false);
-
-  virtual void addCriterion(const ElementCriterionPtr& e);
+    const QStringList& criteriaClassNames = QStringList(), const bool overwriteExistingTag = true,
+    const bool negateCriteria = false);
 
   virtual void setConfiguration(const Settings& conf);
 
   virtual void visit(const std::shared_ptr<Element>& e);
 
-  void setTag(const ElementPtr& e, const QString& k, const QString& v);
-
   virtual QString getDescription() const { return "Adds or updates specific tags on elements"; }
 
-  void setNegateCriterion(bool negate) { _negateCriterion = negate; }
-
   virtual QString getInitStatusMessage() const { return "Updating tags..."; }
 
   virtual QString getCompletedStatusMessage() const
@@ -79,14 +72,10 @@ private:
   QStringList _keys, _vals;
   //if true; will not overwrite existing keys and will append values to them
   bool _appendToExistingValue;
-  //a customizable filter
-  std::shared_ptr<ElementCriterion> _criterion;
   //overwrites any tag with a matching key
   bool _overwriteExistingTag;
-  //This allows for negating the criterion as an option sent in from the command line.
-  bool _negateCriterion;
 
-  void _setCriterion(const QString& criterionName);
+  void _setTag(const ElementPtr& e, const QString& k, const QString& v);
 };
 
 }
Clone this wiki locally