Go to the documentation of this file.
10 #ifndef __LIBCDR_UTILS_H__
11 #define __LIBCDR_UTILS_H__
21 #include <boost/cstdint.hpp>
23 #include <librevenge-stream/librevenge-stream.h>
24 #include <librevenge/librevenge.h>
27 #define M_PI 3.14159265358979323846
30 #define CDR_EPSILON 1E-6
31 #define CDR_ALMOST_ZERO(m) (fabs(m) <= CDR_EPSILON)
33 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
34 # define CDR_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
36 # define CDR_ATTRIBUTE_PRINTF(fmt, arg)
39 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
40 # define CDR_FALLTHROUGH [[clang::fallthrough]]
41 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
42 # define CDR_FALLTHROUGH __attribute__((fallthrough))
44 # define CDR_FALLTHROUGH ((void) 0)
53 #define CDR_DEBUG_MSG(M) libcdr::debugPrint M
54 #define CDR_DEBUG(M) M
56 #define CDR_DEBUG_MSG(M)
68 template<
typename T,
typename... Args>
71 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
74 uint8_t
readU8(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
75 uint16_t
readU16(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
76 uint32_t
readU32(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
77 uint64_t
readU64(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
78 int32_t
readS32(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
79 int16_t
readS16(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
81 double readDouble(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
83 double readFixedPoint(librevenge::RVNGInputStream *input,
bool bigEndian=
false);
85 unsigned long getLength(librevenge::RVNGInputStream *input);
90 void writeU16(librevenge::RVNGBinaryData &buffer,
const int value);
91 void writeU32(librevenge::RVNGBinaryData &buffer,
const int value);
92 void appendCharacters(librevenge::RVNGString &text, std::vector<unsigned char> characters,
unsigned short charset);
93 void appendCharacters(librevenge::RVNGString &text, std::vector<unsigned char> characters);
96 const char *toFourCC(
unsigned value,
bool bigEndian=
false);
117 #endif // __LIBCDR_UTILS_H__
Definition: libcdr_utils.h:63
Definition: libcdr_utils.h:99
#define CDR_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libcdr_utils.h:36
uint8_t readU8(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:163
void writeU16(librevenge::RVNGBinaryData &buffer, const int value)
Definition: libcdr_utils.cpp:311
Definition: libcdr_utils.h:111
unsigned long getLength(librevenge::RVNGInputStream *input)
Definition: libcdr_utils.cpp:270
uint64_t readU64(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:229
std::unique_ptr< T > make_unique(Args &&... args)
Definition: libcdr_utils.h:69
#define CDR_DEBUG_MSG(M)
Definition: libcdr_utils.h:56
double readFixedPoint(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:262
int cdr_round(double d)
Definition: libcdr_utils.cpp:306
int32_t readS32(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:224
uint16_t readU16(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:179
void writeU32(librevenge::RVNGBinaryData &buffer, const int value)
Definition: libcdr_utils.cpp:317
void appendCharacters(librevenge::RVNGString &text, std::vector< unsigned char > characters, unsigned short charset)
Definition: libcdr_utils.cpp:325
Definition: libcdr_utils.h:107
int16_t readS16(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:199
void operator()(void *) const
Definition: libcdr_utils.h:65
Definition: CDRCollector.h:24
Definition: libcdr_utils.h:103
double readDouble(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:249
unsigned long getRemainingLength(librevenge::RVNGInputStream *input)
Definition: libcdr_utils.cpp:301
uint32_t readU32(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:204
Generated for libcdr by
doxygen 1.8.16