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 EBOOKOPFTOKEN_H_INCLUDED
11 #define EBOOKOPFTOKEN_H_INCLUDED
12 
13 #include "EBOOKToken.h"
14 
15 namespace libebook
16 {
17 
18 namespace EBOOKOPFToken
19 {
20 
21 enum
22 {
23   INVALID_TOKEN = 0,
24   FIRST_TOKEN = EBOOKToken<EBOOKOPFParser>::FIRST_TOKEN,
25 
26   // namespace prefixes
27   dc,
28   opf,
29   xml,
30   xmlns,
31 
32   // elements
33   Contributor,
34   Coverage,
35   Creator,
36   Date,
37   Description,
38   Format,
39   Identifier,
40   Language,
41   Publisher,
42   Relation,
43   Rights,
44   Source,
45   Subject,
46   Title,
47   Type,
48   contributor,
49   coverage,
50   creator,
51   date,
52   dc_metadata,
53   description,
54   format,
55   guide,
56   identifier,
57   item,
58   itemref,
59   language,
60   manifest,
61   meta,
62   metadata,
63   package,
64   publisher,
65   reference,
66   relation,
67   rights,
68   site,
69   source,
70   spine,
71   subject,
72   title,
73   tour,
74   tours,
75   type,
76   x_metadata,
77 
78   // attributes
79   content,
80   event,
81   fallback,
82   fallback_style,
83   file_as,
84   href,
85   id,
86   idref,
87   lang,
88   linear,
89   media_type,
90   name,
91   required_modules,
92   required_namespace,
93   role,
94   scheme,
95   toc,
96   unique_identifier,
97   version,
98 
99   // attribute values
100   MIME_image,
101   MIME_oeb,
102   MIME_xhtml,
103   _2_0,
104   _3_0,
105   aut,
106   creation,
107   edt,
108   modification,
109   no,
110   publication,
111   yes,
112 
113   LAST_TOKEN
114 };
115 
116 static_assert(EBOOKToken<EBOOKOPFParser>::LAST_TOKEN >= LAST_TOKEN, "token number overflow");
117 
118 enum Namespace
119 {
120   NS_dc = dc << 16,
121   NS_opf = opf << 16,
122   NS_xml = xml << 16,
123   NS_xmlns = xmlns << 16
124 };
125 
126 }
127 
128 int getOPFTokenId(const char *name, const char *ns = nullptr);
129 int getOPFTokenId(const char *name, std::size_t nameLen, const char *ns, std::size_t nsLen);
130 int getOPFTokenId(const char *name, std::size_t nameLen);
131 
132 }
133 
134 #endif // EBOOKOPFTOKEN_H_INCLUDED
135 
136 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
137