#pragma once
#include "SVGPathConsumer.h"
#include "SVGPathSeg.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
class SVGPathByteStream;
class SVGPathSource;
class SVGPathParser {
public:
static bool parse(SVGPathSource&, SVGPathConsumer&, PathParsingMode = NormalizedParsing, bool checkForInitialMoveTo = true);
static bool parseToByteStream(SVGPathSource&, SVGPathByteStream&, PathParsingMode = NormalizedParsing, bool checkForInitialMoveTo = true);
static bool parseToString(SVGPathSource&, String& result, PathParsingMode = NormalizedParsing, bool checkForInitialMoveTo = true);
private:
SVGPathParser(SVGPathConsumer&, SVGPathSource&, PathParsingMode);
bool parsePathData(bool checkForInitialMoveTo);
bool decomposeArcToCubic(float angle, float rx, float ry, FloatPoint&, FloatPoint&, bool largeArcFlag, bool sweepFlag);
void parseClosePathSegment();
bool parseMoveToSegment();
bool parseLineToSegment();
bool parseLineToHorizontalSegment();
bool parseLineToVerticalSegment();
bool parseCurveToCubicSegment();
bool parseCurveToCubicSmoothSegment();
bool parseCurveToQuadraticSegment();
bool parseCurveToQuadraticSmoothSegment();
bool parseArcToSegment();
SVGPathSource& m_source;
SVGPathConsumer& m_consumer;
FloatPoint m_controlPoint;
FloatPoint m_currentPoint;
FloatPoint m_subPathPoint;
PathCoordinateMode m_mode { AbsoluteCoordinates };
const PathParsingMode m_pathParsingMode { NormalizedParsing };
SVGPathSegType m_lastCommand { PathSegUnknown };
bool m_closePath { true };
};
}