FB2Token.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libe-book project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef FB2TOKEN_H_INCLUDED
00011 #define FB2TOKEN_H_INCLUDED
00012 
00013 #include "EBOOKToken.h"
00014 
00015 #include <boost/static_assert.hpp>
00016 
00017 namespace libebook
00018 {
00019 
00020 #define FB2_NO_NAMESPACE(ns) (0 == ns)
00021 
00022 namespace FB2Token
00023 {
00024 
00025 enum
00026 {
00027   INVALID_TOKEN = 0,
00028   FIRST_TOKEN = EBOOKToken<FB2Parser>::FIRST_TOKEN,
00029 
00030   // namespaces
00031   NS_FICTIONBOOK,
00032   NS_XLINK,
00033   NS_XML,
00034   NS_XMLNS,
00035 
00036   // elements
00037   a,
00038   annotation,
00039   author,
00040   binary,
00041   body,
00042   book_name,
00043   book_title,
00044   cite,
00045   city,
00046   code,
00047   coverpage,
00048   custom_info,
00049   date,
00050   description,
00051   document_info,
00052   email,
00053   emphasis,
00054   empty_line,
00055   epigraph,
00056   FictionBook,
00057   first_name,
00058   genre,
00059   history,
00060   home_page,
00061   id,
00062   image,
00063   isbn,
00064   keywords,
00065   lang,
00066   last_name,
00067   middle_name,
00068   nickname,
00069   output,
00070   output_document,
00071   p,
00072   part,
00073   poem,
00074   program_used,
00075   publisher,
00076   publish_info,
00077   section,
00078   sequence,
00079   src_lang,
00080   src_ocr,
00081   src_title_info,
00082   src_url,
00083   stanza,
00084   strikethrough,
00085   strong,
00086   style,
00087   stylesheet,
00088   sub,
00089   subtitle,
00090   sup,
00091   table,
00092   td,
00093   text_author,
00094   th,
00095   title,
00096   title_info,
00097   tr,
00098   translator,
00099   v,
00100   version,
00101   year,
00102 
00103   // attributes
00104   align,
00105   alt,
00106   colspan,
00107   content_type,
00108   create,
00109   currency,
00110   href,
00111   include,
00112   include_all,
00113   info_type,
00114   match,
00115   mode,
00116   name,
00117   number,
00118   price,
00119   rowspan,
00120   type,
00121   value,
00122 
00123   // attribute values
00124   image_jpg,
00125   note,
00126   simple,
00127 
00128   LAST_TOKEN
00129 };
00130 
00131 BOOST_STATIC_ASSERT(EBOOKToken<FB2Parser>::LAST_TOKEN >= LAST_TOKEN);
00132 
00133 }
00134 
00135 struct FB2TokenData
00136 {
00137   const char *name;
00138   int id;
00139 };
00140 
00141 const FB2TokenData *getFB2Token(const char *str, const unsigned length);
00142 const FB2TokenData *getFB2Token(const char *str);
00143 const FB2TokenData *getFB2Token(const unsigned char *str);
00144 
00145 int getFB2TokenID(const FB2TokenData &token);
00146 int getFB2TokenID(const FB2TokenData *token);
00147 int getFB2TokenID(const char *str, const unsigned length);
00148 int getFB2TokenID(const char *str);
00149 int getFB2TokenID(const unsigned char *str);
00150 
00151 const char *getFB2TokenName(const FB2TokenData &token);
00152 const char *getFB2TokenName(const FB2TokenData *token);
00153 const char *getFB2TokenName(const char *str, const unsigned length);
00154 const char *getFB2TokenName(const char *str);
00155 const char *getFB2TokenName(const unsigned char *str);
00156 
00157 }
00158 
00159 #endif // FB2TOKEN_H_INCLUDED
00160 
00161 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */