EXIF library (libexif) Internals  0.6.24
mnote-apple-tag.c
Go to the documentation of this file.
1 /* mnote-apple-tag.c:
2  *
3  * Copyright (c) 2018 zhanwang-sky <zhanwang_sky@163.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301 USA.
19  */
20 
21 #include <config.h>
22 #include "mnote-apple-tag.h"
23 
24 #include <libexif/i18n.h>
25 #include <libexif/exif-utils.h>
26 
27 #include <stdlib.h>
28 
29 static const struct {
31  const char *name;
32  const char *title;
33  const char *description;
34 } table[] = {
35 #ifndef NO_VERBOSE_TAG_STRINGS
36  {MNOTE_APPLE_TAG_HDR, "HDR", N_("HDR Mode"), ""},
37  {MNOTE_APPLE_TAG_RUNTIME, "RUNTIME", N_("Runtime"), ""},
38  {MNOTE_APPLE_TAG_ACCELERATION_VECTOR, "ACCELERATION_VECTOR", N_("Acceleration Vector"), ""},
39  {MNOTE_APPLE_TAG_HDR, "HDR", N_("HDR"), ""},
40  {MNOTE_APPLE_TAG_BURST_UUID, "BURST_UUID", N_("Burst UUID"), ""},
41  {MNOTE_APPLE_TAG_MEDIA_GROUP_UUID, "MEDIA_GROUP_UUID", N_("Media Group UUID"), ""},
42  {MNOTE_APPLE_TAG_IMAGE_UNIQUE_ID, "IMAGE_UNIQUE_ID", N_("Image Unique ID"), ""},
43 #endif
44  {0, NULL, NULL, NULL}
45 };
46 
47 const char *
49  unsigned int i;
50 
51  for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) {
52  if (table[i].tag == t) {
53  return table[i].name;
54  }
55  }
56 
57  return NULL;
58 }
59 
60 const char *
62  unsigned int i;
63 
64  (void) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
65  for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) {
66  if (table[i].tag == t) {
67  return _(table[i].title);
68  }
69  }
70 
71  return NULL;
72 }
73 
74 const char *
76  unsigned int i;
77 
78  for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) {
79  if (table[i].tag == t) {
80  if (!table[i].description || !*table[i].description) {
81  return "";
82  }
83  (void) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
84  return _(table[i].description);
85  }
86  }
87 
88  return NULL;
89 }
EXIF data manipulation functions and types.
#define _(String)
Definition: i18n.h:48
#define N_(String)
Definition: i18n.h:49
#define bindtextdomain(Domain, Directory)
Definition: i18n.h:46
MnoteAppleTag tag
const char * description
const char * title
const char * name
const char * mnote_apple_tag_get_title(MnoteAppleTag t)
static const struct @0 table[]
const char * mnote_apple_tag_get_description(MnoteAppleTag t)
const char * mnote_apple_tag_get_name(MnoteAppleTag t)
@ MNOTE_APPLE_TAG_RUNTIME
@ MNOTE_APPLE_TAG_ACCELERATION_VECTOR
@ MNOTE_APPLE_TAG_MEDIA_GROUP_UUID
@ MNOTE_APPLE_TAG_IMAGE_UNIQUE_ID
@ MNOTE_APPLE_TAG_HDR
@ MNOTE_APPLE_TAG_BURST_UUID
enum _MnoteAppleTag MnoteAppleTag

libexif Generated by doxygen