1/*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * Copyright (C) 2015 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 "SVGPathConsumer.h"
24#include <wtf/text/StringBuilder.h>
25
26namespace WebCore {
27
28class SVGPathStringBuilder final : public SVGPathConsumer {
29public:
30 WEBCORE_EXPORT SVGPathStringBuilder();
31 WEBCORE_EXPORT virtual ~SVGPathStringBuilder();
32
33 WEBCORE_EXPORT String result();
34
35 void incrementPathSegmentCount() final;
36 bool continueConsuming() final;
37
38 // Used in UnalteredParsing/NormalizedParsing modes.
39 WEBCORE_EXPORT void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) final;
40 WEBCORE_EXPORT void lineTo(const FloatPoint&, PathCoordinateMode) final;
41 WEBCORE_EXPORT void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode) final;
42 WEBCORE_EXPORT void closePath() final;
43
44 // Only used in UnalteredParsing mode.
45 void lineToHorizontal(float, PathCoordinateMode) final;
46 void lineToVertical(float, PathCoordinateMode) final;
47 void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) final;
48 WEBCORE_EXPORT void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) final;
49 void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) final;
50 void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode) final;
51
52private:
53 StringBuilder m_stringBuilder;
54};
55
56} // namespace WebCore
57