Skip to content

v0.2.53..v0.2.54 changeset Tags.h

Garret Voltz edited this page Mar 31, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/elements/Tags.h b/hoot-core/src/main/cpp/hoot/core/elements/Tags.h
index a8deffe..da120cc 100644
--- a/hoot-core/src/main/cpp/hoot/core/elements/Tags.h
+++ b/hoot-core/src/main/cpp/hoot/core/elements/Tags.h
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #ifndef TAGS_H
 #define TAGS_H
@@ -37,7 +37,6 @@
 #include <QStringList>
 
 // Standard
-// needed by some dev environments
 #include <stdint.h>
 #include <string>
 
@@ -299,6 +298,14 @@ public:
   QString toString() const;
 
   /**
+   * Returns true if the tags have the specified kvp
+   *
+   * @param kvp kvp to search for
+   * @return true if tags contain the kvp; false otherwise
+   */
+  bool hasKvp(const QString& kvp) const;
+
+  /**
    * Returns true if the tags have any key=value in the input list
    *
    * @param kvps kvps to search for
@@ -323,6 +330,13 @@ public:
   static Tags kvpListToTags(const QStringList& kvps);
 
   /**
+   * Returns the tags as key/value pair strings
+   *
+   * @return a list of key/value pairs
+   */
+  QStringList toKvps() const;
+
+  /**
    * Converts a collection of schema vertices to tags
    *
    * @param vertices schema vertices to convert
@@ -356,6 +370,34 @@ public:
    */
   QString getDiffString(const Tags& other) const;
 
+  /**
+   * Determines if another set of tags intersects with this one
+   *
+   * @param other tags to compare against
+   * @return true if the tags being compared against have at least one tag in similar
+   */
+  bool intersects(const Tags& other) const;
+
+  /**
+   * Determines if two sets of tags contain a particular key/value pair
+   *
+   * @param tags1 first set of tags to examine
+   * @param tags2 second set of tags to examine
+   * @param kvp key/value pair to search for
+   * @return true if both sets of tags contain the key/value pair; false otherwise
+   */
+  static bool bothContainKvp(const Tags& tags1, const Tags& tags2, const QString& kvp);
+
+  /**
+   * Determines if either one of two sets of tags contain a particular key/value pair
+   *
+   * @param tags1 first set of tags to examine
+   * @param tags2 second set of tags to examine
+   * @param kvp key/value pair to search for
+   * @return true if exactly one of the sets of tags contain the key/value pair; false otherwise
+   */
+  static bool onlyOneContainsKvp(const Tags& tags1, const Tags& tags2, const QString& kvp);
+
 private:
 
   void _valueRegexParser(const QString& str, QString& num, QString& units) const;
Clone this wiki locally