libwpg_utils.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwpg
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
00011  *
00012  * For minor contributions see the git repository.
00013  *
00014  * Alternatively, the contents of this file may be used under the terms
00015  * of the GNU Lesser General Public License Version 2.1 or later
00016  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00017  * applicable instead of those above.
00018  *
00019  * For further information visit http://libwpg.sourceforge.net
00020  */
00021 
00022 /* "This product is not manufactured, approved, or supported by
00023  * Corel Corporation or Corel Corporation Limited."
00024  */
00025 
00026 #ifndef __LIBWPG_UTILS_H__
00027 #define __LIBWPG_UTILS_H__
00028 
00029 #include <stdio.h>
00030 
00031 #include <librevenge-stream/librevenge-stream.h>
00032 
00033 #if defined(__clang__) || defined(__GNUC__)
00034 #define WPG_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
00035 #else
00036 #define WPG_ATTRIBUTE_PRINTF(fmt, arg)
00037 #endif
00038 
00039 //#define DEBUG // FIXME !
00040 
00041 // debug message includes source file and line number
00042 //#define VERBOSE_DEBUG 1
00043 
00044 // do nothing with debug messages in a release compile
00045 #ifdef DEBUG
00046 
00047 namespace libwpg
00048 {
00049 void debugPrint(const char *format, ...) WPG_ATTRIBUTE_PRINTF(1, 2);
00050 }
00051 
00052 #ifdef VERBOSE_DEBUG
00053 #define WPG_DEBUG_MSG(M) libwpg::debugPrint("%15s:%5d: ", __FILE__, __LINE__); libwpg::debugPrint M
00054 #define WPG_DEBUG(M) M
00055 #else
00056 #define WPG_DEBUG_MSG(M) libwpg::debugPrint M
00057 #define WPG_DEBUG(M) M
00058 #endif
00059 #else
00060 #define WPG_DEBUG_MSG(M)
00061 #define WPG_DEBUG(M)
00062 #endif
00063 
00064 namespace libwpg
00065 {
00066 
00067 unsigned long getRemainingLength(librevenge::RVNGInputStream *input);
00068 
00069 struct EndOfStreamException
00070 {
00071 };
00072 
00073 }
00074 
00075 #endif // __LIBWPG_UTILS_H__
00076 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */