Debian Codegraph @

src/lib/QXPHeader.h

raw
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libqxp 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 QXPHEADER_H_INCLUDED
11 #define QXPHEADER_H_INCLUDED
12
13 #include <memory>
14
15 #include <boost/optional.hpp>
16
17 #include <libqxp/libqxp.h>
18
19 namespace libqxp
20 {
21
22 enum QXPVersion
23 {
24 UNKNOWN = 0,
25 QXP_1 = 0x20, // NOTE: this is 1.10L, but we use for all 1.x versions, as we've no idea if there are any differences anyway
26 QXP_31_MAC = 0x39,
27 QXP_31 = 0x3e,
28 QXP_33 = 0x3f,
29 QXP_4 = 0x41,
30 QXP_5 = 0x42,
31 QXP_6 = 0x43,
32 QXP_7 = 0x44,
33 QXP_8 = 0x45,
34 };
35
36 class QXPParser;
37
38 struct QXPDocumentProperties;
39
40 class QXPHeader
41 {
42 public:
43 explicit QXPHeader(const boost::optional<QXPDocument::Type> &fileType = boost::none);
44 virtual ~QXPHeader() = default;
45
46 virtual bool load(const std::shared_ptr<librevenge::RVNGInputStream> &input) = 0;
47
48 virtual QXPDocument::Type getType() const = 0;
49
50 virtual std::unique_ptr<QXPParser> createParser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter) = 0;
51
52 bool isLittleEndian() const;
53 bool isBigEndian() const;
54 unsigned version() const;
55 const char *encoding() const;
56
57 protected:
58 unsigned m_proc;
59 unsigned m_version;
60 unsigned m_language;
61 boost::optional<QXPDocument::Type> m_fileType;
62 };
63
64 }
65
66 #endif // QXPHEADER_H_INCLUDED
67
68 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */