#include "Shape.h" using std::string; using std::set; ShapeConverter& ShapeConverter::get() { static ShapeConverter converter; return converter; } set ShapeConverter::getBasicShapes() { static const set result = [] { set result; for (int i = 0; i <= static_cast(Shape::LastBasicShape); ++i) { result.insert(static_cast(i)); } return result; }(); return result; } set ShapeConverter::getExtendedShapes() { static const set result = [] { set result; for (int i = static_cast(Shape::LastBasicShape) + 1; i < static_cast(Shape::EndSentinel); ++i) { result.insert(static_cast(i)); } return result; }(); return result; } string ShapeConverter::getTypeName() { return "Shape"; } EnumConverter::member_data ShapeConverter::getMemberData() { return member_data{ { Shape::A, "A" }, { Shape::B, "B" }, { Shape::C, "C" }, { Shape::D, "D" }, { Shape::E, "E" }, { Shape::F, "F" }, { Shape::G, "G" }, { Shape::H, "H" }, { Shape::X, "X" } }; } std::ostream& operator<<(std::ostream& stream, Shape value) { return ShapeConverter::get().write(stream, value); } std::istream& operator>>(std::istream& stream, Shape& value) { return ShapeConverter::get().read(stream, value); }