Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef INCLUDED_LIBEPUBGEN_UTILS_H
00011 #define INCLUDED_LIBEPUBGEN_UTILS_H
00012
00013 #ifdef HAVE_CONFIG_H
00014 #include "config.h"
00015 #endif
00016
00017 #include <memory>
00018
00019 #include <boost/cstdint.hpp>
00020
00021 #include <librevenge-stream/librevenge-stream.h>
00022
00023 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
00024 #define EPUBGEN_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
00025 #else
00026 #define EPUBGEN_ATTRIBUTE_PRINTF(fmt, arg)
00027 #endif
00028
00029
00030 #ifdef DEBUG
00031
00032 namespace libepubgen
00033 {
00034 void debugPrint(const char *format, ...) EPUBGEN_ATTRIBUTE_PRINTF(1, 2);
00035 }
00036
00037 #define EPUBGEN_DEBUG_MSG(M) libepubgen::debugPrint M
00038 #define EPUBGEN_DEBUG(M) M
00039
00040 #else
00041
00042 #define EPUBGEN_DEBUG_MSG(M)
00043 #define EPUBGEN_DEBUG(M)
00044
00045 #endif
00046
00047 #define EPUBGEN_NUM_ELEMENTS(array) (sizeof(array) / sizeof(array[0]))
00048
00049 namespace libepubgen
00050 {
00051
00052 typedef std::shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr_t;
00053
00054 struct EPUBGENDummyDeleter
00055 {
00056 void operator()(void *) {}
00057 };
00058
00059 template<typename T, typename... Args>
00060 std::unique_ptr<T> make_unique(Args &&... args)
00061 {
00062 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
00063 }
00064
00065 class GenericException
00066 {
00067 };
00068
00069 }
00070
00071 #endif // INCLUDED_LIBEPUBGEN_UTILS_H
00072
00073