EPUBSplitGuard.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_EPUBSPLITGUARD_H
11 #define INCLUDED_EPUBSPLITGUARD_H
12
13 #include <libepubgen/libepubgen.h>
14
15 namespace libepubgen
16 {
17
18 class EPUBSplitGuard
19 {
20 public:
21 explicit EPUBSplitGuard(EPUBSplitMethod method);
22
23 void setSplitHeadingLevel(unsigned level);
24 void setCurrentHeadingLevel(unsigned level);
25 void setSplitSize(unsigned size);
27 void setSplitMethod(EPUBSplitMethod method);
28
29 void openLevel();
30 void closeLevel();
31 void incrementSize(unsigned size);
32
33 bool splitOnPageBreak() const;
34 bool splitOnHeading(unsigned level) const;
35 bool inHeading(bool any) const;
36 bool splitOnSize() const;
37
38 void onSplit();
39
40 private:
41 bool canSplit(EPUBSplitMethod method) const;
42
43 private:
44 EPUBSplitMethod m_method;
45 unsigned m_headingLevel;
46 unsigned m_currentHeadingLevel;
47 unsigned m_size;
48 unsigned m_currentSize;
49 unsigned m_nestingLevel;
50 };
51
52 }
53
54 #endif // INCLUDED_EPUBSPLITGUARD
55
56 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libepubgen::EPUBSplitGuard::canSplit
bool canSplit(EPUBSplitMethod method) const
Definition: EPUBSplitGuard.cpp:94
libepubgen::EPUBSplitGuard::onSplit
void onSplit()
Definition: EPUBSplitGuard.cpp:89
libepubgen::EPUBSplitGuard::setSplitHeadingLevel
void setSplitHeadingLevel(unsigned level)
Definition: EPUBSplitGuard.cpp:28
libepubgen::EPUBSplitGuard::m_size
unsigned m_size
Definition: EPUBSplitGuard.h:47
libepubgen::EPUBSplitGuard::m_currentSize
unsigned m_currentSize
Definition: EPUBSplitGuard.h:48
libepubgen
Definition: EPUBBinarySink.cpp:12
libepubgen::EPUBSplitGuard::openLevel
void openLevel()
Definition: EPUBSplitGuard.cpp:48
libepubgen::EPUBSplitGuard::setSplitMethod
void setSplitMethod(EPUBSplitMethod method)
Allows overwriting the value given in the constructor.
Definition: EPUBSplitGuard.cpp:43
libepubgen::EPUBSplitGuard::m_nestingLevel
unsigned m_nestingLevel
Definition: EPUBSplitGuard.h:49
libepubgen::EPUBSplitGuard::m_headingLevel
unsigned m_headingLevel
Definition: EPUBSplitGuard.h:45
libepubgen::EPUBSplitGuard::EPUBSplitGuard
EPUBSplitGuard(EPUBSplitMethod method)
Definition: EPUBSplitGuard.cpp:18
libepubgen::EPUBSplitGuard::m_currentHeadingLevel
unsigned m_currentHeadingLevel
Definition: EPUBSplitGuard.h:46
libepubgen::EPUBSplitGuard::incrementSize
void incrementSize(unsigned size)
Definition: EPUBSplitGuard.cpp:58
libepubgen::EPUBSplitGuard::m_method
EPUBSplitMethod m_method
Definition: EPUBSplitGuard.h:44
libepubgen::EPUBSplitGuard
Definition: EPUBSplitGuard.h:18
libepubgen::EPUBSplitGuard::splitOnSize
bool splitOnSize() const
Definition: EPUBSplitGuard.cpp:84
libepubgen::EPUBSplitGuard::closeLevel
void closeLevel()
Definition: EPUBSplitGuard.cpp:53
libepubgen::EPUBSplitGuard::splitOnPageBreak
bool splitOnPageBreak() const
Definition: EPUBSplitGuard.cpp:63
libepubgen::EPUBSplitGuard::setSplitSize
void setSplitSize(unsigned size)
Definition: EPUBSplitGuard.cpp:38
libepubgen::EPUBSplitGuard::inHeading
bool inHeading(bool any) const
Definition: EPUBSplitGuard.cpp:73
libepubgen::EPUBSplitGuard::setCurrentHeadingLevel
void setCurrentHeadingLevel(unsigned level)
Definition: EPUBSplitGuard.cpp:33
libepubgen::EPUBSplitGuard::splitOnHeading
bool splitOnHeading(unsigned level) const
Definition: EPUBSplitGuard.cpp:68