QXPHeader.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 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: */
libqxp::QXPHeader::QXPHeader
QXPHeader(const boost::optional< QXPDocument::Type > &fileType=boost::none)
Definition QXPHeader.cpp:17
libqxp::QXPHeader::createParser
virtual std::unique_ptr< QXPParser > createParser(const std::shared_ptr< librevenge::RVNGInputStream > &input, librevenge::RVNGDrawingInterface *painter)=0
libqxp::QXPHeader::load
virtual bool load(const std::shared_ptr< librevenge::RVNGInputStream > &input)=0
libqxp::QXPHeader::isLittleEndian
bool isLittleEndian() const
Definition QXPHeader.cpp:25
libqxp::QXPHeader::m_language
unsigned m_language
Definition QXPHeader.h:60
libqxp::QXPHeader::m_fileType
boost::optional< QXPDocument::Type > m_fileType
Definition QXPHeader.h:61
libqxp::QXPHeader::m_proc
unsigned m_proc
Definition QXPHeader.h:58
libqxp::QXPHeader::isBigEndian
bool isBigEndian() const
Definition QXPHeader.cpp:30
libqxp::QXPHeader::getType
virtual QXPDocument::Type getType() const =0
libqxp::QXPHeader::m_version
unsigned m_version
Definition QXPHeader.h:59
libqxp::QXPHeader::encoding
const char * encoding() const
Definition QXPHeader.cpp:40
libqxp::QXPHeader::~QXPHeader
virtual ~QXPHeader()=default
libqxp::QXPHeader::version
unsigned version() const
Definition QXPHeader.cpp:35
libqxp
Definition libqxp_utils.cpp:25
libqxp::QXPVersion
QXPVersion
Definition QXPHeader.h:23
libqxp::QXP_1
@ QXP_1
Definition QXPHeader.h:25
libqxp::QXP_5
@ QXP_5
Definition QXPHeader.h:30
libqxp::QXP_31
@ QXP_31
Definition QXPHeader.h:27
libqxp::UNKNOWN
@ UNKNOWN
Definition QXPHeader.h:24
libqxp::QXP_7
@ QXP_7
Definition QXPHeader.h:32
libqxp::QXP_6
@ QXP_6
Definition QXPHeader.h:31
libqxp::QXP_4
@ QXP_4
Definition QXPHeader.h:29
libqxp::QXP_33
@ QXP_33
Definition QXPHeader.h:28
libqxp::QXP_31_MAC
@ QXP_31_MAC
Definition QXPHeader.h:26
libqxp::QXP_8
@ QXP_8
Definition QXPHeader.h:33