31 #ifndef __LIBCDR_UTILS_H__
32 #define __LIBCDR_UTILS_H__
38 #include <libwpd-stream/libwpd-stream.h>
39 #include <libwpd/libwpd.h>
42 #define M_PI 3.14159265358979323846
45 #define CDR_EPSILON 1E-6
46 #define CDR_ALMOST_ZERO(m) (fabs(m) <= CDR_EPSILON)
50 typedef unsigned char uint8_t;
51 typedef unsigned short uint16_t;
52 typedef short int16_t;
53 typedef unsigned uint32_t;
55 typedef unsigned __int64 uint64_t;
56 typedef __int64 int64_t;
68 #ifdef HAVE_INTTYPES_H
88 #define CDR_DEBUG_MSG(M) printf("%15s:%5d: ", __FILE__, __LINE__); printf M
89 #define CDR_DEBUG(M) M
91 #define CDR_DEBUG_MSG(M) printf M
92 #define CDR_DEBUG(M) M
95 #define CDR_DEBUG_MSG(M)
102 uint8_t
readU8(WPXInputStream *input,
bool bigEndian=
false);
103 uint16_t
readU16(WPXInputStream *input,
bool bigEndian=
false);
104 uint32_t
readU32(WPXInputStream *input,
bool bigEndian=
false);
105 uint64_t
readU64(WPXInputStream *input,
bool bigEndian=
false);
106 int32_t
readS32(WPXInputStream *input,
bool bigEndian=
false);
107 int16_t
readS16(WPXInputStream *input,
bool bigEndian=
false);
109 double readDouble(WPXInputStream *input,
bool bigEndian=
false);
111 double readFixedPoint(WPXInputStream *input,
bool bigEndian=
false);
115 void writeU8(WPXBinaryData &buffer,
const int value);
116 void writeU16(WPXBinaryData &buffer,
const int value);
117 void writeU32(WPXBinaryData &buffer,
const int value);
118 void appendCharacters(WPXString &text, std::vector<unsigned char> characters,
unsigned short charset);
119 void appendCharacters(WPXString &text, std::vector<unsigned char> characters);
122 const char *toFourCC(
unsigned value,
bool bigEndian=
false);
143 #endif // __LIBCDR_UTILS_H__