/src/libetonyek/src/lib/contexts/IWORKImageContext.cpp
Line | Count | Source |
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 | | #include "IWORKImageContext.h" |
11 | | |
12 | | #include <memory> |
13 | | |
14 | | #include "IWORKDataElement.h" |
15 | | #include "IWORKSizeElement.h" |
16 | | #include "IWORKToken.h" |
17 | | #include "IWORKXMLParserState.h" |
18 | | |
19 | | namespace libetonyek |
20 | | { |
21 | | |
22 | | IWORKImageContext::IWORKImageContext(IWORKXMLParserState &state, IWORKMediaContentPtr_t &content) |
23 | 0 | : IWORKXMLElementContextBase(state) |
24 | 0 | , m_content(content) |
25 | 0 | , m_size() |
26 | 0 | , m_data() |
27 | 0 | , m_fillColor() |
28 | 0 | { |
29 | 0 | } |
30 | | |
31 | | IWORKXMLContextPtr_t IWORKImageContext::element(const int name) |
32 | 0 | { |
33 | 0 | switch (name) |
34 | 0 | { |
35 | 0 | case IWORKToken::NS_URI_SF | IWORKToken::data : |
36 | 0 | return std::make_shared<IWORKDataElement>(getState(), m_data, m_fillColor); |
37 | 0 | case IWORKToken::NS_URI_SF | IWORKToken::size : |
38 | 0 | return std::make_shared<IWORKSizeElement>(getState(), m_size); |
39 | 0 | default: |
40 | 0 | ETONYEK_DEBUG_MSG(("IWORKImageContext::element: find unknown element\n")); |
41 | 0 | break; |
42 | 0 | } |
43 | | |
44 | 0 | return IWORKXMLContextPtr_t(); |
45 | 0 | } |
46 | | |
47 | | void IWORKImageContext::endOfElement() |
48 | 0 | { |
49 | 0 | m_content = std::make_shared<IWORKMediaContent>(); |
50 | 0 | m_content->m_size = m_size; |
51 | 0 | m_content->m_data = m_data; |
52 | 0 | m_content->m_fillColor = m_fillColor; |
53 | 0 | } |
54 | | |
55 | | } |
56 | | |
57 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |