~ubuntu-branches/ubuntu/intrepid/gwenview/intrepid

« back to all changes in this revision

Viewing changes to libgvexif/exif-format.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Martin
  • Date: 2004-06-13 18:55:04 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040613185504-net8ekxoswwvyxs9
Tags: 1.1.3-1
New upstream release. Translations now included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* exif-format.c
 
2
 *
 
3
 * Copyright � 2001 Lutz M�ller <lutz@users.sourceforge.net>
 
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., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#include "exif-format.h"
 
22
#include "i18n.h"
 
23
 
 
24
#include <stdlib.h>
 
25
 
 
26
static struct {
 
27
        ExifFormat format;
 
28
        const char *name;
 
29
        unsigned char size;
 
30
} ExifFormatTable[] = {
 
31
        {EXIF_FORMAT_BYTE,      "Byte",      1},
 
32
        {EXIF_FORMAT_ASCII,     "Ascii",     1},
 
33
        {EXIF_FORMAT_SHORT,     "Short",     2},
 
34
        {EXIF_FORMAT_LONG,      "Long",      4},
 
35
        {EXIF_FORMAT_RATIONAL,  "Rational",  8},
 
36
        {EXIF_FORMAT_SLONG,     "SLong",     4},
 
37
        {EXIF_FORMAT_SRATIONAL, "SRational", 8},
 
38
        {EXIF_FORMAT_UNDEFINED, N_("Undefined"), 1},
 
39
        {0, NULL, 0}
 
40
};
 
41
 
 
42
const char *
 
43
exif_format_get_name (ExifFormat format)
 
44
{
 
45
        unsigned int i;
 
46
 
 
47
        /*
 
48
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
49
        bindtextdomain (GETTEXT_PACKAGE, LIBEXIF_LOCALEDIR);
 
50
        */
 
51
 
 
52
        for (i = 0; ExifFormatTable[i].name; i++)
 
53
                if (ExifFormatTable[i].format == format)
 
54
                        return (_(ExifFormatTable[i].name));
 
55
        return (NULL);
 
56
}
 
57
 
 
58
unsigned char
 
59
exif_format_get_size (ExifFormat format)
 
60
{
 
61
        unsigned int i;
 
62
 
 
63
        for (i = 0; ExifFormatTable[i].size; i++)
 
64
                if (ExifFormatTable[i].format == format)
 
65
                        return (ExifFormatTable[i].size);
 
66
        return (0);
 
67
}