EPUBListStyleManager.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_EPUBLISTSTYLEMANAGER_H
11#define INCLUDED_EPUBLISTSTYLEMANAGER_H
12
13#include <string>
14#include <map>
15#include <unordered_map>
16#include <vector>
17
18#include <boost/functional/hash.hpp>
19
20#include <librevenge/librevenge.h>
21
22#include "EPUBCSSProperties.h"
24
25namespace libepubgen
26{
27
28class EPUBCSSContent;
29
32{
33public:
34 struct List
35 {
36 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
37
40 {
41 }
42
43 void setLevel(int lvl, librevenge::RVNGPropertyList const &property, bool ordered);
45 void openLevel() const
46 {
47 m_level++;
48 }
49
50 void closeLevel() const
51 {
52 if (m_level <= 0)
53 return;
54 m_level--;
55 }
56
59
60 protected:
62 std::vector<EPUBCSSProperties> m_contentsList;
64 mutable int m_level;
65 };
66
71
73 {
74 }
75
76 void defineLevel(librevenge::RVNGPropertyList const &property, bool ordered);
78 std::string openLevel(librevenge::RVNGPropertyList const &pList, bool ordered);
80 void closeLevel();
82 std::string getClass(librevenge::RVNGPropertyList const &pList);
83
85 void send(EPUBCSSContent &out);
86protected:
90 std::map<int, List> m_idListMap;
92 std::vector<int> m_actualIdStack;
93private:
96};
97
98}
99
100#endif
101
102/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition EPUBCSSContent.h:24
std::string openLevel(librevenge::RVNGPropertyList const &pList, bool ordered)
returns the class name corresponding to a propertylist
Definition EPUBListStyleManager.cpp:118
void closeLevel()
close a level
Definition EPUBListStyleManager.cpp:145
EPUBListStyleManager operator=(EPUBListStyleManager const &orig)
EPUBListStyleManager(EPUBListStyleManager const &orig)
void defineLevel(librevenge::RVNGPropertyList const &property, bool ordered)
add a level to the corresponding list
Definition EPUBListStyleManager.cpp:103
std::vector< int > m_actualIdStack
the actual list id
Definition EPUBListStyleManager.h:92
~EPUBListStyleManager() override
destructor
Definition EPUBListStyleManager.h:72
std::string getClass(librevenge::RVNGPropertyList const &pList)
returns the classname corresponding to a list element
Definition EPUBListStyleManager.cpp:90
std::map< int, List > m_idListMap
a map listId -> list
Definition EPUBListStyleManager.h:90
List::ContentNameMap_t m_levelNameMap
a map content -> list level name
Definition EPUBListStyleManager.h:88
void send(EPUBCSSContent &out)
send the data to the sink
Definition EPUBListStyleManager.cpp:78
EPUBListStyleManager()
constructor
Definition EPUBListStyleManager.h:67
EPUBParagraphStyleManager()
constructor
Definition EPUBParagraphStyleManager.h:35
Definition EPUBBinaryContent.cpp:15
std::map< std::string, std::string > EPUBCSSProperties
Definition EPUBCSSProperties.h:21
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition EPUBListStyleManager.h:36
void closeLevel() const
open a new level
Definition EPUBListStyleManager.h:50
int m_level
the actual list level
Definition EPUBListStyleManager.h:64
void openLevel() const
open a new level
Definition EPUBListStyleManager.h:45
void setLevel(int lvl, librevenge::RVNGPropertyList const &property, bool ordered)
set the property correspond to a level
Definition EPUBListStyleManager.cpp:25
std::vector< EPUBCSSProperties > m_contentsList
the properties
Definition EPUBListStyleManager.h:62
List()
constructor
Definition EPUBListStyleManager.h:39
const EPUBCSSProperties & getCurrentProperties() const
return the properties of the current level
Definition EPUBListStyleManager.cpp:67

Generated for libepubgen by doxygen 1.18.0