libvisio_utils.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

libvisio_utils.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libvisio project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef __LIBVISIO_UTILS_H__
11 #define __LIBVISIO_UTILS_H__
12
13 #include <boost/shared_ptr.hpp>
14
15 #include "VSDTypes.h"
16
17 #define VSD_EPSILON 1E-6
18 #define VSD_ALMOST_ZERO(m) (fabs(m) <= VSD_EPSILON)
19
20 #ifdef _MSC_VER
21
22 typedef unsigned char uint8_t;
23 typedef unsigned short uint16_t;
24 typedef short int16_t;
25 typedef unsigned uint32_t;
26 typedef int int32_t;
27 typedef unsigned __int64 uint64_t;
28
29 #else /* !defined _MSC_VER */
30
31 #ifdef HAVE_CONFIG_H
32
33 #include <config.h>
34
35 #ifdef HAVE_STDINT_H
36 #include <stdint.h>
37 #endif
38
39 #ifdef HAVE_INTTYPES_H
40 #include <inttypes.h>
41 #endif
42
43 #else /* !defined HAVE_CONFIG_H */
44
45 #include <stdint.h>
46 #include <inttypes.h>
47
48 #endif /* HAVE_CONFIG_H */
49
50 #endif /* _MSC_VER */
51
52 #include <librevenge/librevenge.h>
53 #include <librevenge-stream/librevenge-stream.h>
54 #include <unicode/utypes.h>
55
56 // debug message includes source file and line number
57 //#define VERBOSE_DEBUG 1
58
59 // do nothing with debug messages in a release compile
60 #ifdef DEBUG
61 #ifdef VERBOSE_DEBUG
62 #define VSD_DEBUG_MSG(M) libvisio::debugPrint("%15s:%5d: ", __FILE__, __LINE__); libvisio::debugPrint M
63 #define VSD_DEBUG(M) M
64 #else
65 #define VSD_DEBUG_MSG(M) libvisio::debugPrint M
66 #define VSD_DEBUG(M) M
67 #endif
68 #else
69 #define VSD_DEBUG_MSG(M)
70 #define VSD_DEBUG(M)
71 #endif
72
73 namespace libvisio
74 {
75
76 typedef boost::shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr_t;
77
78 uint8_t readU8(librevenge::RVNGInputStream *input);
79 uint16_t readU16(librevenge::RVNGInputStream *input);
80 int16_t readS16(librevenge::RVNGInputStream *input);
81 uint32_t readU32(librevenge::RVNGInputStream *input);
82 int32_t readS32(librevenge::RVNGInputStream *input);
83 uint64_t readU64(librevenge::RVNGInputStream *input);
84
85 double readDouble(librevenge::RVNGInputStream *input);
86
87 const librevenge::RVNGString getColourString(const Colour &c);
88
89 void appendUCS4(librevenge::RVNGString &text, UChar32 ucs4Character);
90
91 void debugPrint(const char *format, ...);
92
93 class EndOfStreamException
94 {
95 };
96
97 class XmlParserException
98 {
99 };
100
101 class GenericException
102 {
103 };
104
105 } // namespace libvisio
106
107 #endif // __LIBVISIO_UTILS_H__
108 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libvisio::EndOfStreamException
Definition: libvisio_utils.h:93
libvisio::appendUCS4
void appendUCS4(librevenge::RVNGString &text, UChar32 ucs4Character)
Definition: libvisio_utils.cpp:112
libvisio::getColourString
const librevenge::RVNGString getColourString(const Colour &c)
Definition: libvisio_utils.cpp:105
libvisio::Colour
Definition: VSDTypes.h:73
libvisio::readS16
int16_t readS16(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:50
libvisio::RVNGInputStreamPtr_t
boost::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libvisio_utils.h:76
libvisio::readS32
int32_t readS32(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:71
libvisio::readDouble
double readDouble(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:92
VSDTypes.h
libvisio::XmlParserException
Definition: libvisio_utils.h:97
libvisio::debugPrint
void debugPrint(const char *format,...)
Definition: libvisio_utils.cpp:127
libvisio
Definition: libvisio_utils.h:73
libvisio::GenericException
Definition: libvisio_utils.h:101
libvisio::readU32
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:55
libvisio::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:18
libvisio::readU16
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:34
libvisio::readU64
uint64_t readU64(librevenge::RVNGInputStream *input)
Definition: libvisio_utils.cpp:76