IWAObjectIndex.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 libetonyek 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 IWAOBJECTINDEX_H_INCLUDED
11 #define IWAOBJECTINDEX_H_INCLUDED
12 
13 #include <map>
14 #include <string>
15 #include <utility>
16 
17 #include <boost/optional.hpp>
18 
19 #include "libetonyek_utils.h"
20 
21 namespace libetonyek
22 {
23 
24 class IWAMessage;
25 
27 {
28 public:
29  struct ObjectRecord
30  {
31  ObjectRecord();
32  ObjectRecord(const RVNGInputStreamPtr_t &stream, unsigned type, long pos, unsigned long headerLen, unsigned long dataLen);
33 
35  unsigned m_type;
36  std::pair<long, long> m_headerRange;
37  std::pair<long, long> m_dataRange;
38  };
39 
40 public:
41  IWAObjectIndex(const RVNGInputStreamPtr_t &fragments, const RVNGInputStreamPtr_t &package);
42 
43  void parse();
44 
45  void queryObject(const unsigned id, unsigned &type, boost::optional<IWAMessage> &msg) const;
46  boost::optional<unsigned> getObjectType(const unsigned id) const;
47  const RVNGInputStreamPtr_t queryFile(unsigned id) const;
48  boost::optional<IWORKColor> queryFileColor(unsigned id) const;
49 
50 private:
51  void scanFragment(unsigned id);
52  void scanFragment(unsigned id, const RVNGInputStreamPtr_t &stream);
53 
54  void scanColorFileMap(unsigned id);
55  boost::optional<IWORKColor> scanColorFileCorrespondance(unsigned id);
56 private:
59 
60  mutable std::map<unsigned, std::string> m_unparsedFragments;
61  mutable std::map<unsigned, std::pair<unsigned, ObjectRecord>> m_fragmentObjectMap;
62  mutable std::map<unsigned, std::pair<std::string, RVNGInputStreamPtr_t>> m_fileMap;
63  mutable std::map<unsigned, IWORKColor> m_fileColorMap;
64 };
65 
66 }
67 
68 #endif
69 
70 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
boost::optional< unsigned > getObjectType(const unsigned id) const
Definition: IWAObjectIndex.cpp:141
std::map< unsigned, std::string > m_unparsedFragments
Definition: IWAObjectIndex.h:60
std::pair< long, long > m_dataRange
Definition: IWAObjectIndex.h:37
RVNGInputStreamPtr_t m_stream
Definition: IWAObjectIndex.h:34
void scanFragment(unsigned id)
Definition: IWAObjectIndex.cpp:171
ObjectRecord()
Definition: IWAObjectIndex.cpp:30
void queryObject(const unsigned id, unsigned &type, boost::optional< IWAMessage > &msg) const
Definition: IWAObjectIndex.cpp:123
void parse()
Definition: IWAObjectIndex.cpp:57
const RVNGInputStreamPtr_t m_package
Definition: IWAObjectIndex.h:58
unsigned m_type
Definition: IWAObjectIndex.h:35
Definition: IWAObjectIndex.h:26
std::pair< long, long > m_headerRange
Definition: IWAObjectIndex.h:36
boost::optional< IWORKColor > queryFileColor(unsigned id) const
Definition: IWAObjectIndex.cpp:228
const RVNGInputStreamPtr_t queryFile(unsigned id) const
Definition: IWAObjectIndex.cpp:152
std::map< unsigned, IWORKColor > m_fileColorMap
Definition: IWAObjectIndex.h:63
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:82
std::map< unsigned, std::pair< std::string, RVNGInputStreamPtr_t > > m_fileMap
Definition: IWAObjectIndex.h:62
IWAObjectIndex(const RVNGInputStreamPtr_t &fragments, const RVNGInputStreamPtr_t &package)
Definition: IWAObjectIndex.cpp:47
std::map< unsigned, std::pair< unsigned, ObjectRecord > > m_fragmentObjectMap
Definition: IWAObjectIndex.h:61
Definition: IWORKToken.h:493
const RVNGInputStreamPtr_t m_fragments
Definition: IWAObjectIndex.h:57
void scanColorFileMap(unsigned id)
Definition: IWAObjectIndex.cpp:239
boost::optional< IWORKColor > scanColorFileCorrespondance(unsigned id)
Definition: IWAObjectIndex.cpp:267
Definition: IWORKToken.h:599
Definition: IWAObjectIndex.h:29

Generated for libetonyek by doxygen 1.8.6