10 #ifndef LIBETONYEK_UTILS_H_INCLUDED 11 #define LIBETONYEK_UTILS_H_INCLUDED 21 #include <boost/cstdint.hpp> 23 #include <librevenge/librevenge.h> 24 #include <librevenge-stream/librevenge-stream.h> 26 #define ETONYEK_EPSILON 1e-9 27 #define ETONYEK_ALMOST_ZERO(x) (std::fabs(x) < ETONYEK_EPSILON) 29 #define ETONYEK_NUM_ELEMENTS(array) (sizeof(array) / sizeof((array)[0])) 31 #if defined(HAVE_GCC_ATTRIBUTE_FORMAT) 32 # define ETONYEK_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg))) 34 # define ETONYEK_ATTRIBUTE_PRINTF(fmt, arg) 37 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH) 38 # define ETONYEK_FALLTHROUGH [[clang::fallthrough]] 39 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH) 40 # define ETONYEK_FALLTHROUGH __attribute__((fallthrough)) 42 # define ETONYEK_FALLTHROUGH ((void) 0) 51 #define ETONYEK_DEBUG_MSG(M) libetonyek::debugPrint M 52 #define ETONYEK_DEBUG(M) M 54 #define ETONYEK_DEBUG_MSG(M) 55 #define ETONYEK_DEBUG(M) 66 const double etonyek_half_pi(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00);
67 const double etonyek_third_pi(1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00);
68 const double etonyek_pi(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00);
69 const double etonyek_two_pi(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00);
71 const double etonyek_root_three(1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00);
72 const double etonyek_root_two(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00);
84 uint8_t
readU8(
const RVNGInputStreamPtr_t &input,
bool =
false);
85 uint16_t
readU16(
const RVNGInputStreamPtr_t &input,
bool bigEndian=
false);
86 uint32_t
readU32(
const RVNGInputStreamPtr_t &input,
bool bigEndian=
false);
87 uint64_t
readU64(
const RVNGInputStreamPtr_t &input,
bool bigEndian=
false);
89 uint64_t
readUVar(
const RVNGInputStreamPtr_t &input);
90 int64_t
readSVar(
const RVNGInputStreamPtr_t &input);
92 double readDouble(
const RVNGInputStreamPtr_t &input);
93 float readFloat(
const RVNGInputStreamPtr_t &input);
95 unsigned long getLength(
const RVNGInputStreamPtr_t &input);
109 assert(left.length() == right.length());
111 for (
int i = 0;
i != left.length(); ++
i)
157 #endif // LIBETONYEK_UTILS_H_INCLUDED Definition: IWORKBezierElement.cpp:18
#define ETONYEK_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libetonyek_utils.h:34
Definition: IWORKTypes.h:223
const double etonyek_root_two(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00)
unsigned long getRemainingLength(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:215
Definition: IWORKTypes.h:202
unsigned long getLength(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:184
Definition: IWORKTypes.h:71
double deg2rad(double value)
Convert an angle from degrees to radians.
Definition: libetonyek_utils.cpp:230
double y
Definition: IWORKShape.cpp:43
float readFloat(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:173
Definition: libetonyek_utils.h:151
Definition: libetonyek_utils.h:147
double pt2in(const double d)
Convert a length from points to inches.
Definition: libetonyek_utils.cpp:225
uint32_t readU32(const RVNGInputStreamPtr_t &input, bool bigEndian)
Definition: libetonyek_utils.cpp:76
Definition: IWORKToken.h:338
const double etonyek_root_three(1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00)
uint64_t readUVar(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:108
bool approxEqual(const IWORKPath &left, const IWORKPath &right, double eps=ETONYEK_EPSILON)
double x
Definition: IWORKShape.cpp:42
Definition: IWORKToken.h:100
Definition: IWORKToken.h:84
const char * name
Definition: IWORKToken.cpp:43
Definition: IWORKToken.h:354
Definition: KEY2Token.h:70
uint8_t readU8(const RVNGInputStreamPtr_t &input, bool)
Definition: libetonyek_utils.cpp:48
double rad2deg(double value)
Convert an angle from radians to degrees.
Definition: libetonyek_utils.cpp:242
int64_t readSVar(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:141
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:82
uint64_t readU64(const RVNGInputStreamPtr_t &input, bool bigEndian)
Definition: libetonyek_utils.cpp:92
void operator()(void *)
Definition: libetonyek_utils.h:79
const unsigned ETONYEK_EPOCH_BEGIN(978307200)
Definition: KEY1Token.h:53
const double etonyek_two_pi(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00)
librevenge::RVNGString makeColor(const IWORKColor &color)
Definition: libetonyek_utils.cpp:254
Definition: IWORKToken.h:323
Definition: libetonyek_utils.h:77
const double etonyek_half_pi(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00)
uint16_t readU16(const RVNGInputStreamPtr_t &input, bool bigEndian)
Definition: libetonyek_utils.cpp:60
#define ETONYEK_EPSILON
Definition: libetonyek_utils.h:26
double readDouble(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:162
void writeBorder(const IWORKStroke &stroke, const char *const name, librevenge::RVNGPropertyList &props)
Definition: libetonyek_utils.cpp:289
Definition: IWORKToken.h:267
const double etonyek_pi(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00)
const double etonyek_third_pi(1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00)