kanjivg-tools/Libraries/Kanimaji/Source/SVG.hpp

50 lines
1,001 B
C++

#ifndef KANIMAJI_SVG_HPP
#define KANIMAJI_SVG_HPP
#include <memory>
#include <stdexcept>
#include <string_view>
#include <vector>
namespace Kanimaji::SVG
{
class Error : public std::runtime_error
{
using std::runtime_error::runtime_error;
};
class ParseError : public Error
{
public:
ParseError(std::size_t current, std::string_view message);
std::size_t Position() const
{
return mPosition;
}
private:
std::size_t mPosition;
};
class Path
{
public:
class Element;
public:
Path(std::string_view definition);
Path(const Path&) = delete;
Path& operator=(const Path&) = delete;
Path(Path&&) = default;
Path& operator=(Path&&) = default;
~Path();
double Length() const;
void Serialize(std::string& out) const;
private:
std::vector<std::unique_ptr<Element>> mSegments;
};
}
#endif // KANIMAJI_SVG_HPP