Go to the documentation of this file.
   10 #ifndef INCLUDED_LIBMSPUB_UTILS_H 
   11 #define INCLUDED_LIBMSPUB_UTILS_H 
   20 #include <boost/cstdint.hpp> 
   22 #include <librevenge/librevenge.h> 
   24 #include <librevenge-stream/librevenge-stream.h> 
   29 #define M_PI 3.14159265358979323846 
   32 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT) 
   33 #  define MSPUB_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg))) 
   35 #  define MSPUB_ATTRIBUTE_PRINTF(fmt, arg) 
   38 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH) 
   39 #  define MSPUB_FALLTHROUGH [[clang::fallthrough]] 
   40 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH) 
   41 #  define MSPUB_FALLTHROUGH __attribute__((fallthrough)) 
   43 #  define MSPUB_FALLTHROUGH ((void) 0) 
   52 #define MSPUB_DEBUG_MSG(M) libmspub::debugPrint M 
   53 #define MSPUB_DEBUG(M) M 
   55 #define MSPUB_DEBUG_MSG(M) 
   56 #define MSPUB_DEBUG(M) 
   64 uint8_t 
readU8(librevenge::RVNGInputStream *input);
 
   65 uint16_t 
readU16(librevenge::RVNGInputStream *input);
 
   66 uint32_t 
readU32(librevenge::RVNGInputStream *input);
 
   67 uint64_t 
readU64(librevenge::RVNGInputStream *input);
 
   68 int8_t 
readS8(librevenge::RVNGInputStream *input);
 
   69 int16_t 
readS16(librevenge::RVNGInputStream *input);
 
   70 int32_t 
readS32(librevenge::RVNGInputStream *input);
 
   73 void readNBytes(librevenge::RVNGInputStream *input, 
unsigned long length, std::vector<unsigned char> &out);
 
   75 unsigned long getLength(librevenge::RVNGInputStream *input);
 
   77 void appendCharacters(librevenge::RVNGString &text, 
const std::vector<unsigned char> &characters, 
const char *encoding);
 
   79 bool stillReading(librevenge::RVNGInputStream *input, 
unsigned long until);
 
   81 void rotateCounter(
double &x, 
double &y, 
double centerX, 
double centerY, 
short rotation);
 
   82 void flipIfNecessary(
double &x, 
double &y, 
double centerX, 
double centerY, 
bool flipVertical, 
bool flipHorizontal);
 
   87 template <
class MapT> 
typename MapT::mapped_type *
getIfExists(MapT &map, 
const typename MapT::key_type &key)
 
   89   auto i = map.find(key);
 
   90   return i == map.end() ? nullptr : &(i->second);
 
   93 template <
class MapT> 
const typename MapT::mapped_type *
getIfExists_const(MapT &map, 
const typename MapT::key_type &key)
 
   95   auto i = map.find(key);
 
   96   return i == map.end() ? nullptr : &(i->second);
 
   99 template <
class MapT> 
typename MapT::mapped_type 
ptr_getIfExists(MapT &map, 
const typename MapT::key_type &key)
 
  101   typename MapT::iterator i = map.find(key);
 
  102   return i == map.end() ? NULL : i->second;
 
  113 librevenge::RVNGBinaryData 
inflateData(librevenge::RVNGBinaryData);
 
  117 #endif // INCLUDED_LIBMSPUB_UTILS_H 
  
 
double toFixedPoint(int fp)
Definition: libmspub_utils.cpp:125
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:292
uint64_t readU64(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:316
int32_t readS32(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:311
MapT::mapped_type * getIfExists(MapT &map, const typename MapT::key_type &key)
Definition: libmspub_utils.h:87
@ JPEG
Definition: MSPUBTypes.h:217
#define MSPUB_DEBUG_MSG(M)
Definition: libmspub_utils.h:55
#define ZLIB_CHUNK
Definition: libmspub_utils.cpp:21
const char * windowsCharsetNameByOriginalCharset(const char *name)
Definition: libmspub_utils.cpp:39
bool stillReading(librevenge::RVNGInputStream *input, unsigned long until)
Definition: libmspub_utils.cpp:416
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:266
Definition: libmspub_utils.h:110
@ PNG
Definition: MSPUBTypes.h:216
MapT::mapped_type ptr_getIfExists(MapT &map, const typename MapT::key_type &key)
Definition: libmspub_utils.h:99
void rotateCounter(double &x, double &y, double centerX, double centerY, short rotation)
Definition: libmspub_utils.cpp:96
void readNBytes(librevenge::RVNGInputStream *input, unsigned long length, std::vector< unsigned char > &out)
Definition: libmspub_utils.cpp:329
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:285
const MapT::mapped_type * getIfExists_const(MapT &map, const typename MapT::key_type &key)
Definition: libmspub_utils.h:93
ImgType
Definition: MSPUBTypes.h:214
const char * mimeByImgType(ImgType type)
Definition: libmspub_utils.cpp:72
unsigned correctModulo(int x, unsigned n)
Definition: libmspub_utils.cpp:151
int8_t readS8(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:301
double readFixedPoint(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:132
@ WMF
Definition: MSPUBTypes.h:218
@ TIFF
Definition: MSPUBTypes.h:220
Definition: libmspub_utils.h:106
@ EMF
Definition: MSPUBTypes.h:219
#define MSPUB_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmspub_utils.h:35
#define M_PI
Definition: libmspub_utils.h:29
@ DIB
Definition: MSPUBTypes.h:221
double doubleModulo(double x, double y)
Definition: libmspub_utils.cpp:108
unsigned long getLength(librevenge::RVNGInputStream *const input)
Definition: libmspub_utils.cpp:349
void flipIfNecessary(double &x, double &y, double centerX, double centerY, bool flipVertical, bool flipHorizontal)
Definition: libmspub_utils.cpp:137
@ PICT
Definition: MSPUBTypes.h:222
librevenge::RVNGBinaryData inflateData(librevenge::RVNGBinaryData deflated)
Definition: libmspub_utils.cpp:167
int16_t readS16(librevenge::RVNGInputStream *input)
Definition: libmspub_utils.cpp:306
void appendCharacters(librevenge::RVNGString &text, const std::vector< unsigned char > &characters, const char *encoding)
Definition: libmspub_utils.cpp:383
Generated for libmspub by 
doxygen 1.8.18