2004-09-08 Lutz Mueller <lutz@users.sourceforge.net>
[platform/upstream/libexif.git] / libexif / exif-log.h
1 /* exif-log.h
2  *
3  * Copyright © 2004 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_LOG_H__
22 #define __EXIF_LOG_H__
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 #include <stdarg.h>
29
30 typedef struct _ExifLog        ExifLog;
31
32 ExifLog *exif_log_new   (void);
33 void     exif_log_ref   (ExifLog *log);
34 void     exif_log_unref (ExifLog *log);
35 void     exif_log_free  (ExifLog *log);
36
37 typedef enum {
38         EXIF_LOG_CODE_NONE,
39         EXIF_LOG_CODE_DEBUG,
40         EXIF_LOG_CODE_NO_MEMORY,
41         EXIF_LOG_CODE_CORRUPT_DATA
42 } ExifLogCode;
43
44 typedef void (* ExifLogFunc) (ExifLog *log, ExifLogCode, const char *domain,
45                               const char *format, va_list args, void *data);
46
47 void     exif_log_set_func (ExifLog *log, ExifLogFunc func, void *data);
48
49 void     exif_log  (ExifLog *log, ExifLogCode, const char *domain,
50                     const char *format, ...);
51 void     exif_logv (ExifLog *log, ExifLogCode, const char *domain,
52                     const char *format, va_list args);
53
54 /* For your convenience */
55 #define EXIF_LOG_NO_MEMORY(l,d,s) exif_log (l, EXIF_LOG_CODE_NO_MEMORY, d, "Could not allocate %i byte(s).", s)
56
57 #ifdef __cplusplus
58 }
59 #endif /* __cplusplus */
60
61 #endif /* __EXIF_LOG_H__ */