FB2TextContext.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 libe-book 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 FB2TEXTCONTEXT_H_INCLUDED
11 #define FB2TEXTCONTEXT_H_INCLUDED
12
13 #include <string>
14
15 #include "FB2ParserContext.h"
16
17 namespace libebook
18 {
19
20 class FB2ParaContextBase : public FB2StyleContextBase
21 {
22 public:
23 FB2ParaContextBase(FB2ParserContext *parentContext, const FB2BlockFormat &format);
24
25 private:
26 virtual void startOfElement();
27 virtual void endOfElement();
28 virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
29 };
30
31 class FB2AContext : public FB2StyleContextBase
32 {
33 public:
34 FB2AContext(FB2ParserContext *parentContext, const FB2Style &style);
35
36 private:
37 virtual void startOfElement();
38 virtual void endOfAttributes();
39 virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
40 virtual void text(const char *text);
41
42 private:
43 std::string m_href;
44 bool m_valid;
45 bool m_note;
46 };
47
48 class FB2CodeContext : public FB2StyleContextBase
49 {
50 public:
51 FB2CodeContext(FB2ParserContext *parentContext, FB2Style &style);
52
53 private:
54 virtual void startOfElement();
55 };
56
57 class FB2EmphasisContext : public FB2StyleContextBase
58 {
59 public:
60 FB2EmphasisContext(FB2ParserContext *parentContext, FB2Style &style);
61
62 private:
63 virtual void startOfElement();
64 };
65
66 class FB2InlineImageContext : public FB2DataContextBase
67 {
68 public:
69 FB2InlineImageContext(FB2ParserContext *parentContext, const FB2Style &style);
70
71 private:
72 virtual void startOfElement();
73 virtual void endOfElement();
74 virtual void endOfAttributes();
75 virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
76
77 private:
78 const FB2Style &m_style;
79 std::string m_href;
80 std::string m_altText;
81 bool m_valid;
82 };
83
84 class FB2PContext : public FB2ParaContextBase
85 {
86 public:
87 FB2PContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
88
89 private:
90 static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
91 };
92
93 class FB2StrikethroughContext : public FB2StyleContextBase
94 {
95 public:
96 FB2StrikethroughContext(FB2ParserContext *parentContext, FB2Style &style);
97
98 private:
99 virtual void startOfElement();
100 };
101
102 class FB2StrongContext : public FB2StyleContextBase
103 {
104 public:
105 FB2StrongContext(FB2ParserContext *parentContext, FB2Style &style);
106
107 private:
108 virtual void startOfElement();
109 };
110
111 class FB2StyleContext : public FB2StyleContextBase
112 {
113 public:
114 FB2StyleContext(FB2ParserContext *parentContext, FB2Style &style);
115
116 private:
117 virtual void startOfElement();
118 };
119
120 class FB2SubContext : public FB2StyleContextBase
121 {
122 public:
123 FB2SubContext(FB2ParserContext *parentContext, FB2Style &style);
124
125 private:
126 virtual void startOfElement();
127 };
128
129 class FB2SubtitleContext : public FB2ParaContextBase
130 {
131 public:
132 explicit FB2SubtitleContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
133
134 private:
135 static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
136 };
137
138 class FB2SupContext : public FB2StyleContextBase
139 {
140 public:
141 FB2SupContext(FB2ParserContext *parentContext, FB2Style &style);
142
143 private:
144 virtual void startOfElement();
145 };
146
147 class FB2TextAuthorContext : public FB2PContext
148 {
149 public:
150 explicit FB2TextAuthorContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
151
152 private:
153 static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
154 };
155
156 class FB2VContext : public FB2ParaContextBase
157 {
158 public:
159 explicit FB2VContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
160
161 private:
162 static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
163 };
164
165 }
166
167 #endif // FB2TEXTCONTEXT_H_INCLUDED
168
169 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::FB2AContext::m_valid
bool m_valid
Definition: FB2TextContext.h:44
libebook::FB2EmphasisContext
Definition: FB2TextContext.h:57
libebook::FB2InlineImageContext::m_altText
std::string m_altText
Definition: FB2TextContext.h:80
style
optional< Style > style
Definition: TDParser.cpp:106
libebook::FB2VContext
Definition: FB2TextContext.h:156
libebook::FB2StyleContextBase::endOfAttributes
virtual void endOfAttributes()
Signalize the end of attributes.
Definition: FB2ParserContext.cpp:201
FB2ParserContext.h
libebook::FB2DataContextBase
Base class for leaf data element contexts.
Definition: FB2ParserContext.h:81
libebook::FB2StrongContext
Definition: FB2TextContext.h:102
libebook::FB2TokenData
Definition: FB2Token.h:135
libebook::FB2AContext::m_note
bool m_note
Definition: FB2TextContext.h:45
libebook::FB2Style
Definition: FB2Style.h:55
libebook::FB2ParaContextBase::startOfElement
virtual void startOfElement()
Signalize the start of an element.
Definition: FB2TextContext.cpp:22
libebook::EBOOKHTMLToken::value
Definition: EBOOKHTMLToken.h:263
libebook::FB2ParaContextBase::attribute
virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value)
Process an attribute.
Definition: FB2TextContext.cpp:32
libebook::FB2InlineImageContext::m_valid
bool m_valid
Definition: FB2TextContext.h:81
libebook::FB2InlineImageContext::m_href
std::string m_href
Definition: FB2TextContext.h:79
libebook::FB2ParaContextBase::endOfElement
virtual void endOfElement()
Signalize the end of an element.
Definition: FB2TextContext.cpp:27
libebook::FB2SubContext
Definition: FB2TextContext.h:120
libebook::FB2InlineImageContext::m_style
const FB2Style & m_style
Definition: FB2TextContext.h:78
libebook::FB2ParaContextBase::FB2ParaContextBase
FB2ParaContextBase(FB2ParserContext *parentContext, const FB2BlockFormat &format)
Definition: FB2TextContext.cpp:17
libebook::FB2PContext
Definition: FB2TextContext.h:84
libebook::FB2SubtitleContext
Definition: FB2TextContext.h:129
libebook::FB2ParaContextBase
Definition: FB2TextContext.h:20
libebook::FB2SupContext
Definition: FB2TextContext.h:138
name
string name
Definition: CHMStream.cpp:80
libebook::EBOOKOPFToken::format
Definition: EBOOKOPFToken.h:56
libebook::FB2InlineImageContext
Definition: FB2TextContext.h:66
libebook::FB2TextAuthorContext
Definition: FB2TextContext.h:147
libebook::FB2AContext::m_href
std::string m_href
Definition: FB2TextContext.h:43
libebook::FB2StyleContextBase::text
virtual void text(const char *value)
Process textual content of an element.
Definition: FB2ParserContext.cpp:211
libebook
Definition: CHMParser.cpp:20
libebook::FB2StyleContextBase
Definition: FB2ParserContext.h:132
libebook::FB2BlockFormat
Definition: FB2Style.h:35
libebook::FB2ParserContext
Base class for all contexts.
Definition: FB2ParserContext.h:23
libebook::FB2StrikethroughContext
Definition: FB2TextContext.h:93
libebook::FB2CodeContext
Definition: FB2TextContext.h:48
libebook::FB2StyleContext
Definition: FB2TextContext.h:111
libebook::FB2AContext
Definition: FB2TextContext.h:31