IWORKDiscardContext.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 libetonyek 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 IWORKDISCARDCONTEXT_H_INCLUDED
11 #define IWORKDISCARDCONTEXT_H_INCLUDED
12
13 #include <memory>
14
15 #include "IWORKXMLContext.h"
16
17 namespace libetonyek
18 {
19
20 class IWORKXMLParserState;
21
22 /* Warning in g++ because std::enable_shared_from_this<IWORKDiscardContext> has no virtual
23 destructor.
24
25 If we replace public by protected, error with clang++ in KEY2Parser.cpp:1595 when doing
26 std::make_shared<DiscardContext>(m_state)
27 */
28 #if defined __GNUC__ && !defined __clang__
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
31 #endif
32 class IWORKDiscardContext : public IWORKXMLContext, public std::enable_shared_from_this<IWORKDiscardContext>
33 {
34 #if defined __GNUC__ && !defined __clang__
35 #pragma GCC diagnostic pop
36 #endif
37 struct Data;
38
39 public:
40 explicit IWORKDiscardContext(IWORKXMLParserState &state);
41 protected:
42 void startOfElement() override;
43 void attribute(int name, const char *value) override;
44 IWORKXMLContextPtr_t element(int name) override;
45 void text(const char *value) override;
46 void endOfElement() override;
47
48 private:
49 IWORKXMLParserState &m_state;
50 unsigned m_level;
51 bool m_enableCollector;
52 std::shared_ptr<Data> m_data;
53 };
54
55 }
56
57 #endif // IWORKDISCARDCONTEXT_H_INCLUDED
58
59 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek
Definition: IWORKBezierElement.cpp:20
libetonyek::IWORKDiscardContext::m_data
std::shared_ptr< Data > m_data
Definition: IWORKDiscardContext.h:52
libetonyek::IWORKXMLContextPtr_t
std::shared_ptr< IWORKXMLContext > IWORKXMLContextPtr_t
Definition: IWORKXMLContext.h:18
libetonyek::IWORKXMLContext
Definition: IWORKXMLContext.h:22
libetonyek::IWORKToken::value
Definition: IWORKToken.h:624
libetonyek::IWORKDiscardContext::attribute
void attribute(int name, const char *value) override
Process an attribute.
Definition: IWORKDiscardContext.cpp:77
libetonyek::IWORKDiscardContext::m_enableCollector
bool m_enableCollector
Definition: IWORKDiscardContext.h:51
libetonyek::IWORKDiscardContext::m_level
unsigned m_level
Definition: IWORKDiscardContext.h:50
name
const char * name
Definition: IWORKToken.cpp:43
libetonyek::IWORKDiscardContext::endOfElement
void endOfElement() override
Signalize the end of an element.
Definition: IWORKDiscardContext.cpp:133
libetonyek::IWORKDiscardContext::text
void text(const char *value) override
Process textual content of an element.
Definition: IWORKDiscardContext.cpp:129
libetonyek::IWORKXMLParserState
Definition: IWORKXMLParserState.h:31
libetonyek::IWORKDiscardContext::startOfElement
void startOfElement() override
Signalize the start of an element.
Definition: IWORKDiscardContext.cpp:67
libetonyek::IWORKDiscardContext::IWORKDiscardContext
IWORKDiscardContext(IWORKXMLParserState &state)
Definition: IWORKDiscardContext.cpp:59
libetonyek::IWORKDiscardContext::m_state
IWORKXMLParserState & m_state
Definition: IWORKDiscardContext.h:49
libetonyek::IWORKDiscardContext
Definition: IWORKDiscardContext.h:32
libetonyek::IWORKDiscardContext::Data
Definition: IWORKDiscardContext.cpp:33
IWORKXMLContext.h
libetonyek::IWORKDiscardContext::element
IWORKXMLContextPtr_t element(int name) override
Create a context for parsing a child element.
Definition: IWORKDiscardContext.cpp:81