PMDParser.h Source File documentation

PMDParser.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 libpagemaker 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 __PMDPARSER_H__
11#define __PMDPARSER_H__
12
13#include <map>
14#include <set>
15#include <stdint.h>
16
17#include <librevenge/librevenge.h>
18
19#include "PMDRecord.h"
20#include "geometry.h"
21
22namespace libpagemaker
23{
24
25class PMDCollector;
26 class PMDParser
27{
28 typedef std::vector<PMDRecordContainer> RecordContainerList_t;
29 typedef std::map<uint16_t, std::vector<unsigned> > RecordTypeMap_t;
30
31 librevenge::RVNGInputStream *m_input;
32 unsigned long m_length;
33 PMDCollector *m_collector;
34 RecordTypeMap_t m_records;
35 bool m_bigEndian;
36 RecordContainerList_t m_recordsInOrder;
37 std::map<uint32_t, PMDXForm> m_xFormMap;
38
39 struct ToCState;
40 class RecordIterator;
41
42 /* Private functions. */
43 void parseGlobalInfo(const PMDRecordContainer &container);
44 void parseFonts();
45 void parseColors();
46 void parsePages(const PMDRecordContainer &container);
47 void parseShapes(uint16_t seqNum, unsigned pageID);
48 void parseLine(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID);
49 void parseTextBox(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID);
50 void parseRectangle(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID);
51 void parsePolygon(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID);
52 void parseEllipse(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID);
53 void parseBitmap(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID);
54 void parseHeader(uint32_t *tocOffset, uint16_t *tocLength);
55 void readNextRecordFromTableOfContents(ToCState &state, bool subRecord, uint16_t subRecordType = 0);
56 void readTableOfContents(ToCState &state, uint32_t offset, unsigned records, bool subRecords, uint16_t subRecordType = 0);
57 void parseTableOfContents(uint32_t offset, uint16_t length);
58 void parseXforms();
59 const PMDXForm &getXForm(const uint32_t xFormId) const;
60
61 RecordIterator beginRecordsWithSeqNumber(uint16_t seqNum) const;
62 RecordIterator beginRecordsOfType(uint16_t recType) const;
63 RecordIterator endRecords() const;
64
65 /* Prevent copy and assignment */
66 PMDParser &operator=(const PMDParser &);
67 PMDParser(const PMDParser &);
68public:
69 PMDParser(librevenge::RVNGInputStream *, PMDCollector *);
70 void parse();
71};
72
73}
74
75#endif /* __PMDPARSER_H__ */
76
77/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
PMDRecord.h
libpagemaker::PMDCollector
Builder class for PMD Documents.
Definition: PMDCollector.h:39
libpagemaker::PMDParser::RecordIterator
Definition: PMDParser.cpp:94
libpagemaker::PMDParser
Definition: PMDParser.h:27
libpagemaker::PMDParser::m_xFormMap
std::map< uint32_t, PMDXForm > m_xFormMap
Definition: PMDParser.h:37
libpagemaker::PMDParser::parseLine
void parseLine(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID)
Definition: PMDParser.cpp:272
libpagemaker::PMDParser::getXForm
const PMDXForm & getXForm(const uint32_t xFormId) const
Definition: PMDParser.cpp:216
libpagemaker::PMDParser::parseShapes
void parseShapes(uint16_t seqNum, unsigned pageID)
Definition: PMDParser.cpp:658
libpagemaker::PMDParser::parsePolygon
void parsePolygon(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID)
Definition: PMDParser.cpp:498
libpagemaker::PMDParser::parseXforms
void parseXforms()
Definition: PMDParser.cpp:780
libpagemaker::PMDParser::m_recordsInOrder
RecordContainerList_t m_recordsInOrder
Definition: PMDParser.h:36
libpagemaker::PMDParser::m_collector
PMDCollector * m_collector
Definition: PMDParser.h:33
libpagemaker::PMDParser::parse
void parse()
Definition: PMDParser.cpp:963
libpagemaker::PMDParser::parseHeader
void parseHeader(uint32_t *tocOffset, uint16_t *tocLength)
Definition: PMDParser.cpp:830
libpagemaker::PMDParser::m_input
librevenge::RVNGInputStream * m_input
Definition: PMDParser.h:31
libpagemaker::PMDParser::parseTextBox
void parseTextBox(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID)
Definition: PMDParser.cpp:304
libpagemaker::PMDParser::beginRecordsWithSeqNumber
RecordIterator beginRecordsWithSeqNumber(uint16_t seqNum) const
Definition: PMDParser.cpp:996
libpagemaker::PMDParser::RecordContainerList_t
std::vector< PMDRecordContainer > RecordContainerList_t
Definition: PMDParser.h:28
libpagemaker::PMDParser::PMDParser
PMDParser(const PMDParser &)
libpagemaker::PMDParser::beginRecordsOfType
RecordIterator beginRecordsOfType(uint16_t recType) const
Definition: PMDParser.cpp:1001
libpagemaker::PMDParser::parsePages
void parsePages(const PMDRecordContainer &container)
Definition: PMDParser.cpp:808
libpagemaker::PMDParser::parseEllipse
void parseEllipse(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID)
Definition: PMDParser.cpp:570
libpagemaker::PMDParser::parseRectangle
void parseRectangle(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID)
Definition: PMDParser.cpp:460
libpagemaker::PMDParser::m_records
RecordTypeMap_t m_records
Definition: PMDParser.h:34
libpagemaker::PMDParser::operator=
PMDParser & operator=(const PMDParser &)
libpagemaker::PMDParser::m_length
unsigned long m_length
Definition: PMDParser.h:32
libpagemaker::PMDParser::readNextRecordFromTableOfContents
void readNextRecordFromTableOfContents(ToCState &state, bool subRecord, uint16_t subRecordType=0)
Definition: PMDParser.cpp:871
libpagemaker::PMDParser::RecordTypeMap_t
std::map< uint16_t, std::vector< unsigned > > RecordTypeMap_t
Definition: PMDParser.h:29
libpagemaker::PMDParser::endRecords
RecordIterator endRecords() const
Definition: PMDParser.cpp:1006
libpagemaker::PMDParser::parseBitmap
void parseBitmap(const PMDRecordContainer &container, unsigned recordIndex, unsigned pageID)
Definition: PMDParser.cpp:609
libpagemaker::PMDParser::parseFonts
void parseFonts()
Definition: PMDParser.cpp:698
libpagemaker::PMDParser::parseTableOfContents
void parseTableOfContents(uint32_t offset, uint16_t length)
Definition: PMDParser.cpp:953
libpagemaker::PMDParser::readTableOfContents
void readTableOfContents(ToCState &state, uint32_t offset, unsigned records, bool subRecords, uint16_t subRecordType=0)
Definition: PMDParser.cpp:924
libpagemaker::PMDParser::parseGlobalInfo
void parseGlobalInfo(const PMDRecordContainer &container)
Definition: PMDParser.cpp:251
libpagemaker::PMDParser::parseColors
void parseColors()
Definition: PMDParser.cpp:731
libpagemaker::PMDParser::m_bigEndian
bool m_bigEndian
Definition: PMDParser.h:35
geometry.h
libpagemaker
Definition: geometry.h:23
libpagemaker::PMDParser::ToCState
Definition: PMDParser.cpp:73
libpagemaker::PMDRecordContainer
Definition: PMDRecord.h:26
libpagemaker::PMDXForm
Definition: geometry.h:37