summaryrefslogtreecommitdiff
path: root/src/lib/libsdw_internal.h
blob: 729c941686f924fe568131961cad52b8fa627469 (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
113
114
115
116
117
118
119
120
121
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libsdw
 * Version: MPL 2.0 / LGPLv2.1+
 *
 * 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/.
 *
 * Major Contributor(s):
 * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
 *
 * For minor contributions see the git repository.
 *
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU Lesser General Public License Version 2.1 or later
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
 * applicable instead of those above.
 *
 * For further information visit http://libsdw.sourceforge.net
 */

#ifndef LIBSDW_INTERNAL_H
#define LIBSDW_INTERNAL_H

#include <assert.h>
#ifdef DEBUG
#include <stdio.h>
#endif

#include <iostream>
#include <map>
#include <string>

#include <libwpd-stream/libwpd-stream.h>
#include <libwpd/libwpd.h>

class WPXBinaryData;

#if defined(_MSC_VER) || defined(__DJGPP__)
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned uint32_t;
typedef signed int int32_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 <libwpd/libwpd.h>
#include <libwpd-stream/libwpd-stream.h>

/* ---------- debug  --------------- */
#ifdef DEBUG
#define SDW_DEBUG_MSG(M) printf M
#else
#define SDW_DEBUG_MSG(M)
#endif

/* ---------- exception  ------------ */
namespace libsdw
{
// Various exceptions
class EndOfStreamException
{
	// needless to say, we could flesh this class out a bit
};

class FileException
{
	// needless to say, we could flesh this class out a bit
};

class ParseException
{
	// needless to say, we could flesh this class out a bit
};

class GenericException
{
	// needless to say, we could flesh this class out a bit
};
} // namespace libsdw

/* ---------- input ----------------- */
namespace libsdw
{
uint8_t readU8(WPXInputStream *input);
uint16_t readU16(WPXInputStream *input);
uint32_t readU32(WPXInputStream *input);

int8_t readS8(WPXInputStream *input);
int16_t readS16(WPXInputStream *input);
int32_t readS32(WPXInputStream *input);

WPXString readString(WPXInputStream *input);
} // namespace libsdw

#endif /* LIBSDW_INTERNAL_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */