00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <libexif/exif-format.h>
00024 #include <libexif/i18n.h>
00025
00026 #include <stdlib.h>
00027
00028 static struct {
00029 ExifFormat format;
00030 const char *name;
00031 unsigned char size;
00032 } ExifFormatTable[] = {
00033 {EXIF_FORMAT_BYTE, N_("Byte"), 1},
00034 {EXIF_FORMAT_ASCII, N_("Ascii"), 1},
00035 {EXIF_FORMAT_SHORT, N_("Short"), 2},
00036 {EXIF_FORMAT_LONG, N_("Long"), 4},
00037 {EXIF_FORMAT_RATIONAL, N_("Rational"), 8},
00038 {EXIF_FORMAT_SBYTE, N_("SByte"), 1},
00039 {EXIF_FORMAT_SSHORT, N_("SShort"), 2},
00040 {EXIF_FORMAT_SLONG, N_("SLong"), 4},
00041 {EXIF_FORMAT_SRATIONAL, N_("SRational"), 8},
00042 {EXIF_FORMAT_FLOAT, N_("Float"), 4},
00043 {EXIF_FORMAT_DOUBLE, N_("Double"), 8},
00044 {EXIF_FORMAT_UNDEFINED, N_("Undefined"), 1},
00045 {0, NULL, 0}
00046 };
00047
00048 const char *
00049 exif_format_get_name (ExifFormat format)
00050 {
00051 unsigned int i;
00052
00053
00054
00055
00056
00057
00058
00059
00060 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
00061
00062 for (i = 0; ExifFormatTable[i].name; i++)
00063 if (ExifFormatTable[i].format == format)
00064 return _(ExifFormatTable[i].name);
00065 return NULL;
00066 }
00067
00068 unsigned char
00069 exif_format_get_size (ExifFormat format)
00070 {
00071 unsigned int i;
00072
00073 for (i = 0; ExifFormatTable[i].size; i++)
00074 if (ExifFormatTable[i].format == format)
00075 return ExifFormatTable[i].size;
00076 return 0;
00077 }