10 #ifndef LIBETONYEK_UTILS_H_INCLUDED
11 #define LIBETONYEK_UTILS_H_INCLUDED
17 #include <boost/shared_ptr.hpp>
19 #include <librevenge/librevenge.h>
20 #include <librevenge-stream/librevenge-stream.h>
24 typedef unsigned char uint8_t;
25 typedef unsigned short uint16_t;
26 typedef unsigned uint32_t;
27 typedef unsigned __int64 uint64_t;
28 typedef signed char int8_t;
29 typedef short int16_t;
31 typedef __int64 int64_t;
43 #ifdef HAVE_INTTYPES_H
57 #define KEY_EPSILON 1e-9
58 #define KEY_ALMOST_ZERO(x) (std::fabs(x) < KEY_EPSILON)
60 #define KEY_NUM_ELEMENTS(array) (sizeof(array) / sizeof((array)[0]))
69 #define KEY_DEBUG_MSG(M) printf("%15s:%5d: ", FILE, LINE); printf M
70 #define KEY_DEBUG(M) M
72 #define KEY_DEBUG_MSG(M) printf M
73 #define KEY_DEBUG(M) M
76 #define KEY_DEBUG_MSG(M)
84 const double etonyek_half_pi(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00);
85 const double etonyek_third_pi(1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00);
86 const double etonyek_pi(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00);
87 const double etonyek_two_pi(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00);
89 const double etonyek_root_three(1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00);
90 const double etonyek_root_two(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00);
99 uint8_t
readU8(
const RVNGInputStreamPtr_t &
input,
bool =
false);
100 uint16_t
readU16(
const RVNGInputStreamPtr_t &
input,
bool bigEndian=
false);
101 uint32_t
readU32(
const RVNGInputStreamPtr_t &
input,
bool bigEndian=
false);
102 uint64_t
readU64(
const RVNGInputStreamPtr_t &
input,
bool bigEndian=
false);
129 #endif // LIBETONYEK_UTILS_H_INCLUDED
bool approxEqual(const KEYPath &left, const KEYPath &right, const double eps)
Definition: KEYPath.cpp:385
Definition: EtonyekDocument.cpp:40
const double etonyek_root_two(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00)
double y
Definition: KEYShape.cpp:96
Definition: libetonyek_utils.h:123
Definition: libetonyek_utils.h:119
double pt2in(const double d)
Convert a length from points to inches.
Definition: libetonyek_utils.cpp:91
Definition: libetonyek_utils.h:92
uint32_t readU32(const RVNGInputStreamPtr_t &input, bool bigEndian)
Definition: libetonyek_utils.cpp:54
const double etonyek_root_three(1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00)
double x
Definition: KEYShape.cpp:95
uint8_t readU8(const RVNGInputStreamPtr_t &input, bool)
Definition: libetonyek_utils.cpp:26
#define KEY_EPSILON
Definition: libetonyek_utils.h:57
uint64_t readU64(const RVNGInputStreamPtr_t &input, bool bigEndian)
Definition: libetonyek_utils.cpp:70
void operator()(void *)
Definition: libetonyek_utils.h:94
const double etonyek_two_pi(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00)
Definition: KEY2Token.h:164
boost::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:97
const double etonyek_half_pi(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00)
uint16_t readU16(const RVNGInputStreamPtr_t &input, bool bigEndian)
Definition: libetonyek_utils.cpp:38
RVNGInputStreamPtr_t input
Definition: EtonyekDocument.cpp:59
const double etonyek_pi(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00)
const double etonyek_third_pi(1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00)