IWORKStyleContext.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 IWORKSTYLECONTEXT_H_INCLUDED
11 #define IWORKSTYLECONTEXT_H_INCLUDED
12
13 #include <string>
14
15 #include <boost/optional.hpp>
16
17 #include "IWORKPropertyMap.h"
18 #include "IWORKStyle_fwd.h"
19 #include "IWORKXMLContextBase.h"
20
21 namespace libetonyek
22 {
23
24 class IWORKStyleContext : public IWORKXMLElementContextBase
25 {
26 public:
27 IWORKStyleContext(IWORKXMLParserState &state, IWORKStyleMap_t *styleMap = nullptr);
28 IWORKStyleContext(IWORKXMLParserState &state, IWORKPropertyMap &props, IWORKStyleMap_t *styleMap = nullptr, const char *defaultParent = nullptr);
29
30 void attribute(int name, const char *value) override;
31 void endOfElement() override;
32
36 IWORKStylePtr_t getStyle()
37 {
38 return m_style;
39 }
40 private:
41 IWORKXMLContextPtr_t element(int name) override;
42
43 private:
44 IWORKStyleContext(IWORKStyleContext &);
45 IWORKStyleContext operator=(IWORKStyleContext &);
46
47 IWORKStyleMap_t *const m_styleMap;
48 const std::string m_defaultParent;
49 IWORKPropertyMap m_ownProps;
50 IWORKPropertyMap &m_props;
52 IWORKStylePtr_t m_style;
53 boost::optional<std::string> m_ident;
54 boost::optional<std::string> m_parentIdent;
55 };
56
57 }
58
59 #endif // IWORKSTYLECONTEXT_H_INCLUDED
60
61 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
IWORKStyle_fwd.h
libetonyek
Definition: IWORKBezierElement.cpp:20
libetonyek::IWORKStyleContext::element
IWORKXMLContextPtr_t element(int name) override
Definition: IWORKStyleContext.cpp:75
libetonyek::IWORKXMLContextPtr_t
std::shared_ptr< IWORKXMLContext > IWORKXMLContextPtr_t
Definition: IWORKXMLContext.h:18
IWORKXMLContextBase.h
libetonyek::IWORKStyleContext::IWORKStyleContext
IWORKStyleContext(IWORKXMLParserState &state, IWORKStyleMap_t *styleMap=nullptr)
Definition: IWORKStyleContext.cpp:24
libetonyek::IWORKStyleContext
Definition: IWORKStyleContext.h:24
libetonyek::IWORKPropertyMap
Represents a (hierarchical) property map.
Definition: IWORKPropertyMap.h:24
libetonyek::IWORKStyleContext::operator=
IWORKStyleContext operator=(IWORKStyleContext &)
libetonyek::IWORKStyleContext::m_defaultParent
const std::string m_defaultParent
Definition: IWORKStyleContext.h:48
libetonyek::IWORKStylePtr_t
std::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
libetonyek::IWORKToken::value
Definition: IWORKToken.h:624
libetonyek::IWORKStyleContext::getStyle
IWORKStylePtr_t getStyle()
returns the created style
Definition: IWORKStyleContext.h:36
libetonyek::IWORKStyleContext::m_props
IWORKPropertyMap & m_props
Definition: IWORKStyleContext.h:50
libetonyek::IWORKStyleContext::m_styleMap
IWORKStyleMap_t *const m_styleMap
Definition: IWORKStyleContext.h:47
libetonyek::IWORKStyleContext::endOfElement
void endOfElement() override
Definition: IWORKStyleContext.cpp:88
libetonyek::IWORKStyleContext::m_ident
boost::optional< std::string > m_ident
Definition: IWORKStyleContext.h:53
name
const char * name
Definition: IWORKToken.cpp:43
IWORKPropertyMap.h
libetonyek::IWORKStyleContext::attribute
void attribute(int name, const char *value) override
Definition: IWORKStyleContext.cpp:48
libetonyek::IWORKXMLContextBase
Definition: IWORKXMLContextBase.h:27
libetonyek::IWORKXMLParserState
Definition: IWORKXMLParserState.h:31
libetonyek::IWORKStyleContext::m_parentIdent
boost::optional< std::string > m_parentIdent
Definition: IWORKStyleContext.h:54
libetonyek::IWORKStyleContext::m_ownProps
IWORKPropertyMap m_ownProps
Definition: IWORKStyleContext.h:49
libetonyek::IWORKStyleContext::m_style
IWORKStylePtr_t m_style
the final style
Definition: IWORKStyleContext.h:52
libetonyek::IWORKToken::string
Definition: IWORKToken.h:411
libetonyek::IWORKStyleMap_t
std::unordered_map< ID_t, IWORKStylePtr_t > IWORKStyleMap_t
Definition: IWORKStyle_fwd.h:24