FB2Token.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 FB2TOKEN_H_INCLUDED
11 #define FB2TOKEN_H_INCLUDED
12
13 #include "EBOOKToken.h"
14
15 #include <boost/static_assert.hpp>
16
17 namespace libebook
18 {
19
20 #define FB2_NO_NAMESPACE(ns) (0 == ns)
21
22 namespace FB2Token
23 {
24
25 enum
26 {
27 INVALID_TOKEN = 0,
28 FIRST_TOKEN = EBOOKToken<FB2Parser>::FIRST_TOKEN,
29
30 // namespaces
31 NS_FICTIONBOOK,
32 NS_XLINK,
33 NS_XML,
34 NS_XMLNS,
35
36 // elements
37 a,
38 annotation,
39 author,
40 binary,
41 body,
42 book_name,
43 book_title,
44 cite,
45 city,
46 code,
47 coverpage,
48 custom_info,
49 date,
50 description,
51 document_info,
52 email,
53 emphasis,
54 empty_line,
55 epigraph,
56 FictionBook,
57 first_name,
58 genre,
59 history,
60 home_page,
61 id,
62 image,
63 isbn,
64 keywords,
65 lang,
66 last_name,
67 middle_name,
68 nickname,
69 output,
70 output_document,
71 p,
72 part,
73 poem,
74 program_used,
75 publisher,
76 publish_info,
77 section,
78 sequence,
79 src_lang,
80 src_ocr,
81 src_title_info,
82 src_url,
83 stanza,
84 strikethrough,
85 strong,
86 style,
87 stylesheet,
88 sub,
89 subtitle,
90 sup,
91 table,
92 td,
93 text_author,
94 th,
95 title,
96 title_info,
97 tr,
98 translator,
99 v,
100 version,
101 year,
102
103 // attributes
104 align,
105 alt,
106 colspan,
107 content_type,
108 create,
109 currency,
110 href,
111 include,
112 include_all,
113 info_type,
114 match,
115 mode,
116 name,
117 number,
118 price,
119 rowspan,
120 type,
121 value,
122
123 // attribute values
124 image_jpg,
125 note,
126 simple,
127
128 LAST_TOKEN
129 };
130
131 BOOST_STATIC_ASSERT(EBOOKToken<FB2Parser>::LAST_TOKEN >= LAST_TOKEN);
132
133 }
134
135 struct FB2TokenData
136 {
137 const char *name;
138 int id;
139 };
140
141 const FB2TokenData *getFB2Token(const char *str, const unsigned length);
142 const FB2TokenData *getFB2Token(const char *str);
143 const FB2TokenData *getFB2Token(const unsigned char *str);
144
145 int getFB2TokenID(const FB2TokenData &token);
146 int getFB2TokenID(const FB2TokenData *token);
147 int getFB2TokenID(const char *str, const unsigned length);
148 int getFB2TokenID(const char *str);
149 int getFB2TokenID(const unsigned char *str);
150
151 const char *getFB2TokenName(const FB2TokenData &token);
152 const char *getFB2TokenName(const FB2TokenData *token);
153 const char *getFB2TokenName(const char *str, const unsigned length);
154 const char *getFB2TokenName(const char *str);
155 const char *getFB2TokenName(const unsigned char *str);
156
157 }
158
159 #endif // FB2TOKEN_H_INCLUDED
160
161 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::FB2Token::code
Definition: FB2Token.h:46
libebook::FB2Token::keywords
Definition: FB2Token.h:64
libebook::FB2Token::body
Definition: FB2Token.h:41
libebook::FB2Token::sub
Definition: FB2Token.h:88
libebook::FB2Token::author
Definition: FB2Token.h:39
libebook::FB2Token::strong
Definition: FB2Token.h:85
libebook::FB2Token::currency
Definition: FB2Token.h:109
libebook::FB2TokenData::id
int id
Definition: FB2Token.h:138
libebook::FB2Token::NS_XMLNS
Definition: FB2Token.h:34
libebook::FB2Token::year
Definition: FB2Token.h:101
libebook::FB2Token::sequence
Definition: FB2Token.h:78
libebook::FB2Token::alt
Definition: FB2Token.h:105
str
const char * str
Definition: EBOOKHTMLParser.cpp:52
libebook::FB2Token::last_name
Definition: FB2Token.h:66
libebook::FB2Token::history
Definition: FB2Token.h:59
libebook::FB2Token::first_name
Definition: FB2Token.h:57
libebook::FB2Token::table
Definition: FB2Token.h:91
libebook::FB2Token::city
Definition: FB2Token.h:45
libebook::FB2TokenData
Definition: FB2Token.h:135
libebook::FB2Token::th
Definition: FB2Token.h:94
libebook::FB2Token::stylesheet
Definition: FB2Token.h:87
libebook::FB2Token::NS_XLINK
Definition: FB2Token.h:32
libebook::FB2Token::src_url
Definition: FB2Token.h:82
libebook::FB2Token::poem
Definition: FB2Token.h:73
libebook::FB2Token::output_document
Definition: FB2Token.h:70
libebook::FB2Token::LAST_TOKEN
Definition: FB2Token.h:128
libebook::FB2TokenData::name
const char * name
Definition: FB2Token.h:137
libebook::FB2Token::type
Definition: FB2Token.h:120
libebook::FB2Token::include_all
Definition: FB2Token.h:112
libebook::FB2Token::book_title
Definition: FB2Token.h:43
libebook::FB2Token::title
Definition: FB2Token.h:95
libebook::FB2Token::document_info
Definition: FB2Token.h:51
libebook::FB2Token::tr
Definition: FB2Token.h:97
libebook::FB2Token::home_page
Definition: FB2Token.h:60
libebook::FB2Token::content_type
Definition: FB2Token.h:107
libebook::FB2Token::cite
Definition: FB2Token.h:44
libebook::FB2Token::genre
Definition: FB2Token.h:58
libebook::FB2Token::book_name
Definition: FB2Token.h:42
libebook::FB2Token::FictionBook
Definition: FB2Token.h:56
libebook::FB2Token::src_ocr
Definition: FB2Token.h:80
libebook::FB2Token::rowspan
Definition: FB2Token.h:119
libebook::FB2Token::INVALID_TOKEN
Definition: FB2Token.h:27
libebook::FB2Token::output
Definition: FB2Token.h:69
libebook::FB2Token::td
Definition: FB2Token.h:92
libebook::FB2Token::publish_info
Definition: FB2Token.h:76
libebook::FB2Token::lang
Definition: FB2Token.h:65
libebook::FB2Token::epigraph
Definition: FB2Token.h:55
libebook::FB2Token::image_jpg
Definition: FB2Token.h:124
libebook::FB2Token::translator
Definition: FB2Token.h:98
libebook::FB2Token::strikethrough
Definition: FB2Token.h:84
libebook::getFB2Token
const FB2TokenData * getFB2Token(const char *const str, const unsigned length)
Definition: FB2Token.cpp:29
libebook::FB2Token::version
Definition: FB2Token.h:100
libebook::EBOOKToken
Definition: EBOOKToken.h:17
libebook::FB2Token::style
Definition: FB2Token.h:86
libebook::FB2Token::coverpage
Definition: FB2Token.h:47
libebook::FB2Token::stanza
Definition: FB2Token.h:83
libebook::FB2Token::date
Definition: FB2Token.h:49
libebook::FB2Token::image
Definition: FB2Token.h:62
libebook::FB2Token::middle_name
Definition: FB2Token.h:67
libebook::FB2Token::custom_info
Definition: FB2Token.h:48
libebook::FB2Token::isbn
Definition: FB2Token.h:63
libebook::FB2Token::sup
Definition: FB2Token.h:90
libebook::FB2Token::NS_FICTIONBOOK
Definition: FB2Token.h:31
libebook::FB2Token::empty_line
Definition: FB2Token.h:54
libebook::FB2Token::p
Definition: FB2Token.h:71
libebook::FB2Token::description
Definition: FB2Token.h:50
libebook::FB2Token::info_type
Definition: FB2Token.h:113
libebook::FB2Token::subtitle
Definition: FB2Token.h:89
libebook::FB2Token::simple
Definition: FB2Token.h:126
libebook::FB2Token::FIRST_TOKEN
Definition: FB2Token.h:28
EBOOKToken.h
libebook::FB2Token::title_info
Definition: FB2Token.h:96
libebook::FB2Token::include
Definition: FB2Token.h:111
libebook::FB2Token::v
Definition: FB2Token.h:99
libebook::FB2Token::section
Definition: FB2Token.h:77
libebook::getFB2TokenID
int getFB2TokenID(const FB2TokenData &token)
Definition: FB2Token.cpp:50
libebook::FB2Token::program_used
Definition: FB2Token.h:74
libebook::FB2Token::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(EBOOKToken< FB2Parser >::LAST_TOKEN >=LAST_TOKEN)
libebook
Definition: CHMParser.cpp:20
libebook::FB2Token::colspan
Definition: FB2Token.h:106
libebook::FB2Token::src_title_info
Definition: FB2Token.h:81
libebook::FB2Token::price
Definition: FB2Token.h:118
libebook::FB2Token::match
Definition: FB2Token.h:114
length
unsigned length
Definition: IMPParser.cpp:72
libebook::FB2Token::publisher
Definition: FB2Token.h:75
libebook::FB2Token::part
Definition: FB2Token.h:72
libebook::FB2Token::text_author
Definition: FB2Token.h:93
libebook::FB2Token::NS_XML
Definition: FB2Token.h:33
libebook::FB2Token::annotation
Definition: FB2Token.h:38
libebook::FB2Token::binary
Definition: FB2Token.h:40
libebook::FB2Token::a
Definition: FB2Token.h:37
libebook::FB2Token::name
Definition: FB2Token.h:116
libebook::FB2Token::emphasis
Definition: FB2Token.h:53
libebook::FB2Token::id
Definition: FB2Token.h:61
libebook::FB2Token::value
Definition: FB2Token.h:121
libebook::FB2Token::align
Definition: FB2Token.h:104
libebook::getFB2TokenName
const char * getFB2TokenName(const FB2TokenData &token)
Definition: FB2Token.cpp:77
libebook::FB2Token::email
Definition: FB2Token.h:52
libebook::FB2Token::number
Definition: FB2Token.h:117
libebook::FB2Token::href
Definition: FB2Token.h:110
libebook::FB2Token::mode
Definition: FB2Token.h:115
libebook::FB2Token::src_lang
Definition: FB2Token.h:79
libebook::FB2Token::create
Definition: FB2Token.h:108
libebook::FB2Token::nickname
Definition: FB2Token.h:68
libebook::FB2Token::note
Definition: FB2Token.h:125