CommonParser.h Source File documentation

CommonParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libcdr project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef __COMMONPARSER_H__
11 #define __COMMONPARSER_H__
12
13 #include <utility>
14 #include <vector>
15
16 #include <librevenge-stream/librevenge-stream.h>
17
18 namespace libcdr
19 {
20
21 class CDRCollector;
22 class CDRPath;
23
24 enum CoordinatePrecision
25 { PRECISION_UNKNOWN = 0, PRECISION_16BIT, PRECISION_32BIT };
26
27 class CommonParser
28 {
29 public:
30 CommonParser(CDRCollector *collector);
31 virtual ~CommonParser();
32
33 private:
34 CommonParser();
35 CommonParser(const CommonParser &);
36 CommonParser &operator=(const CommonParser &);
37
38
39 protected:
40 double readCoordinate(librevenge::RVNGInputStream *input, bool bigEndian = false);
41 unsigned readUnsigned(librevenge::RVNGInputStream *input, bool bigEndian = false);
42 unsigned short readUnsignedShort(librevenge::RVNGInputStream *input, bool bigEndian = false);
43 int readInteger(librevenge::RVNGInputStream *input, bool bigEndian = false);
44 double readAngle(librevenge::RVNGInputStream *input, bool bigEndian = false);
45 void readRImage(unsigned &colorModel, unsigned &width, unsigned &height, unsigned &bpp,
46 std::vector<unsigned> &palette, std::vector<unsigned char> &bitmap,
47 librevenge::RVNGInputStream *input, bool bigEndian = false);
48 void readBmpPattern(unsigned &width, unsigned &height, std::vector<unsigned char> &pattern,
49 unsigned length, librevenge::RVNGInputStream *input, bool bigEndian = false);
50
51 void processPath(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned char> &types, CDRPath &path);
52 void outputPath(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned char> &types);
53
54 CDRCollector *m_collector;
55 CoordinatePrecision m_precision;
56 };
57 } // namespace libcdr
58
59 #endif // __COMMONPARSER_H__
60 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::readU8
uint8_t readU8(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:163
CDR_DEBUG_MSG
#define CDR_DEBUG_MSG(M)
Definition: libcdr_utils.h:56
libcdr::CommonParser::readInteger
int readInteger(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:52
libcdr::CommonParser::m_precision
CoordinatePrecision m_precision
Definition: CommonParser.h:55
libcdr::CDRCollector
Definition: CDRCollector.h:61
CommonParser.h
libcdr::CommonParser::readAngle
double readAngle(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:61
libcdr::readS32
int32_t readS32(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:224
libcdr::readU16
uint16_t readU16(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:179
libcdr::CommonParser::readUnsignedShort
unsigned short readUnsignedShort(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:43
libcdr::CDRPath::appendCubicBezierTo
void appendCubicBezierTo(double x1, double y1, double x2, double y2, double x, double y)
Definition: CDRPath.cpp:646
CDRPath.h
libcdr::CommonParser::readBmpPattern
void readBmpPattern(unsigned &width, unsigned &height, std::vector< unsigned char > &pattern, unsigned length, librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:175
libcdr::CommonParser::~CommonParser
virtual ~CommonParser()
Definition: CommonParser.cpp:21
libcdr::UnknownPrecisionException
Definition: libcdr_utils.h:107
libcdr::CoordinatePrecision
CoordinatePrecision
Definition: CommonParser.h:24
libcdr::readS16
int16_t readS16(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:199
libcdr::CommonParser::readRImage
void readRImage(unsigned &colorModel, unsigned &width, unsigned &height, unsigned &bpp, std::vector< unsigned > &palette, std::vector< unsigned char > &bitmap, librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:135
CDRCollector.h
libcdr
Definition: CDRCollector.h:24
libcdr::CommonParser::processPath
void processPath(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned char > &types, CDRPath &path)
Definition: CommonParser.cpp:78
libcdr::CommonParser::readCoordinate
double readCoordinate(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:25
libcdr::CommonParser::CommonParser
CommonParser()
libcdr::CDRPath::appendClosePath
void appendClosePath()
Definition: CDRPath.cpp:666
libcdr::CommonParser::m_collector
CDRCollector * m_collector
Definition: CommonParser.h:54
libcdr::CDRPath::appendMoveTo
void appendMoveTo(double x, double y)
Definition: CDRPath.cpp:636
libcdr::PRECISION_UNKNOWN
Definition: CommonParser.h:25
libcdr::CommonParser::readUnsigned
unsigned readUnsigned(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:34
libcdr::CommonParser
Definition: CommonParser.h:27
libcdr::CommonParser::operator=
CommonParser & operator=(const CommonParser &)
libcdr::PRECISION_32BIT
Definition: CommonParser.h:25
M_PI
#define M_PI
Definition: libcdr_utils.h:27
libcdr::CDRPath::appendLineTo
void appendLineTo(double x, double y)
Definition: CDRPath.cpp:641
libcdr::CommonParser::outputPath
void outputPath(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned char > &types)
Definition: CommonParser.cpp:70
libcdr::CDRPath
Definition: CDRPath.h:36
libcdr_utils.h
libcdr::PRECISION_16BIT
Definition: CommonParser.h:25
libcdr::getRemainingLength
unsigned long getRemainingLength(librevenge::RVNGInputStream *input)
Definition: libcdr_utils.cpp:301
libcdr::readU32
uint32_t readU32(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: libcdr_utils.cpp:204