use common method when concatenating multiple values for a metadata element. Use a comma as separator

This commit is contained in:
Jean-Francois Dockes
2020-08-11 11:39:22 +02:00
parent fd0cf698a1
commit 13333e6512
6 changed files with 40 additions and 37 deletions
+2 -11
View File
@@ -22,6 +22,7 @@
#include <vector>
#include "smallut.h"
#include "rclutil.h"
namespace Rcl {
@@ -191,17 +192,7 @@ public:
// Create entry or append text to existing entry.
bool addmeta(const std::string& nm, const std::string& value) {
auto mit = meta.find(nm);
if (mit == meta.end()) {
meta[nm] = value;
} else if (mit->second.empty()) {
mit->second = value;
} else {
// It may happen that the same attr exists several times
// in the internfile stack. Avoid duplicating values.
if (mit->second != value)
mit->second += std::string(" - ") + value;
}
::addmeta(meta, nm, value);
return true;
}