FB2TextContext.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 FB2TEXTCONTEXT_H_INCLUDED
00011 #define FB2TEXTCONTEXT_H_INCLUDED
00012 
00013 #include <string>
00014 
00015 #include "FB2ParserContext.h"
00016 
00017 namespace libebook
00018 {
00019 
00020 class FB2ParaContextBase : public FB2StyleContextBase
00021 {
00022 public:
00023   FB2ParaContextBase(FB2ParserContext *parentContext, const FB2BlockFormat &format);
00024 
00025 private:
00026   virtual void startOfElement();
00027   virtual void endOfElement();
00028   virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
00029 };
00030 
00031 class FB2AContext : public FB2StyleContextBase
00032 {
00033 public:
00034   FB2AContext(FB2ParserContext *parentContext, const FB2Style &style);
00035 
00036 private:
00037   virtual void startOfElement();
00038   virtual void endOfAttributes();
00039   virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
00040   virtual void text(const char *text);
00041 
00042 private:
00043   std::string m_href;
00044   bool m_valid;
00045   bool m_note;
00046 };
00047 
00048 class FB2CodeContext : public FB2StyleContextBase
00049 {
00050 public:
00051   FB2CodeContext(FB2ParserContext *parentContext, FB2Style &style);
00052 
00053 private:
00054   virtual void startOfElement();
00055 };
00056 
00057 class FB2EmphasisContext : public FB2StyleContextBase
00058 {
00059 public:
00060   FB2EmphasisContext(FB2ParserContext *parentContext, FB2Style &style);
00061 
00062 private:
00063   virtual void startOfElement();
00064 };
00065 
00066 class FB2InlineImageContext : public FB2DataContextBase
00067 {
00068 public:
00069   FB2InlineImageContext(FB2ParserContext *parentContext, const FB2Style &style);
00070 
00071 private:
00072   virtual void startOfElement();
00073   virtual void endOfElement();
00074   virtual void endOfAttributes();
00075   virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
00076 
00077 private:
00078   const FB2Style &m_style;
00079   std::string m_href;
00080   std::string m_altText;
00081   bool m_valid;
00082 };
00083 
00084 class FB2PContext : public FB2ParaContextBase
00085 {
00086 public:
00087   FB2PContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
00088 
00089 private:
00090   static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
00091 };
00092 
00093 class FB2StrikethroughContext : public FB2StyleContextBase
00094 {
00095 public:
00096   FB2StrikethroughContext(FB2ParserContext *parentContext, FB2Style &style);
00097 
00098 private:
00099   virtual void startOfElement();
00100 };
00101 
00102 class FB2StrongContext : public FB2StyleContextBase
00103 {
00104 public:
00105   FB2StrongContext(FB2ParserContext *parentContext, FB2Style &style);
00106 
00107 private:
00108   virtual void startOfElement();
00109 };
00110 
00111 class FB2StyleContext : public FB2StyleContextBase
00112 {
00113 public:
00114   FB2StyleContext(FB2ParserContext *parentContext, FB2Style &style);
00115 
00116 private:
00117   virtual void startOfElement();
00118 };
00119 
00120 class FB2SubContext : public FB2StyleContextBase
00121 {
00122 public:
00123   FB2SubContext(FB2ParserContext *parentContext, FB2Style &style);
00124 
00125 private:
00126   virtual void startOfElement();
00127 };
00128 
00129 class FB2SubtitleContext : public FB2ParaContextBase
00130 {
00131 public:
00132   explicit FB2SubtitleContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
00133 
00134 private:
00135   static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
00136 };
00137 
00138 class FB2SupContext : public FB2StyleContextBase
00139 {
00140 public:
00141   FB2SupContext(FB2ParserContext *parentContext, FB2Style &style);
00142 
00143 private:
00144   virtual void startOfElement();
00145 };
00146 
00147 class FB2TextAuthorContext : public FB2PContext
00148 {
00149 public:
00150   explicit FB2TextAuthorContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
00151 
00152 private:
00153   static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
00154 };
00155 
00156 class FB2VContext : public FB2ParaContextBase
00157 {
00158 public:
00159   explicit FB2VContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
00160 
00161 private:
00162   static FB2BlockFormat makeBlockFormat(const FB2BlockFormat &format);
00163 };
00164 
00165 }
00166 
00167 #endif // FB2TEXTCONTEXT_H_INCLUDED
00168 
00169 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */