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