Orcus
orcus_ods.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef INCLUDED_ORCUS_ORCUS_ODS_HPP
9 #define INCLUDED_ORCUS_ORCUS_ODS_HPP
10 
11 #include "orcus/spreadsheet/import_interface.hpp"
12 #include "orcus/env.hpp"
13 #include "interface.hpp"
14 
15 #include <memory>
16 
17 namespace orcus {
18 
19 namespace spreadsheet { namespace iface { class import_factory; }}
20 
21 struct orcus_ods_impl;
22 class zip_archive;
23 class zip_archive_stream;
24 
25 class ORCUS_DLLPUBLIC orcus_ods : public iface::import_filter
26 {
27  orcus_ods(const orcus_ods&); // disabled
28  orcus_ods& operator= (const orcus_ods&); // disabled
29 
30 public:
32  ~orcus_ods();
33 
34  static bool detect(const unsigned char* blob, size_t size);
35 
36  virtual void read_file(std::string_view filepath) override;
37 
38  virtual void read_stream(std::string_view stream) override;
39 
40  virtual std::string_view get_name() const override;
41 
42 private:
43  static void list_content(const zip_archive& archive);
44  void read_styles(const zip_archive& archive);
45  void read_content(const zip_archive& archive);
46  void read_content_xml(const unsigned char* p, size_t size);
47 
48  void read_file_impl(zip_archive_stream* stream);
49 
50 private:
51  struct impl;
52  std::unique_ptr<impl> mp_impl;
53 };
54 
55 }
56 
57 #endif
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: interface.hpp:27
Definition: orcus_ods.hpp:26
virtual void read_stream(std::string_view stream) override
virtual void read_file(std::string_view filepath) override
virtual std::string_view get_name() const override
Definition: import_interface.hpp:1199
Definition: zip_archive_stream.hpp:19
Definition: zip_archive.hpp:53