-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnsrtocentry.h
157 lines (137 loc) · 3.05 KB
/
nsrtocentry.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef __NSRTOCENTRY_H__
#define __NSRTOCENTRY_H__
/**
* @file nsrtocentry.h
* @author Alexander Saprykin
* @brief Table of contents (TOC)
*/
#include "nsrreadercore_global.h"
#include <QString>
#include <QList>
/**
* @class NSRTocEntry nsrtocentry.h
* @brief TOC representation
* @since 1.5.2
*/
class NSRREADERCORE_SHARED NSRTocEntry
{
public:
/**
* @brief Constructor with parameters
* @param title Entry title.
* @param page Reference page, from 1.
*/
NSRTocEntry (const QString& title, int page);
/** Destructor */
~NSRTocEntry ();
/**
* @brief Clones TOC entry
* @return Cloned TOC entry.
* @since 1.5.3
*
* Caller takes ownership of the returned object.
*/
NSRTocEntry * clone () const;
/**
* @brief Gets list of available children TOC entries
* @return Children TOC entries.
* @since 1.5.2
*/
QList<const NSRTocEntry *> getChildren () const;
/**
* @brief Appends child TOC entry
* @param entry Child TOC entry to append.
* @since 1.5.2
*
* Takes ownership of given object.
*/
void appendChild (NSRTocEntry *entry);
/**
* @brief Gets entry title
* @return Entry title.
* @since 1.5.2
*/
inline QString getTitle () const {
return _title;
}
/**
* @brief Gets external file path
* @return External file path.
* @since 1.5.2
*/
inline QString getExternalFile () const {
return _externalFile;
}
/**
* @brief Gets external URI
* @return External URI.
* @since 1.5.2
*/
inline QString getUri () const {
return _uri;
}
/**
* @brief Gets page number
* @return Page number.
* @since 1.5.2
*/
inline int getPage () const {
return _page;
}
/**
* @brief Checks whether entry is referenced to external resource
* @return True in case of success, false otherwise.
* @since 1.5.2
*/
inline bool isExternal () const {
return _isExternal;
}
/**
* @brief Sets entry title
* @param title Entry title.
* @since 1.5.2
*/
inline void setTitle (const QString& title) {
_title = title;
}
/**
* @brief Sets external file path.
* @param externalFile External file path.
* @since 1.5.2
*/
inline void setExternalFile (const QString& externalFile) {
_externalFile = externalFile;
}
/**
* @brief Sets external URI
* @param uri External URI.
* @since 1.5.2
*/
inline void setUri (const QString& uri) {
_uri = uri;
}
/**
* @brief Sets page number
* @param page Page number, from 1.
* @since 1.5.2
*/
inline void setPage (int page) {
_page = page;
}
/**
* @brief Sets entry as external reference
* @param external Whether the entry is external reference.
* @since 1.5.2
*/
inline void setExternal (bool external) {
_isExternal = external;
}
private:
QList<NSRTocEntry *> _children; /**< Children entries if any */
QString _title; /**< TOC entry title */
QString _externalFile; /**< External file in case of external reference */
QString _uri; /**< URI in case of destination URI */
int _page; /**< Page number, from 1 */
bool _isExternal; /**< Whether reference is external */
};
#endif /* __NSRTOCENTRY_H__ */