EPUBImageManager.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 libepubgen 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 INCLUDED_EPUBIMAGEMANAGER_H
11#define INCLUDED_EPUBIMAGEMANAGER_H
12
13#include <string>
14#include <unordered_map>
15#include <unordered_set>
16
17#include <boost/functional/hash.hpp>
18
19#include <librevenge/librevenge.h>
20
21#include "EPUBCSSProperties.h"
22#include "EPUBCounter.h"
23#include "EPUBPath.h"
24
25namespace libepubgen
26{
27
28class EPUBManifest;
29class EPUBPackage;
30class EPUBCSSContent;
31
33{
34 // disable copying
37
38 struct BinaryDataHash // : public std::unary_function<librevenge::RVNGBinaryData, std::size_t>
39 {
40 std::size_t operator()(const librevenge::RVNGBinaryData &data) const;
41 };
42
43 struct BinaryDataEqual // : public std::binary_function<librevenge::RVNGBinaryData, librevenge::RVNGBinaryData, bool>
44 {
45 bool operator()(const librevenge::RVNGBinaryData &left, const librevenge::RVNGBinaryData &right) const;
46 };
47
48 typedef std::unordered_map<librevenge::RVNGBinaryData, EPUBPath, BinaryDataHash, BinaryDataEqual> MapType_t;
49 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
50
51public:
52 explicit EPUBImageManager(EPUBManifest &manifest);
53
54 const EPUBPath &insert(const librevenge::RVNGBinaryData &data, const librevenge::RVNGString &mimetype, const librevenge::RVNGString &properties="");
55
56 void writeTo(EPUBPackage &package);
57
59 std::string getFrameClass(librevenge::RVNGPropertyList const &pList);
61 std::string getFrameStyle(librevenge::RVNGPropertyList const &pList);
63 static std::string getWrapStyle(librevenge::RVNGPropertyList const &pList);
65 void send(EPUBCSSContent &out);
66
67private:
69 void extractImageProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
70
76};
77
78}
79
80#endif // INCLUDED_EPUBIMAGEMANAGER
81
82/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: EPUBCSSContent.h:24
Definition: EPUBCounter.h:17
Definition: EPUBImageManager.h:33
ContentNameMap_t m_imageContentNameMap
a map image content -> name
Definition: EPUBImageManager.h:75
std::string getFrameClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBImageManager.cpp:113
void extractImageProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBImageManager.cpp:137
MapType_t m_map
Definition: EPUBImageManager.h:72
const EPUBPath & insert(const librevenge::RVNGBinaryData &data, const librevenge::RVNGString &mimetype, const librevenge::RVNGString &properties="")
Definition: EPUBImageManager.cpp:79
EPUBImageManager & operator=(const EPUBImageManager &)
EPUBImageManager(const EPUBImageManager &)
void send(EPUBCSSContent &out)
send the data to the sink
Definition: EPUBImageManager.cpp:203
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition: EPUBImageManager.h:49
void writeTo(EPUBPackage &package)
Definition: EPUBImageManager.cpp:103
EPUBCounter m_number
Definition: EPUBImageManager.h:73
std::unordered_map< librevenge::RVNGBinaryData, EPUBPath, BinaryDataHash, BinaryDataEqual > MapType_t
Definition: EPUBImageManager.h:48
EPUBManifest & m_manifest
Definition: EPUBImageManager.h:71
static std::string getWrapStyle(librevenge::RVNGPropertyList const &pList)
returns the style for a follow-up element, based on wrapping properties.
Definition: EPUBImageManager.cpp:174
std::string getFrameStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition: EPUBImageManager.cpp:126
Definition: EPUBManifest.h:24
Representation of a path in the package.
Definition: EPUBPath.h:22
Definition: EPUBBinaryContent.cpp:15
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
Definition: EPUBImageManager.h:44
bool operator()(const librevenge::RVNGBinaryData &left, const librevenge::RVNGBinaryData &right) const
Definition: EPUBImageManager.cpp:61
Definition: EPUBImageManager.h:39
std::size_t operator()(const librevenge::RVNGBinaryData &data) const
Definition: EPUBImageManager.cpp:50

Generated for libepubgen by doxygen 1.9.5