libvisio_utils.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libvisio project.
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 
00010 #ifndef __LIBVISIO_UTILS_H__
00011 #define __LIBVISIO_UTILS_H__
00012 
00013 #include <boost/shared_ptr.hpp>
00014 
00015 #include "VSDTypes.h"
00016 
00017 #ifdef _MSC_VER
00018 
00019 typedef unsigned char uint8_t;
00020 typedef unsigned short uint16_t;
00021 typedef short int16_t;
00022 typedef unsigned uint32_t;
00023 typedef int int32_t;
00024 typedef unsigned __int64 uint64_t;
00025 
00026 #else /* !defined _MSC_VER */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 
00030 #include <config.h>
00031 
00032 #ifdef HAVE_STDINT_H
00033 #include <stdint.h>
00034 #endif
00035 
00036 #ifdef HAVE_INTTYPES_H
00037 #include <inttypes.h>
00038 #endif
00039 
00040 #else /* !defined HAVE_CONFIG_H */
00041 
00042 #include <stdint.h>
00043 #include <inttypes.h>
00044 
00045 #endif /* HAVE_CONFIG_H */
00046 
00047 #endif /* _MSC_VER */
00048 
00049 #include <librevenge/librevenge.h>
00050 #include <librevenge-stream/librevenge-stream.h>
00051 #include <unicode/utypes.h>
00052 
00053 // debug message includes source file and line number
00054 //#define VERBOSE_DEBUG 1
00055 
00056 // do nothing with debug messages in a release compile
00057 #ifdef DEBUG
00058 #ifdef VERBOSE_DEBUG
00059 #define VSD_DEBUG_MSG(M) libvisio::debugPrint("%15s:%5d: ", __FILE__, __LINE__); libvisio::debugPrint M
00060 #define VSD_DEBUG(M) M
00061 #else
00062 #define VSD_DEBUG_MSG(M) libvisio::debugPrint M
00063 #define VSD_DEBUG(M) M
00064 #endif
00065 #else
00066 #define VSD_DEBUG_MSG(M)
00067 #define VSD_DEBUG(M)
00068 #endif
00069 
00070 namespace libvisio
00071 {
00072 
00073 typedef boost::shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr_t;
00074 
00075 uint8_t readU8(librevenge::RVNGInputStream *input);
00076 uint16_t readU16(librevenge::RVNGInputStream *input);
00077 int16_t readS16(librevenge::RVNGInputStream *input);
00078 uint32_t readU32(librevenge::RVNGInputStream *input);
00079 int32_t readS32(librevenge::RVNGInputStream *input);
00080 uint64_t readU64(librevenge::RVNGInputStream *input);
00081 
00082 double readDouble(librevenge::RVNGInputStream *input);
00083 
00084 const librevenge::RVNGString getColourString(const Colour &c);
00085 
00086 void appendUCS4(librevenge::RVNGString &text, UChar32 ucs4Character);
00087 
00088 void debugPrint(const char *format, ...);
00089 
00090 class EndOfStreamException
00091 {
00092 };
00093 
00094 class XmlParserException
00095 {
00096 };
00097 
00098 class GenericException
00099 {
00100 };
00101 
00102 } // namespace libvisio
00103 
00104 #endif // __LIBVISIO_UTILS_H__
00105 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */