2001-12-21 Lutz Müller <urc8@rz.uni-karlsruhe.de>
[platform/upstream/libexif.git] / libexif / exif-entry.h
1 /* exif-entry.h
2  *
3  * Copyright (C) 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 #ifndef __EXIF_ENTRY_H__
22 #define __EXIF_ENTRY_H__
23
24 #include <libexif/exif-utils.h>
25
26 typedef struct _ExifEntry        ExifEntry;
27 typedef struct _ExifEntryPrivate ExifEntryPrivate;
28
29 #include <libexif/exif-content.h>
30
31 typedef enum _ExifFormat ExifFormat;
32 enum _ExifFormat {
33         EXIF_FORMAT_BYTE       =  1,
34         EXIF_FORMAT_ASCII      =  2,
35         EXIF_FORMAT_SHORT      =  3,
36         EXIF_FORMAT_LONG       =  4,
37         EXIF_FORMAT_RATIONAL   =  5,
38         EXIF_FORMAT_UNDEFINED  =  7,
39         EXIF_FORMAT_SLONG      =  9,
40         EXIF_FORMAT_SRATIONAL  = 10,
41 };
42
43 struct _ExifEntry {
44         ExifByteOrder order;
45         ExifTag tag;
46         ExifFormat format;
47         unsigned long components;
48
49         unsigned char *data;
50         unsigned int size;
51
52         ExifContent *content;
53
54         /* Content containing this entry */
55         ExifContent *parent;
56
57         ExifEntryPrivate *priv;
58 };
59
60 /* Lifecycle */
61 ExifEntry  *exif_entry_new   (void);
62 void        exif_entry_ref   (ExifEntry *entry);
63 void        exif_entry_unref (ExifEntry *entry);
64 void        exif_entry_free  (ExifEntry *entry);
65
66 /* Notification */
67 typedef enum _ExifEntryEvent ExifEntryEvent;
68 enum _ExifEntryEvent {
69         EXIF_ENTRY_EVENT_CHANGED = 1 << 0
70 };
71 typedef void (* ExifEntryNotifyFunc)  (ExifEntry *entry, void *data);
72 unsigned int exif_entry_add_notify    (ExifEntry *entry, ExifEntryEvent events,
73                                        ExifEntryNotifyFunc func, void *data);
74 void         exif_entry_remove_notify (ExifEntry *entry, unsigned int id);
75 void         exif_entry_notify        (ExifEntry *entry, ExifEntryEvent event);
76
77 void        exif_entry_parse     (ExifEntry *entry, const unsigned char *data,
78                                   unsigned int size, unsigned int offset,
79                                   ExifByteOrder order);
80
81 void        exif_entry_initialize (ExifEntry *entry, ExifTag tag);
82
83 const char *exif_entry_get_value  (ExifEntry *entry);
84
85 void        exif_entry_dump      (ExifEntry *entry, unsigned int indent);
86
87 #endif /* __EXIF_ENTRY_H__ */