1 /*! \file exif-content.h
2 * \brief Handling EXIF IFDs
5 * Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __EXIF_CONTENT_H__
24 #define __EXIF_CONTENT_H__
28 #endif /* __cplusplus */
30 /*! Holds all EXIF tags in a single IFD */
31 typedef struct _ExifContent ExifContent;
32 typedef struct _ExifContentPrivate ExifContentPrivate;
34 #include <libexif/exif-tag.h>
35 #include <libexif/exif-entry.h>
36 #include <libexif/exif-data.h>
37 #include <libexif/exif-log.h>
38 #include <libexif/exif-mem.h>
45 /* Data containing this content */
48 ExifContentPrivate *priv;
52 ExifContent *exif_content_new (void);
53 ExifContent *exif_content_new_mem (ExifMem *);
54 void exif_content_ref (ExifContent *content);
55 void exif_content_unref (ExifContent *content);
56 void exif_content_free (ExifContent *content);
58 /*! Add an EXIF tag to an IFD.
59 * If this tag already exists in the IFD, this function does nothing.
62 * \param[in] entry EXIF entry to add
64 void exif_content_add_entry (ExifContent *c, ExifEntry *entry);
66 /*! Remove an EXIF tag from an IFD.
67 * If this tag does not exist in the IFD, this function does nothing.
70 * \param[in] e EXIF entry to remove
72 void exif_content_remove_entry (ExifContent *c, ExifEntry *e);
74 /*! Return the #ExifEntry in this IFD corresponding to the given tag.
76 * \param[in] content EXIF content for an IFD
77 * \param[in] tag EXIF tag to return
78 * \return #ExifEntry of the tag, or NULL on error
80 ExifEntry *exif_content_get_entry (ExifContent *content, ExifTag tag);
82 /*! Fix the IFD to bring it into specification. Call #exif_entry_fix on
83 * each entry in this IFD to fix existing entries, create any new entries
84 * that are mandatory in this IFD but do not yet exist, and remove any
85 * entries that are not allowed in this IFD.
87 * \param[in,out] c EXIF content for an IFD
89 void exif_content_fix (ExifContent *c);
91 typedef void (* ExifContentForeachEntryFunc) (ExifEntry *, void *user_data);
93 /*! Executes function on each EXIF tag in this IFD in turn.
95 * \param[in,out] content IFD over which to iterate
96 * \param[in] func function to call for each entry
97 * \param[in] user_data data to pass into func on each call
99 void exif_content_foreach_entry (ExifContent *content,
100 ExifContentForeachEntryFunc func,
103 /*! Return the IFD number in which the given #ExifContent is found.
105 * \param[in] c an #ExifContent*
106 * \return IFD number, or #EXIF_IFD_COUNT on error
108 ExifIfd exif_content_get_ifd (ExifContent *c);
110 /*! Return a textual representation of the EXIF data for a tag.
112 * \param[in] c #ExifContent* for an IFD
113 * \param[in] t #ExifTag to return
114 * \param[out] v char* buffer in which to store value
115 * \param[in] m unsigned int length of the buffer v
116 * \return the v pointer, or NULL on error
118 #define exif_content_get_value(c,t,v,m) \
119 (exif_content_get_entry (c,t) ? \
120 exif_entry_get_value (exif_content_get_entry (c,t),v,m) : NULL)
122 /*! Dump contents of the IFD to stdout.
123 * This is intended for diagnostic purposes only.
125 * \param[in] content IFD data
126 * \param[in] indent how many levels deep to indent the data
128 void exif_content_dump (ExifContent *content, unsigned int indent);
130 /*! Set the log message object for this IFD.
132 * \param[in] content IFD
133 * \param[in] log #ExifLog*
135 void exif_content_log (ExifContent *content, ExifLog *log);
139 #endif /* __cplusplus */
141 #endif /* __EXIF_CONTENT_H__ */