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