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 "CDRCollector.h"
14 #include "CDRPath.h"
15
16 namespace libcdr
17 {
18
19 enum CoordinatePrecision
20 { PRECISION_UNKNOWN = 0, PRECISION_16BIT, PRECISION_32BIT };
21
22 class CommonParser
23 {
24 public:
25 CommonParser(CDRCollector *collector);
26 virtual ~CommonParser();
27
28 private:
29 CommonParser();
30 CommonParser(const CommonParser &);
31 CommonParser &operator=(const CommonParser &);
32
33
34 protected:
35 double readCoordinate(librevenge::RVNGInputStream *input, bool bigEndian = false);
36 unsigned readUnsigned(librevenge::RVNGInputStream *input, bool bigEndian = false);
37 unsigned short readUnsignedShort(librevenge::RVNGInputStream *input, bool bigEndian = false);
38 int readInteger(librevenge::RVNGInputStream *input, bool bigEndian = false);
39 double readAngle(librevenge::RVNGInputStream *input, bool bigEndian = false);
40 void readRImage(unsigned &colorModel, unsigned &width, unsigned &height, unsigned &bpp,
41 std::vector<unsigned> &palette, std::vector<unsigned char> &bitmap,
42 librevenge::RVNGInputStream *input, bool bigEndian = false);
43 void readBmpPattern(unsigned &width, unsigned &height, std::vector<unsigned char> &pattern,
44 unsigned length, librevenge::RVNGInputStream *input, bool bigEndian = false);
45
46 void processPath(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned char> &types, CDRPath &path);
47 void outputPath(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned char> &types);
48
49 CDRCollector *m_collector;
50 CoordinatePrecision m_precision;
51 };
52 } // namespace libcdr
53
54 #endif // __COMMONPARSER_H__
55 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CommonParser
Definition: CommonParser.h:22
libcdr::CommonParser::processPath
void processPath(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned char > &types, CDRPath &path)
Definition: CommonParser.cpp:79
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:136
libcdr::CDRPath
Definition: CDRPath.h:34
libcdr::CommonParser::readCoordinate
double readCoordinate(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:26
libcdr::CommonParser::m_collector
CDRCollector * m_collector
Definition: CommonParser.h:49
libcdr::CommonParser::readUnsigned
unsigned readUnsigned(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:35
libcdr::PRECISION_UNKNOWN
Definition: CommonParser.h:20
libcdr::CommonParser::operator=
CommonParser & operator=(const CommonParser &)
libcdr::PRECISION_32BIT
Definition: CommonParser.h:20
libcdr::CoordinatePrecision
CoordinatePrecision
Definition: CommonParser.h:19
libcdr::CommonParser::outputPath
void outputPath(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned char > &types)
Definition: CommonParser.cpp:71
libcdr
Definition: CDRCollector.h:29
libcdr::CommonParser::m_precision
CoordinatePrecision m_precision
Definition: CommonParser.h:50
libcdr::CommonParser::readAngle
double readAngle(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:62
libcdr::CommonParser::readInteger
int readInteger(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:53
libcdr::CommonParser::readUnsignedShort
unsigned short readUnsignedShort(librevenge::RVNGInputStream *input, bool bigEndian=false)
Definition: CommonParser.cpp:44
CDRCollector.h
libcdr::PRECISION_16BIT
Definition: CommonParser.h:20
libcdr::CommonParser::~CommonParser
virtual ~CommonParser()
Definition: CommonParser.cpp:22
CDRPath.h
libcdr::CommonParser::CommonParser
CommonParser()
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:176
libcdr::CDRCollector
Definition: CDRCollector.h:63