Hi @ll,
I need to parse an Inkscape SVG file with which is basically made of
several <g> nodes (layers) each containing lots of shapes (mostly rects but not only).
Therefore I've created 3 context classes:
1. class BaseContext
2. class ShapeContext : public BaseContext
3. class RectContext : public ShapeContext (<- is this still correct or do I have to derive from BaseContext?)
Additionally I've created factories for these three:
struct ChildContextFactories {
template<class ParentContext, class ElementTag, class Enable = void>
struct apply {
// Default definition handles "svg" and "g" elements
typedef svgpp::factory::context::on_stack<BaseContext> type; };
};
template<class ElementTag>
struct ChildContextFactories::apply<
BaseContext, ElementTag,
typename boost::enable_if<boost::mpl::has_key<svgpp::traits::shape_elements, ElementTag> >::type> {
typedef svgpp::factory::context::on_stack<ShapeContext> type;
};
template<>
struct ChildContextFactories::apply<BaseContext, svgpp::tag::element::rect> {
typedef svgpp::factory::context::on_stack<RectContext> type;
};
As the Inkscape file is using nonstandard attributes I need access to the XML-Element and decided to switch over to use
"on_stack_with_xml_element".
However I fail to get it compiled and kindly ask if someone can shed some light on this? That means how do I have to formulate
my classes correctly to get the XML_element passed too?
I tried to understand demo/Sample in "../svgpp/sample_animation.cpp" but I get confused because here the factories
are mixing "same" and "on_stack_with_xml_element"?! Is this a bug?
Thanks,
Frank