17 #ifndef LIBEBOOK_UTILS_H_INCLUDED
18 #define LIBEBOOK_UTILS_H_INCLUDED
26 #include <boost/shared_ptr.hpp>
28 #include <libwpd-stream/libwpd-stream.h>
29 #include <libwpd/libwpd.h>
33 typedef unsigned char uint8_t;
34 typedef unsigned short uint16_t;
35 typedef short int16_t;
36 typedef unsigned uint32_t;
38 typedef unsigned __int64 uint64_t;
39 typedef __int64 int64_t;
51 #ifdef HAVE_INTTYPES_H
71 #define EBOOK_DEBUG_MSG(M) std::printf("%15s:%5d: ", __FILE__, __LINE__); std::printf M
72 #define EBOOK_DEBUG(M) M
74 #define EBOOK_DEBUG_MSG(M) std::printf M
75 #define EBOOK_DEBUG(M) M
78 #define EBOOK_DEBUG_MSG(M)
79 #define EBOOK_DEBUG(M)
82 #define EBOOK_NUM_ELEMENTS(array) sizeof(array)/sizeof(array[0])
87 uint8_t
readU8(WPXInputStream *input,
bool =
false);
88 uint16_t
readU16(WPXInputStream *input,
bool bigEndian=
false);
89 uint32_t
readU32(WPXInputStream *input,
bool bigEndian=
false);
90 uint64_t
readU64(WPXInputStream *input,
bool bigEndian=
false);
92 const unsigned char *
readNBytes(WPXInputStream *input,
unsigned long numBytes);
97 void skip(WPXInputStream *input,
unsigned long numBytes);
99 void seek(WPXInputStream *input,
unsigned long pos);
102 unsigned long getLength(WPXInputStream *input);
104 uint8_t
readU8(boost::shared_ptr<WPXInputStream> input,
bool =
false);
105 uint16_t
readU16(boost::shared_ptr<WPXInputStream> input,
bool bigEndian=
false);
106 uint32_t
readU32(boost::shared_ptr<WPXInputStream> input,
bool bigEndian=
false);
107 uint64_t
readU64(boost::shared_ptr<WPXInputStream> input,
bool bigEndian=
false);
109 const unsigned char *
readNBytes(boost::shared_ptr<WPXInputStream> input,
unsigned long numBytes);
111 std::string
readCString(boost::shared_ptr<WPXInputStream> input);
114 void skip(boost::shared_ptr<WPXInputStream> input,
unsigned long numBytes);
116 void seek(boost::shared_ptr<WPXInputStream> input,
unsigned long pos);
117 void seekRelative(boost::shared_ptr<WPXInputStream> input,
long pos);
119 unsigned long getLength(boost::shared_ptr<WPXInputStream> input);
133 #endif // LIBEBOOK_UTILS_H_INCLUDED
Definition: libebook_utils.h:127
Definition: libebook_utils.h:121
unsigned long getLength(WPXInputStream *const input)
Definition: libebook_utils.cpp:162
void seekRelative(WPXInputStream *const input, const long pos)
Definition: libebook_utils.cpp:154
uint64_t readU64(WPXInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:83
EndOfStreamException()
Definition: libebook_utils.cpp:241
string readCString(WPXInputStream *input)
Definition: libebook_utils.cpp:112
uint32_t readU32(WPXInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:67
const unsigned char * readNBytes(WPXInputStream *const input, const unsigned long numBytes)
Definition: libebook_utils.cpp:99
uint16_t readU16(WPXInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:51
void skip(WPXInputStream *input, unsigned long numBytes)
Definition: libebook_utils.cpp:139
void seek(WPXInputStream *const input, const unsigned long pos)
Definition: libebook_utils.cpp:146
uint8_t readU8(WPXInputStream *input, bool)
Definition: libebook_utils.cpp:39
string readPascalString(WPXInputStream *input)
Definition: libebook_utils.cpp:127