WPSParser.h Source File documentation

WPSParser.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
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 * Major Contributor(s):
10 * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
11 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
12 *
13 * For minor contributions see the git repository.
14 *
15 * Alternatively, the contents of this file may be used under the terms
16 * of the GNU Lesser General Public License Version 2.1 or later
17 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18 * applicable instead of those above.
19 *
20 * For further information visit http://libwps.sourceforge.net
21 */
22
23#ifndef WPSPARSER_H
24#define WPSPARSER_H
25
26#include <map>
27#include <string>
28
29#include "libwps_internal.h"
30
31#include "WPSDebug.h"
32
33class WPSTextParser;
34
35 class WPSParser
36{
37 friend class WPSTextParser;
38public:
40 typedef std::multimap<std::string, WPSEntry> NameMultiMap;
41
42 WPSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header);
43 virtual ~WPSParser();
44 virtual void parse(librevenge::RVNGTextInterface *documentInterface) = 0;
45
46protected:
47 RVNGInputStreamPtr &getInput()
48 {
49 return m_input;
50 }
51 RVNGInputStreamPtr getFileInput();
52 WPSHeaderPtr &getHeader()
53 {
54 return m_header;
55 }
56 int version() const
57 {
58 return m_version;
59 }
60 void setVersion(int vers)
61 {
62 m_version=vers;
63 }
65 libwps::DebugFile &ascii()
66 {
67 return m_asciiFile;
68 }
69
70 NameMultiMap &getNameEntryMap()
71 {
72 return m_nameMultiMap;
73 }
74 NameMultiMap const &getNameEntryMap() const
75 {
76 return m_nameMultiMap;
77 }
78
79private:
80 explicit WPSParser(const WPSParser &) = delete;
81 WPSParser &operator=(const WPSParser &) = delete;
82
83 // the main input
84 RVNGInputStreamPtr m_input;
85 // the header
86 WPSHeaderPtr m_header;
87 // the file version
88 int m_version;
90 libwps::DebugFile m_asciiFile;
91
93 NameMultiMap m_nameMultiMap;
94};
95
96#endif /* WPSPARSER_H */
97/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSDebug.h
WPSParser
Definition: WPSParser.h:36
WPSParser::getFileInput
RVNGInputStreamPtr getFileInput()
Definition: WPSParser.cpp:45
WPSParser::m_asciiFile
libwps::DebugFile m_asciiFile
the debug file
Definition: WPSParser.h:90
WPSParser::version
int version() const
Definition: WPSParser.h:56
WPSParser::m_nameMultiMap
NameMultiMap m_nameMultiMap
a map to retrieve a file entry by name
Definition: WPSParser.h:93
WPSParser::parse
virtual void parse(librevenge::RVNGTextInterface *documentInterface)=0
WPSParser::operator=
WPSParser & operator=(const WPSParser &)=delete
WPSParser::getNameEntryMap
NameMultiMap const & getNameEntryMap() const
Definition: WPSParser.h:74
WPSParser::m_version
int m_version
Definition: WPSParser.h:88
WPSParser::setVersion
void setVersion(int vers)
Definition: WPSParser.h:60
WPSParser::getInput
RVNGInputStreamPtr & getInput()
Definition: WPSParser.h:47
WPSParser::m_input
RVNGInputStreamPtr m_input
Definition: WPSParser.h:84
WPSParser::ascii
libwps::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: WPSParser.h:65
WPSParser::WPSParser
WPSParser(const WPSParser &)=delete
WPSParser::m_header
WPSHeaderPtr m_header
Definition: WPSParser.h:86
WPSParser::NameMultiMap
std::multimap< std::string, WPSEntry > NameMultiMap
a map to retrieve a file entry by name
Definition: WPSParser.h:40
WPSParser::getNameEntryMap
NameMultiMap & getNameEntryMap()
Definition: WPSParser.h:70
WPSParser::~WPSParser
virtual ~WPSParser()
Definition: WPSParser.cpp:41
WPSParser::getHeader
WPSHeaderPtr & getHeader()
Definition: WPSParser.h:52
WPSTextParser
class used to defined the ancestor of parser which manages the text data
Definition: WPSTextParser.h:40
libwps::DebugFile
Definition: WPSDebug.h:208
libwps_internal.h
WPSHeaderPtr
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87