#pragma once
#include "ExceptionOr.h"
#include "SVGPropertyTraits.h"
namespace WebCore {
class SVGAngleValue {
WTF_MAKE_FAST_ALLOCATED;
public:
enum Type {
SVG_ANGLETYPE_UNKNOWN = 0,
SVG_ANGLETYPE_UNSPECIFIED = 1,
SVG_ANGLETYPE_DEG = 2,
SVG_ANGLETYPE_RAD = 3,
SVG_ANGLETYPE_GRAD = 4
};
Type unitType() const { return m_unitType; }
void setValue(float);
float value() const;
void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { m_valueInSpecifiedUnits = valueInSpecifiedUnits; }
float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
ExceptionOr<void> setValueAsString(const String&);
String valueAsString() const;
ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
ExceptionOr<void> convertToSpecifiedUnits(unsigned short unitType);
private:
Type m_unitType { SVG_ANGLETYPE_UNSPECIFIED };
float m_valueInSpecifiedUnits { 0 };
};
template<> struct SVGPropertyTraits<SVGAngleValue> {
static SVGAngleValue initialValue() { return SVGAngleValue(); }
static String toString(const SVGAngleValue& type) { return type.valueAsString(); }
};
}