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(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:
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: */
IWASnappyStream.h
libetonyek::IWAObjectIndex::m_package
const RVNGInputStreamPtr_t m_package
Definition: IWAObjectIndex.h:54
libetonyek
Definition: IWORKBezierElement.cpp:21
libetonyek::IWAObjectIndex::m_fragments
const RVNGInputStreamPtr_t m_fragments
Definition: IWAObjectIndex.h:53
libetonyek::IWORKToken::pos
@ pos
Definition: IWORKToken.h:592
ETONYEK_DEBUG_MSG
#define ETONYEK_DEBUG_MSG(M)
Definition: libetonyek_utils.h:54
libetonyek::IWAObjectIndex
Definition: IWAObjectIndex.h:27
libetonyek::KEY1Token::file
@ file
Definition: KEY1Token.h:130
libetonyek::IWAObjectIndex::ObjectRecord::m_dataRange
std::pair< long, long > m_dataRange
Definition: IWAObjectIndex.h:37
IWAObjectIndex.h
libetonyek::IWAObjectIndex::m_unparsedFragments
std::map< unsigned, std::string > m_unparsedFragments
Definition: IWAObjectIndex.h:56
libetonyek::IWAObjectIndex::scanFragment
void scanFragment(unsigned id)
Definition: IWAObjectIndex.cpp:140
libetonyek::IWAObjectIndex::m_fragmentObjectMap
std::map< unsigned, std::pair< unsigned, ObjectRecord > > m_fragmentObjectMap
Definition: IWAObjectIndex.h:57
libetonyek::IWORKToken::start
@ start
Definition: IWORKToken.h:405
libetonyek::IWAObjectIndex::IWAObjectIndex
IWAObjectIndex(const RVNGInputStreamPtr_t &fragments, const RVNGInputStreamPtr_t &package)
Definition: IWAObjectIndex.cpp:44
libetonyek::IWORKToken::header
@ header
Definition: IWORKToken.h:252
libetonyek::IWAObjectIndex::ObjectRecord::m_stream
RVNGInputStreamPtr_t m_stream
Definition: IWAObjectIndex.h:34
libetonyek::IWORKToken::string
@ string
Definition: IWORKToken.h:411
libetonyek::detail::IWAFieldImpl::repeated
const std::deque< value_type > repeated() const
Definition: IWAField.h:153
libetonyek::IWAMessage::message
const IWAMessageField & message(std::size_t field) const
Definition: IWAMessage.cpp:167
libetonyek::IWORKToken::path
@ path
Definition: IWORKToken.h:358
libetonyek::IWAObjectIndex::parse
void parse()
Definition: IWAObjectIndex.cpp:53
libetonyek_utils.h
libetonyek::IWAMessage
Definition: IWAMessage.h:22
libetonyek::IWORKToken::type
@ type
Definition: IWORKToken.h:486
libetonyek::IWAObjectIndex::queryObject
void queryObject(unsigned id, unsigned &type, boost::optional< IWAMessage > &msg) const
Definition: IWAObjectIndex.cpp:103
libetonyek::IWAObjectIndex::ObjectRecord::m_type
unsigned m_type
Definition: IWAObjectIndex.h:35
IWAMessage.h
libetonyek::get_optional_value_or
const ValueT & get_optional_value_or(const detail::IWAFieldImpl< TagV, ValueT, Reader > &field, const ValueT &value)
Definition: IWAField.h:196
libetonyek::IWAObjectIndex::ObjectRecord::ObjectRecord
ObjectRecord()
Definition: IWAObjectIndex.cpp:27
libetonyek::RVNGInputStreamPtr_t
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:82
m_type
boost::optional< IWORKGradientType > m_type
Definition: IWORKFillElement.cpp:132
libetonyek::IWAObjectIndex::ObjectRecord
Definition: IWAObjectIndex.h:30
libetonyek::IWAObjectIndex::ObjectRecord::m_headerRange
std::pair< long, long > m_headerRange
Definition: IWAObjectIndex.h:36
libetonyek::get
const ValueT & get(const detail::IWAFieldImpl< TagV, ValueT, Reader > &field)
Definition: IWAField.h:190
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::readUVar
uint64_t readUVar(const RVNGInputStreamPtr_t &input)
Definition: libetonyek_utils.cpp:108

Generated for libetonyek by doxygen 1.8.20