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 
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;
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: */
Definition: EPUBSplitGuard.h:19
void setCurrentHeadingLevel(unsigned level)
Definition: EPUBSplitGuard.cpp:33
bool inHeading(bool any) const
Definition: EPUBSplitGuard.cpp:73
void closeLevel()
Definition: EPUBSplitGuard.cpp:53
void setSplitMethod(EPUBSplitMethod method)
Allows overwriting the value given in the constructor.
Definition: EPUBSplitGuard.cpp:43
void setSplitHeadingLevel(unsigned level)
Definition: EPUBSplitGuard.cpp:28
unsigned m_currentSize
Definition: EPUBSplitGuard.h:48
unsigned m_currentHeadingLevel
Definition: EPUBSplitGuard.h:46
EPUBSplitGuard(EPUBSplitMethod method)
Definition: EPUBSplitGuard.cpp:18
void onSplit()
Definition: EPUBSplitGuard.cpp:89
void incrementSize(unsigned size)
Definition: EPUBSplitGuard.cpp:58
bool splitOnPageBreak() const
Definition: EPUBSplitGuard.cpp:63
unsigned m_size
Definition: EPUBSplitGuard.h:47
unsigned m_nestingLevel
Definition: EPUBSplitGuard.h:49
bool canSplit(EPUBSplitMethod method) const
Definition: EPUBSplitGuard.cpp:94
unsigned m_headingLevel
Definition: EPUBSplitGuard.h:45
void openLevel()
Definition: EPUBSplitGuard.cpp:48
bool splitOnHeading(unsigned level) const
Definition: EPUBSplitGuard.cpp:68
void setSplitSize(unsigned size)
Definition: EPUBSplitGuard.cpp:38
EPUBSplitMethod m_method
Definition: EPUBSplitGuard.h:44
bool splitOnSize() const
Definition: EPUBSplitGuard.cpp:84
Definition: EPUBBinarySink.cpp:13

Generated for libepubgen by doxygen 1.9.1