Realize template functions so that we can actually link.

This commit is contained in:
Daniel Patterson 2015-06-17 17:16:59 -07:00
parent fb289417e5
commit 51a50fdf92

View file

@ -57,7 +57,6 @@
namespace mapnik { namespace svg { namespace mapnik { namespace svg {
bool parse_reader(svg_parser & parser,xmlTextReaderPtr reader);
void process_node(svg_parser & parser,xmlTextReaderPtr reader); void process_node(svg_parser & parser,xmlTextReaderPtr reader);
void start_element(svg_parser & parser,xmlTextReaderPtr reader); void start_element(svg_parser & parser,xmlTextReaderPtr reader);
void end_element(svg_parser & parser,xmlTextReaderPtr reader); void end_element(svg_parser & parser,xmlTextReaderPtr reader);
@ -1093,13 +1092,13 @@ void svg_parser::parse_from_string(std::string const& svg)
} }
template <typename T> template <typename T>
int xmlInputReadCallback(boost::iostreams::stream<T> * stream, char * buffer, int len) { int _xmlInputReadCallback(boost::iostreams::stream<T> * stream, char * buffer, int len) {
stream->read(buffer,len); stream->read(buffer,len);
return stream->gcount(); return stream->gcount();
} }
template <typename T> template <typename T>
int xmlInputCloseCallback(boost::iostreams::stream<T> * stream) int _xmlInputCloseCallback(boost::iostreams::stream<T> * stream)
{ {
if(stream->close()) if(stream->close())
{ {
@ -1111,9 +1110,9 @@ int xmlInputCloseCallback(boost::iostreams::stream<T> * stream)
template <typename T> template <typename T>
void svg_parser::parse_from_stream(boost::iostreams::stream<T> const& svg_stream) void svg_parser::parse_from_stream(boost::iostreams::stream<T> const& svg_stream)
{ {
xmlTextReaderPtr reader = xmlReaderForIO(xmlInputReadCallback<T>, xmlTextReaderPtr reader = xmlReaderForIO(_xmlInputReadCallback<T>,
xmlInputCloseCallback<T> _xmlInputCloseCallback<T>,
&svg_stream, reinterpret_cast<const void *>(&svg_stream),
nullptr, nullptr,
nullptr, nullptr,
(XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING)); (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING));
@ -1127,5 +1126,9 @@ void svg_parser::parse_from_stream(boost::iostreams::stream<T> const& svg_stream
} }
} }
template void svg_parser::parse_from_stream(boost::iostreams::stream<boost::iostreams::file_source> const& svg_stream);
template void svg_parser::parse_from_stream(boost::iostreams::stream<boost::iostreams::array_source> const& svg_stream);
}} }}