/src/libwps/src/lib/WPSParser.h
Line | Count | Source |
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 | | |
33 | | class WPSTextParser; |
34 | | |
35 | | class WPSParser |
36 | | { |
37 | | friend class WPSTextParser; |
38 | | public: |
39 | | //! a map to retrieve a file entry by name |
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 | | |
46 | | protected: |
47 | | RVNGInputStreamPtr &getInput() |
48 | 4.18M | { |
49 | 4.18M | return m_input; |
50 | 4.18M | } |
51 | | RVNGInputStreamPtr getFileInput(); |
52 | | WPSHeaderPtr &getHeader() |
53 | 0 | { |
54 | 0 | return m_header; |
55 | 0 | } |
56 | | int version() const |
57 | 83.8k | { |
58 | 83.8k | return m_version; |
59 | 83.8k | } |
60 | | void setVersion(int vers) |
61 | 5.89k | { |
62 | 5.89k | m_version=vers; |
63 | 5.89k | } |
64 | | //! a DebugFile used to write what we recognize when we parse the document |
65 | | libwps::DebugFile &ascii() |
66 | 9.26M | { |
67 | 9.26M | return m_asciiFile; |
68 | 9.26M | } |
69 | | |
70 | | NameMultiMap &getNameEntryMap() |
71 | 2.28M | { |
72 | 2.28M | return m_nameMultiMap; |
73 | 2.28M | } |
74 | | NameMultiMap const &getNameEntryMap() const |
75 | 0 | { |
76 | 0 | return m_nameMultiMap; |
77 | 0 | } |
78 | | |
79 | | private: |
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; |
89 | | //! the debug file |
90 | | libwps::DebugFile m_asciiFile; |
91 | | |
92 | | //! a map to retrieve a file entry by name |
93 | | NameMultiMap m_nameMultiMap; |
94 | | }; |
95 | | |
96 | | #endif /* WPSPARSER_H */ |
97 | | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |