QXPHeader.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libqxp project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef QXPHEADER_H_INCLUDED
00011 #define QXPHEADER_H_INCLUDED
00012 
00013 #include <memory>
00014 
00015 #include <boost/optional.hpp>
00016 
00017 #include <libqxp/libqxp.h>
00018 
00019 namespace libqxp
00020 {
00021 
00022 enum QXPVersion
00023 {
00024   UNKNOWN = 0,
00025   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
00026   QXP_31_MAC = 0x39,
00027   QXP_31 = 0x3e,
00028   QXP_33 = 0x3f,
00029   QXP_4 = 0x41,
00030   QXP_5 = 0x42,
00031   QXP_6 = 0x43,
00032   QXP_7 = 0x44,
00033   QXP_8 = 0x45,
00034 };
00035 
00036 class QXPParser;
00037 
00038 struct QXPDocumentProperties;
00039 
00040 class QXPHeader
00041 {
00042 public:
00043   explicit QXPHeader(const boost::optional<QXPDocument::Type> &fileType = boost::none);
00044   virtual ~QXPHeader() = default;
00045 
00046   virtual bool load(const std::shared_ptr<librevenge::RVNGInputStream> &input) = 0;
00047 
00048   virtual QXPDocument::Type getType() const = 0;
00049 
00050   virtual std::unique_ptr<QXPParser> createParser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter) = 0;
00051 
00052   bool isLittleEndian() const;
00053   bool isBigEndian() const;
00054   unsigned version() const;
00055   const char *encoding() const;
00056 
00057 protected:
00058   unsigned m_proc;
00059   unsigned m_version;
00060   unsigned m_language;
00061   boost::optional<QXPDocument::Type> m_fileType;
00062 };
00063 
00064 }
00065 
00066 #endif // QXPHEADER_H_INCLUDED
00067 
00068 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */