/src/libetonyek/src/lib/contexts/IWORKBezierElement.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 "IWORKBezierElement.h" |
11 | | |
12 | | #include <memory> |
13 | | |
14 | | #include "IWORKCollector.h" |
15 | | #include "IWORKDictionary.h" |
16 | | #include "IWORKPath.h" |
17 | | #include "IWORKToken.h" |
18 | | #include "IWORKXMLParserState.h" |
19 | | |
20 | | namespace libetonyek |
21 | | { |
22 | | |
23 | | IWORKBezierElement::IWORKBezierElement(IWORKXMLParserState &state, IWORKPathPtr_t &path) |
24 | 0 | : IWORKXMLEmptyContextBase(state) |
25 | 0 | , m_path(path) |
26 | 0 | { |
27 | 0 | } |
28 | | |
29 | | void IWORKBezierElement::attribute(const int name, const char *const value) |
30 | 0 | { |
31 | 0 | switch (name) |
32 | 0 | { |
33 | 0 | case +IWORKToken::NS_URI_SFA | IWORKToken::path : |
34 | 0 | try |
35 | 0 | { |
36 | 0 | m_path = std::make_shared<IWORKPath>(value); |
37 | 0 | } |
38 | 0 | catch (const IWORKPath::InvalidException &) |
39 | 0 | { |
40 | 0 | ETONYEK_DEBUG_MSG(("IWORKBezierElement::attribute: '%s' is not a valid path\n", value)); |
41 | 0 | } |
42 | 0 | break; |
43 | 0 | default : |
44 | 0 | IWORKXMLEmptyContextBase::attribute(name, value); |
45 | 0 | break; |
46 | 0 | } |
47 | 0 | } |
48 | | |
49 | | void IWORKBezierElement::endOfElement() |
50 | 0 | { |
51 | 0 | if (getId()) |
52 | 0 | getState().getDictionary().m_beziers[get(getId())] = m_path; |
53 | 0 | } |
54 | | |
55 | | } |
56 | | |
57 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |