EBOOKXMLParser.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 EBOOKXMLPARSER_H_INCLUDED
11#define EBOOKXMLPARSER_H_INCLUDED
12
13#include "libebook_utils.h"
14
15 namespace libebook
16{
17
18 class EBOOKTokenizer;
19 class EBOOKXMLContext;
20
21 class EBOOKXMLParser
22{
23 // disable copying
24 EBOOKXMLParser(const EBOOKXMLParser &);
25 EBOOKXMLParser &operator=(const EBOOKXMLParser &);
26
27 public:
31 enum RunStyle
32 {
33 RunToEnd,
34 AllowEarlyExit
35 };
36
37 public:
38 explicit EBOOKXMLParser(RunStyle runStyle = RunToEnd);
39
40 bool parse(const RVNGInputStreamPtr_t &input);
41
42 protected:
43 ~EBOOKXMLParser();
44
45 private:
46 virtual std::shared_ptr<EBOOKXMLContext> createDocumentContext() = 0;
47
48 virtual const EBOOKTokenizer &getTokenizer() const = 0;
49
50 private:
51 const RunStyle m_runStyle;
52};
53
54}
55
56#endif
57
58/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::EBOOKTokenizer
Definition EBOOKTokenizer.h:17
libebook::EBOOKXMLParser
Definition EBOOKXMLParser.h:22
libebook::EBOOKXMLParser::parse
bool parse(const RVNGInputStreamPtr_t &input)
Definition EBOOKXMLParser.cpp:93
libebook::EBOOKXMLParser::RunStyle
RunStyle
Determines whether or not the parser should quit when a context returns an empty context for a child ...
Definition EBOOKXMLParser.h:32
libebook::EBOOKXMLParser::AllowEarlyExit
@ AllowEarlyExit
Continue, skipping the child element.
Definition EBOOKXMLParser.h:34
libebook::EBOOKXMLParser::RunToEnd
@ RunToEnd
Definition EBOOKXMLParser.h:33
libebook::EBOOKXMLParser::EBOOKXMLParser
EBOOKXMLParser(const EBOOKXMLParser &)
libebook::EBOOKXMLParser::~EBOOKXMLParser
~EBOOKXMLParser()
Definition EBOOKXMLParser.cpp:89
libebook::EBOOKXMLParser::operator=
EBOOKXMLParser & operator=(const EBOOKXMLParser &)
libebook::EBOOKXMLParser::m_runStyle
const RunStyle m_runStyle
Definition EBOOKXMLParser.h:51
libebook::EBOOKXMLParser::getTokenizer
virtual const EBOOKTokenizer & getTokenizer() const =0
libebook::EBOOKXMLParser::createDocumentContext
virtual std::shared_ptr< EBOOKXMLContext > createDocumentContext()=0
libebook_utils.h
libebook
Definition BBeBCollector.cpp:19
libebook::RVNGInputStreamPtr_t
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition libebook_utils.h:54