3 * Copyright (C) 2003 Lutz Mueller <lutz@users.sourceforge.net>
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.1 of the License, or (at your option) any later version.
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.
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., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
23 #include <libexif/exif-mnote-data.h>
24 #include <libexif/exif-mnote-data-priv.h>
29 struct _ExifMnoteDataPriv
31 unsigned int ref_count;
35 exif_mnote_data_construct (ExifMnoteData *d, ExifMem *mem)
37 if (!d || !mem) return;
39 d->priv = exif_mem_alloc (mem, sizeof (ExifMnoteDataPriv));
42 d->priv->ref_count = 1;
49 exif_mnote_data_ref (ExifMnoteData *d)
51 if (d && d->priv) d->priv->ref_count++;
55 exif_mnote_data_free (ExifMnoteData *d)
57 ExifMem *mem = d ? d->mem : NULL;
61 if (d->methods.free) d->methods.free (d);
62 exif_mem_free (mem, d->priv);
65 exif_log_unref (d->log);
66 exif_mem_free (mem, d);
71 exif_mnote_data_unref (ExifMnoteData *d)
73 if (!d || !d->priv) return;
74 if (d->priv->ref_count > 0) d->priv->ref_count--;
75 if (!d->priv->ref_count)
76 exif_mnote_data_free (d);
80 exif_mnote_data_load (ExifMnoteData *d, const unsigned char *buf,
81 unsigned int buf_size)
83 if (!d || !d->methods.load) return;
84 d->methods.load (d, buf, buf_size);
88 exif_mnote_data_save (ExifMnoteData *d, unsigned char **buf,
89 unsigned int *buf_size)
91 if (!d || !d->methods.save) return;
92 d->methods.save (d, buf, buf_size);
96 exif_mnote_data_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
98 if (!d || !d->methods.set_byte_order) return;
99 d->methods.set_byte_order (d, o);
103 exif_mnote_data_set_offset (ExifMnoteData *d, unsigned int o)
105 if (!d || !d->methods.set_offset) return;
106 d->methods.set_offset (d, o);
110 exif_mnote_data_count (ExifMnoteData *d)
112 if (!d || !d->methods.count) return 0;
113 return d->methods.count (d);
117 exif_mnote_data_get_id (ExifMnoteData *d, unsigned int n)
119 if (!d || !d->methods.get_id) return 0;
120 return d->methods.get_id (d, n);
124 exif_mnote_data_get_name (ExifMnoteData *d, unsigned int n)
126 if (!d || !d->methods.get_name) return NULL;
127 return d->methods.get_name (d, n);
131 exif_mnote_data_get_title (ExifMnoteData *d, unsigned int n)
133 if (!d || !d->methods.get_title) return NULL;
134 return d->methods.get_title (d, n);
138 exif_mnote_data_get_description (ExifMnoteData *d, unsigned int n)
140 if (!d || !d->methods.get_description) return NULL;
141 return d->methods.get_description (d, n);
145 exif_mnote_data_get_value (ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen)
147 if (!d || !d->methods.get_value) return NULL;
148 return d->methods.get_value (d, n, val, maxlen);
152 exif_mnote_data_log (ExifMnoteData *d, ExifLog *log)
155 exif_log_unref (d->log);