IWAObjectIndex.h Source File documentation

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
26 class IWAObjectIndex
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
34 RVNGInputStreamPtr_t m_stream;
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(unsigned id, unsigned &type, boost::optional<IWAMessage> &msg) const;
46 const RVNGInputStreamPtr_t queryFile(unsigned id) const;
47
48 private:
49 void scanFragment(unsigned id);
50 void scanFragment(unsigned id, const RVNGInputStreamPtr_t &stream);
51
52 private:
53 const RVNGInputStreamPtr_t m_fragments;
54 const RVNGInputStreamPtr_t m_package;
55
56 mutable std::map<unsigned, std::string> m_unparsedFragments;
57 mutable std::map<unsigned, std::pair<unsigned, ObjectRecord>> m_fragmentObjectMap;
58 mutable std::map<unsigned, std::pair<std::string, RVNGInputStreamPtr_t>> m_fileMap;
59 };
60
61 }
62
63 #endif
64
65 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek
Definition: IWORKBezierElement.cpp:20
libetonyek::IWAObjectIndex::queryObject
void queryObject(unsigned id, unsigned &type, boost::optional< IWAMessage > &msg) const
Definition: IWAObjectIndex.cpp:103
libetonyek::IWAObjectIndex::m_unparsedFragments
std::map< unsigned, std::string > m_unparsedFragments
Definition: IWAObjectIndex.h:56
libetonyek::IWAObjectIndex::ObjectRecord::m_dataRange
std::pair< long, long > m_dataRange
Definition: IWAObjectIndex.h:37
libetonyek::IWAObjectIndex::ObjectRecord::m_stream
RVNGInputStreamPtr_t m_stream
Definition: IWAObjectIndex.h:34
libetonyek::IWAObjectIndex::scanFragment
void scanFragment(unsigned id)
Definition: IWAObjectIndex.cpp:140
libetonyek::IWAObjectIndex::ObjectRecord::ObjectRecord
ObjectRecord()
Definition: IWAObjectIndex.cpp:27
libetonyek::IWAObjectIndex::parse
void parse()
Definition: IWAObjectIndex.cpp:53
libetonyek::IWAObjectIndex::m_package
const RVNGInputStreamPtr_t m_package
Definition: IWAObjectIndex.h:54
libetonyek::IWAObjectIndex::ObjectRecord::m_type
unsigned m_type
Definition: IWAObjectIndex.h:35
libetonyek::IWAObjectIndex
Definition: IWAObjectIndex.h:26
libetonyek::IWAObjectIndex::ObjectRecord::m_headerRange
std::pair< long, long > m_headerRange
Definition: IWAObjectIndex.h:36
libetonyek::RVNGInputStreamPtr_t
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:82
libetonyek::IWAObjectIndex::m_fileMap
std::map< unsigned, std::pair< std::string, RVNGInputStreamPtr_t > > m_fileMap
Definition: IWAObjectIndex.h:58
libetonyek::IWAObjectIndex::queryFile
const RVNGInputStreamPtr_t queryFile(unsigned id) const
Definition: IWAObjectIndex.cpp:121
libetonyek::IWAObjectIndex::IWAObjectIndex
IWAObjectIndex(const RVNGInputStreamPtr_t &fragments, const RVNGInputStreamPtr_t &package)
Definition: IWAObjectIndex.cpp:44
libetonyek::IWAObjectIndex::m_fragmentObjectMap
std::map< unsigned, std::pair< unsigned, ObjectRecord > > m_fragmentObjectMap
Definition: IWAObjectIndex.h:57
libetonyek::IWORKToken::type
Definition: IWORKToken.h:486
libetonyek::IWAObjectIndex::m_fragments
const RVNGInputStreamPtr_t m_fragments
Definition: IWAObjectIndex.h:53
libetonyek_utils.h
libetonyek::IWORKToken::pos
Definition: IWORKToken.h:592
libetonyek::IWAObjectIndex::ObjectRecord
Definition: IWAObjectIndex.h:29