1 | /* |
2 | * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 | * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public License |
16 | * along with this library; see the file COPYING.LIB. If not, write to |
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #include "SVGPathSource.h" |
24 | #include <wtf/text/WTFString.h> |
25 | |
26 | namespace WebCore { |
27 | |
28 | class SVGPathStringSource final : public SVGPathSource { |
29 | public: |
30 | explicit SVGPathStringSource(const String&); |
31 | |
32 | private: |
33 | bool hasMoreData() const final; |
34 | bool moveToNextToken() final; |
35 | bool parseSVGSegmentType(SVGPathSegType&) final; |
36 | SVGPathSegType nextCommand(SVGPathSegType previousCommand) final; |
37 | |
38 | bool parseMoveToSegment(FloatPoint&) final; |
39 | bool parseLineToSegment(FloatPoint&) final; |
40 | bool parseLineToHorizontalSegment(float&) final; |
41 | bool parseLineToVerticalSegment(float&) final; |
42 | bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) final; |
43 | bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) final; |
44 | bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) final; |
45 | bool parseCurveToQuadraticSmoothSegment(FloatPoint&) final; |
46 | bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&) final; |
47 | |
48 | String m_string; |
49 | bool m_is8BitSource; |
50 | |
51 | union { |
52 | const LChar* m_character8; |
53 | const UChar* m_character16; |
54 | } m_current; |
55 | union { |
56 | const LChar* m_character8; |
57 | const UChar* m_character16; |
58 | } m_end; |
59 | }; |
60 | |
61 | } // namespace WebCore |
62 | |