diff --git a/hoot-core/src/main/cpp/hoot/core/schema/TagComparator.h b/hoot-core/src/main/cpp/hoot/core/schema/TagComparator.h
index dccd261..f44b36d 100644
--- a/hoot-core/src/main/cpp/hoot/core/schema/TagComparator.h
+++ b/hoot-core/src/main/cpp/hoot/core/schema/TagComparator.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 TAGCOMPARATOR_H
@@ -52,14 +52,14 @@ public:
* @param keepAllUnknownTags If this is set to true then all unknown tags will simply be
* concatenated using Tag lists.
*/
- void averageTags(const Tags& t1, const Tags& t2, Tags& result, bool keepAllUnknownTags = false);
+ void averageTags(const Tags& t1, const Tags& t2, Tags& result, bool keepAllUnknownTags = false, bool caseSensitive = true);
/**
* @param keepAllUnknownTags If this is set to true then all unknown tags will simply be
* concatenated using Tag lists.
*/
void averageTags(const Tags& t1, double w1, const Tags& t2, double w2, Tags& result,
- bool keepAllUnknownTags = false);
+ bool keepAllUnknownTags = false, bool caseSensitive = true);
void compareEnumeratedTags(Tags t1, Tags t2, double& score, double& weight);
@@ -81,7 +81,7 @@ public:
* - Tags that share an ancestor are promoted to the first common ancestor
* - If there are no conflicting tags the tag is kept
*/
- Tags generalize(Tags t1, Tags t2, bool overwriteUnrecognizedTags = false);
+ Tags generalize(Tags t1, Tags t2, bool overwriteUnrecognizedTags = false, bool caseSensitive = true);
static TagComparator& getInstance();
@@ -90,13 +90,15 @@ public:
* to be the final "name" tag, and the "name" tag from t2
* gets demoted to alt_name, along with any alt_names from
* t1 & t2.
- * @param t1 - Tags that are given preference
- * @param t2 - These names/tags get demoted to alt_name
+ * @param t1 Tags that are given preference
+ * @param t2 These names/tags get demoted to alt_name
* @param result Tags w/names merged
* @param overwriteExcludeTagKeys keys of tags which should not be overwritten in t2
+ * @param caseSensitive True for case sensitive merge names
*/
void mergeNames(Tags& t1, Tags& t2, Tags& result,
- const QStringList& overwriteExcludeTagKeys = QStringList());
+ const QStringList& overwriteExcludeTagKeys = QStringList(),
+ bool caseSensitive = true);
/**
* Keep all names. If there is a conflict in tags between t1 and t2 then use the value in t1.
@@ -104,9 +106,22 @@ public:
* @param t1 tags to keep
* @param t2 tags to be overwritten
* @param overwriteExcludeTagKeys optional keys of tags to exclude being overwritten in t2
+ * @param caseSensitive True for case sensitive merge names
* @return merged tags
*/
- Tags overwriteMerge(Tags t1, Tags t2, const QStringList& overwriteExcludeTagKeys = QStringList());
+ Tags overwriteMerge(Tags t1, Tags t2, const QStringList& overwriteExcludeTagKeys = QStringList(), bool caseSensitive = true);
+
+ /**
+ * Replace all tags in t2 with those from t1
+ *
+ * @param t1 Tags that replace
+ * @param t2 Tags that are replaced
+ * @param overwriteExcludeTagKeys keys of tags which should not be overwritten in t2
+ * @param caseSensitive True for case sensitive merge names
+ * @return merged tags
+ */
+ Tags replaceMerge(const Tags& t1, const Tags& t2,
+ const QStringList& overwriteExcludeTagKeys = QStringList(), bool caseSensitive = true);
/**
* Determines whether two tag sets have identical non-name, non-metadata tags. Case sensitivity
@@ -114,10 +129,11 @@ public:
*
* @param t1 first set of tags to compare
* @param t2 second set of tags to compare
+ * @param caseSensitive True for case sensitive merge names
* @return true if both tag sets have identical non-name, non-metadata contents (excluding
* ordering); false otherwise
*/
- bool nonNameTagsExactlyMatch(const Tags& t1, const Tags& t2);
+ bool nonNameTagsExactlyMatch(const Tags& t1, const Tags& t2, bool caseSensitive = true);
/**
* Merge tags of type text
@@ -126,20 +142,13 @@ public:
* @param t2 second set of tags to merge
* @param result merged tags
* @param overwriteExcludeTagKeys keys of tags which should not be overwritten in t2
+ * @param caseSensitive True for case sensitive merge names
*/
void mergeText(Tags& t1, Tags& t2, Tags& result,
- const QStringList& overwriteExcludeTagKeys = QStringList());
-
- void setCaseSensitive(bool caseSensitive) { _caseSensitive = caseSensitive; }
+ const QStringList& overwriteExcludeTagKeys = QStringList(), bool caseSensitive = true);
private:
- bool _caseSensitive;
-
- static std::shared_ptr<TagComparator> _theInstance;
-
- TagComparator();
-
void _addDefaults(Tags& t);
void _addAsDefault(Tags& t, const QString& key, const QString& value);
@@ -167,7 +176,7 @@ private:
* overwrite the t2 values. t1 & t2 will be cleared when this is done.
*/
void _overwriteRemainingTags(Tags& t1, Tags& t2, Tags& result,
- const QStringList& overwriteExcludeTagKeys = QStringList());
+ const QStringList& overwriteExcludeTagKeys = QStringList(), bool caseSensitive = true);
void _overwriteUnrecognizedTags(Tags& t1, Tags& t2, Tags& result);
@@ -178,6 +187,13 @@ private:
void _promoteToCommonAncestor(Tags& t1, Tags& t2, Tags& result);
QSet<QString> _toSet(const Tags& t, const QString& k);
+
+ /** Default constructor/destructor */
+ TagComparator() = default;
+ ~TagComparator() = default;
+ /** Delete copy constructor and assignment operator */
+ TagComparator(const TagComparator&) = delete;
+ TagComparator& operator=(const TagComparator&) = delete;
};
}