EPUBSpanStyleManager.h Source File documentation

EPUBSpanStyleManager.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_EPUBSPANSTYLEMANAGER_H
11 #define INCLUDED_EPUBSPANSTYLEMANAGER_H
12
13 #include <map>
14 #include <string>
15 #include <unordered_map>
16
17 #include <boost/functional/hash.hpp>
18
19 #include <librevenge/librevenge.h>
20
21 #include "EPUBCSSProperties.h"
22
23 namespace libepubgen
24 {
25
26 class EPUBCSSSink;
27
29 class EPUBSpanStyleManager
30 {
31 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
32
33 public:
35 EPUBSpanStyleManager() : m_contentNameMap(), m_idNameMap()
36 {
37 }
39 ~EPUBSpanStyleManager()
40 {
41 }
43 void defineSpan(librevenge::RVNGPropertyList const &pList);
45 std::string getClass(librevenge::RVNGPropertyList const &pList);
47 std::string getStyle(librevenge::RVNGPropertyList const &pList);
49 void send(EPUBCSSSink &out);
50 protected:
52 void extractProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
54 void extractTextPosition(char const *value, EPUBCSSProperties &cssProps) const;
56 void extractDecorations(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
58 ContentNameMap_t m_contentNameMap;
60 std::map<int, std::string> m_idNameMap;
61
62 private:
63 EPUBSpanStyleManager(EPUBSpanStyleManager const &orig);
64 EPUBSpanStyleManager operator=(EPUBSpanStyleManager const &orig);
65 };
66
67 }
68
69 #endif
70
71 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libepubgen::EPUBSpanStyleManager::m_idNameMap
std::map< int, std::string > m_idNameMap
a map id -> name
Definition: EPUBSpanStyleManager.h:60
libepubgen::EPUBSpanStyleManager
Small class to manage the span style.
Definition: EPUBSpanStyleManager.h:29
libepubgen::EPUBCSSSink
Definition: EPUBCSSSink.h:23
libepubgen
Definition: EPUBBinarySink.cpp:12
libepubgen::EPUBSpanStyleManager::~EPUBSpanStyleManager
~EPUBSpanStyleManager()
destructor
Definition: EPUBSpanStyleManager.h:39
libepubgen::EPUBSpanStyleManager::defineSpan
void defineSpan(librevenge::RVNGPropertyList const &pList)
define a span style
Definition: EPUBSpanStyleManager.cpp:55
libepubgen::EPUBSpanStyleManager::getClass
std::string getClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBSpanStyleManager.cpp:24
libepubgen::EPUBSpanStyleManager::EPUBSpanStyleManager
EPUBSpanStyleManager()
constructor
Definition: EPUBSpanStyleManager.h:35
EPUBCSSProperties.h
libepubgen::EPUBSpanStyleManager::extractDecorations
void extractDecorations(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
add data corresponding to the line decoration into the map
Definition: EPUBSpanStyleManager.cpp:146
libepubgen::EPUBSpanStyleManager::operator=
EPUBSpanStyleManager operator=(EPUBSpanStyleManager const &orig)
libepubgen::EPUBSpanStyleManager::m_contentNameMap
ContentNameMap_t m_contentNameMap
a map content -> name
Definition: EPUBSpanStyleManager.h:58
libepubgen::EPUBSpanStyleManager::send
void send(EPUBCSSSink &out)
send the data to the sink
Definition: EPUBSpanStyleManager.cpp:68
libepubgen::EPUBCSSProperties
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
libepubgen::EPUBSpanStyleManager::getStyle
std::string getStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition: EPUBSpanStyleManager.cpp:44
libepubgen::EPUBSpanStyleManager::extractProperties
void extractProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBSpanStyleManager.cpp:78
libepubgen::EPUBSpanStyleManager::extractTextPosition
void extractTextPosition(char const *value, EPUBCSSProperties &cssProps) const
add data corresponding to a text position into the map
Definition: EPUBSpanStyleManager.cpp:177
libepubgen::EPUBSpanStyleManager::ContentNameMap_t
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition: EPUBSpanStyleManager.h:31