#include <unistd.h>
+#include <algorithm>
+#include <array>
#include <clocale>
#include <cstdio>
#include <cstdlib>
/**
* @brief Tags that will be written to all files in a group - selected by: options->metadata.sync_grouped_files, Preferences/Metadata/Write The Same Description Tags To All Grouped Sidecars
*/
-// @todo Use std::array
-const gchar *group_keys[] = {
+constexpr std::array<const gchar *, 21> group_keys{
"Xmp.dc.title",
"Xmp.photoshop.Urgency",
"Xmp.photoshop.Category",
"Xmp.dc.rights",
"Xmp.dc.description",
"Xmp.photoshop.CaptionWriter",
- nullptr
};
inline gboolean is_keywords_separator(gchar c)
return g_list_length(metadata_write_queue);
}
-static gboolean metadata_check_key(const gchar *keys[], const gchar *key)
-{
- const gchar **k = keys;
-
- while (*k)
- {
- if (strcmp(key, *k) == 0) return TRUE;
- k++;
- }
- return FALSE;
-}
-
gboolean metadata_write_revert(FileData *fd, const gchar *key)
{
if (!fd->modified_xmp) return FALSE;
file_data_increment_version(fd);
file_data_send_notification(fd, NOTIFY_METADATA);
- if (options->metadata.sync_grouped_files && metadata_check_key(group_keys, key))
+ auto metadata_check_key = [key](const gchar *k) { return strcmp(key, k) == 0; };
+ if (options->metadata.sync_grouped_files && std::any_of(group_keys.cbegin(), group_keys.cend(), metadata_check_key))
{
GList *work = fd->sidecar_files;