IWORKMutableArrayElement.h Source File documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

IWORKMutableArrayElement.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 IWORKMUTABLEARRAYELEMENT_H_INCLUDED
11 #define IWORKMUTABLEARRAYELEMENT_H_INCLUDED
12
13 #include "IWORKContainerContext.h"
14
15 namespace libetonyek
16 {
17
18 template<typename Type, class NestedParser, template<typename T, class C> class Collector, unsigned Id, unsigned RefId = 0>
19 class IWORKMutableArrayElement : public IWORKContainerContext<Type, NestedParser, Collector, Id, RefId>
20 {
21 typedef IWORKContainerContext<Type, NestedParser, Collector, Id, RefId> Super_t;
22 typedef boost::unordered_map<ID_t, Type> ContextDict_t;
23 typedef boost::unordered_map<ID_t, std::deque<Type> > ArrayDict_t;
24
25 public:
26 IWORKMutableArrayElement(IWORKXMLParserState &state, ArrayDict_t &arrayDict, std::deque<Type> &elements)
27 : Super_t(state, elements)
28 , m_arrayDict(arrayDict)
29 , m_elements(elements)
30 {
31 }
32
33 IWORKMutableArrayElement(IWORKXMLParserState &state, ArrayDict_t &arrayDict, ContextDict_t &dict, std::deque<Type> &elements)
34 : Super_t(state, dict, elements)
35 , m_arrayDict(arrayDict)
36 , m_elements(elements)
37 {
38 }
39
40 private:
41 virtual IWORKXMLContextPtr_t element(const int name)
42 {
43 return Super_t::element(name);
44 }
45
46 virtual void endOfElement()
47 {
48 Super_t::endOfElement();
49 if (this->getId())
50 m_arrayDict[get(this->getId())] = m_elements;
51 }
52
53 private:
54 ArrayDict_t &m_arrayDict;
55 std::deque<Type> &m_elements;
56 };
57
58 }
59
60 #endif // IWORKMUTABLEARRAYELEMENT_H_INCLUDED
61
62 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek
Definition: IWORKBezierElement.cpp:18
libetonyek::KEY1Token::dict
Definition: KEY1Token.h:49
libetonyek::IWORKContainerContext::element
virtual IWORKXMLContextPtr_t element(const int name)
Definition: IWORKContainerContext.h:48
libetonyek::IWORKMutableArrayElement::ContextDict_t
boost::unordered_map< ID_t, Type > ContextDict_t
Definition: IWORKMutableArrayElement.h:22
libetonyek::IWORKMutableArrayElement
Definition: IWORKMutableArrayElement.h:19
libetonyek::IWORKMutableArrayElement::Super_t
IWORKContainerContext< Type, NestedParser, Collector, Id, RefId > Super_t
Definition: IWORKMutableArrayElement.h:21
libetonyek::IWORKXMLContextPtr_t
boost::shared_ptr< IWORKXMLContext > IWORKXMLContextPtr_t
Definition: IWORKXMLContext.h:18
name
const char * name
Definition: IWORKToken.cpp:43
libetonyek::IWORKMutableArrayElement::IWORKMutableArrayElement
IWORKMutableArrayElement(IWORKXMLParserState &state, ArrayDict_t &arrayDict, std::deque< Type > &elements)
Definition: IWORKMutableArrayElement.h:26
libetonyek::IWORKMutableArrayElement::endOfElement
virtual void endOfElement()
Definition: IWORKMutableArrayElement.h:46
libetonyek::IWORKContainerContext
Definition: IWORKContainerContext.h:26
libetonyek::IWORKContainerContext::endOfElement
virtual void endOfElement()
Definition: IWORKContainerContext.h:62
libetonyek::IWORKXMLParserState
Definition: IWORKXMLParserState.h:30
libetonyek::IWORKMutableArrayElement::element
virtual IWORKXMLContextPtr_t element(const int name)
Definition: IWORKMutableArrayElement.h:41
libetonyek::IWORKMutableArrayElement::m_elements
std::deque< Type > & m_elements
Definition: IWORKMutableArrayElement.h:55
libetonyek::IWORKMutableArrayElement::ArrayDict_t
boost::unordered_map< ID_t, std::deque< Type > > ArrayDict_t
Definition: IWORKMutableArrayElement.h:23
IWORKContainerContext.h
libetonyek::IWORKMutableArrayElement::m_arrayDict
ArrayDict_t & m_arrayDict
Definition: IWORKMutableArrayElement.h:54
libetonyek::IWORKMutableArrayElement::IWORKMutableArrayElement
IWORKMutableArrayElement(IWORKXMLParserState &state, ArrayDict_t &arrayDict, ContextDict_t &dict, std::deque< Type > &elements)
Definition: IWORKMutableArrayElement.h:33