2008-02-17 Lutz Mueller <lutz@users.sourceforge.net>
[platform/upstream/libexif.git] / libexif / exif-entry.h
1 /*! \file exif-entry.h
2  *  \brief Handling EXIF entries
3  *
4  * Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, 
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details. 
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __EXIF_ENTRY_H__
23 #define __EXIF_ENTRY_H__
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 typedef struct _ExifEntry        ExifEntry;
30 typedef struct _ExifEntryPrivate ExifEntryPrivate;
31
32 #include <libexif/exif-content.h>
33 #include <libexif/exif-format.h>
34 #include <libexif/exif-mem.h>
35
36 /*! */
37 struct _ExifEntry {
38         ExifTag tag;
39         ExifFormat format;
40         unsigned long components;
41
42         unsigned char *data;
43         unsigned int size;
44
45         /* Content containing this entry */
46         ExifContent *parent;
47
48         ExifEntryPrivate *priv;
49 };
50
51 /* Lifecycle */
52
53 /*! Reserve memory for and initialize new #ExifEntry* */
54 ExifEntry  *exif_entry_new     (void);
55
56 ExifEntry  *exif_entry_new_mem (ExifMem *);
57
58 /*! Increase reference counter for #ExifEntry* */
59 void        exif_entry_ref     (ExifEntry *entry);
60
61 /*! Decrease reference counter for #ExifEntry* */
62 void        exif_entry_unref   (ExifEntry *entry);
63
64 /*! Actually free the #ExifEntry*
65  *
66  * \deprecated Should not be called directly. Use exif_entry_ref() and
67  *             exif_entry_unref() instead.
68  */
69 void        exif_entry_free  (ExifEntry *entry);
70
71 void        exif_entry_initialize (ExifEntry *entry, ExifTag tag);
72 void        exif_entry_fix        (ExifEntry *entry);
73
74 /* For your convenience */
75
76 /*! Return the value of the EXIF entry
77  *
78  * CAUTION: The character set of the returned string is not defined.
79  *          It may be UTF-8, latin1, the native encoding of the
80  *          computer, or the native encoding of the camera.
81  */
82 const char *exif_entry_get_value (ExifEntry *entry, char *val,
83                                   unsigned int maxlen);
84
85 /*! Dump text representation of #ExifEntry to stdout */
86 void        exif_entry_dump      (ExifEntry *entry, unsigned int indent);
87
88 #define exif_entry_get_ifd(e) ((e)?exif_content_get_ifd((e)->parent):EXIF_IFD_COUNT)
89
90 #ifdef __cplusplus
91 }
92 #endif /* __cplusplus */
93
94 #endif /* __EXIF_ENTRY_H__ */