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#ifndef SVGPathStringSource_h
22#define SVGPathStringSource_h
23
24#include "SVGPathSource.h"
25#include <wtf/text/WTFString.h>
26
27namespace WebCore {
28
29class SVGPathStringSource : public SVGPathSource {
30public:
31    explicit SVGPathStringSource(const String&);
32
33private:
34    virtual bool hasMoreData() const override;
35    virtual bool moveToNextToken() override;
36    virtual bool parseSVGSegmentType(SVGPathSegType&) override;
37    virtual SVGPathSegType nextCommand(SVGPathSegType previousCommand) override;
38
39    virtual bool parseMoveToSegment(FloatPoint&) override;
40    virtual bool parseLineToSegment(FloatPoint&) override;
41    virtual bool parseLineToHorizontalSegment(float&) override;
42    virtual bool parseLineToVerticalSegment(float&) override;
43    virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) override;
44    virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) override;
45    virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) override;
46    virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&) override;
47    virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&) override;
48
49    String m_string;
50    bool m_is8BitSource;
51
52    union {
53        const LChar* m_character8;
54        const UChar* m_character16;
55    } m_current;
56    union {
57        const LChar* m_character8;
58        const UChar* m_character16;
59    } m_end;
60};
61
62} // namespace WebCore
63
64#endif // SVGPathStringSource_h
65