exif-log.h
Go to the documentation of this file.
/*
* Copyright (c) 2004 Lutz Mueller <lutz@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*/
#ifndef __EXIF_LOG_H__
#define __EXIF_LOG_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <libexif/exif-mem.h>
#include <stdarg.h>
typedef struct _ExifLog ExifLog;
ExifLog *exif_log_new (void);
ExifLog *exif_log_new_mem (ExifMem *);
void exif_log_ref (ExifLog *log);
void exif_log_unref (ExifLog *log);
void exif_log_free (ExifLog *log);
typedef enum {
EXIF_LOG_CODE_NONE,
EXIF_LOG_CODE_DEBUG,
EXIF_LOG_CODE_NO_MEMORY,
EXIF_LOG_CODE_CORRUPT_DATA
} ExifLogCode;
const char *exif_log_code_get_title (ExifLogCode code);
const char *exif_log_code_get_message (ExifLogCode code);
typedef void (* ExifLogFunc) (ExifLog *log, ExifLogCode, const char *domain,
const char *format, va_list args, void *data);
void exif_log_set_func (ExifLog *log, ExifLogFunc func, void *data);
#ifndef NO_VERBOSE_TAG_STRINGS
void exif_log (ExifLog *log, ExifLogCode, const char *domain,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,4,5)))
#endif
;
#else
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define exif_log(...) do { } while (0)
#elif defined(__GNUC__)
#define exif_log(x...) do { } while (0)
#else
#define exif_log (void)
#endif
#endif
void exif_logv (ExifLog *log, ExifLogCode, const char *domain,
const char *format, va_list args);
/* For your convenience */
#define EXIF_LOG_NO_MEMORY(l,d,s) exif_log ((l), EXIF_LOG_CODE_NO_MEMORY, (d), "Could not allocate %lu byte(s).", (unsigned long)(s))
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __EXIF_LOG_H__ */
exif_log_set_func
void exif_log_set_func(ExifLog *log, ExifLogFunc func, void *data)
Register log callback function.
Definition: exif-log.c:123
exif_mem_new_default
ExifMem * exif_mem_new_default(void)
Create a new ExifMem with default values for your convenience.
Definition: exif-mem.c:95
ExifLog
struct _ExifLog ExifLog
State maintained by the logging interface.
Definition: exif-log.h:34
exif_log_new
ExifLog * exif_log_new(void)
Create a new logging instance.
Definition: exif-log.c:86
exif_log_code_get_message
const char * exif_log_code_get_message(ExifLogCode code)
Return a verbose description of the given class of error log.
Definition: exif-log.c:62
exif_log_free
void exif_log_free(ExifLog *log)
Delete instance of ExifLog.
Definition: exif-log.c:112
exif_mem_unref
void exif_mem_unref(ExifMem *)
Unrefcount an ExifMem.
Definition: exif-mem.c:61
ExifLogFunc
void(* ExifLogFunc)(ExifLog *log, ExifLogCode, const char *domain, const char *format, va_list args, void *data)
Log callback function prototype.
Definition: exif-log.h:77
exif_log_code_get_title
const char * exif_log_code_get_title(ExifLogCode code)
Return a textual description of the given class of error log.
Definition: exif-log.c:53
exif-log.h
Log message infrastructure.
ExifMem
struct _ExifMem ExifMem
ExifMem define a memory allocator.
Definition: exif-mem.h:57
exif-mem.h
Define the ExifMem data type and the associated functions. ExifMem defines the memory management func...
exif_mem_ref
void exif_mem_ref(ExifMem *)
Refcount an ExifMem.
Definition: exif-mem.c:54