namespace dk { template TileStreamer::TileStreamer (StreamPtr&& parStream) : m_stream(std::move(parStream)) { //TODO: this loader /only/ works with 2D tilesets, remove it asap typedef std::istream_iterator DataIterator; typedef boost::spirit::multi_pass WrappedIterator; *m_stream >> std::noskipws; auto first = WrappedIterator(DataIterator(*m_stream)); auto last = WrappedIterator(DataIterator()); implem::AsciiMapGrammar grammar(first); const bool p = boost::spirit::qi::parse( first, last, grammar, m_wholedata ); if (not p or last != first) { throw std::runtime_error("Invalid data: can't parse file"); } //Only look at the front. Besides a bug in spirit makes the other counts //invalid, see //http://boost.2283326.n4.nabble.com/Possible-bug-in-line-pos-iterator-td4636592.html m_count.x() = grammar.lengths.front(); m_count.y() = m_wholedata.size() / m_count.x(); } template void TileStreamer::copy (std::vector& parDest, const coords& /*parFrom*/, const coords& /*parTo*/) { parDest.clear(); parDest.reserve(m_wholedata.size()); std::copy(m_wholedata.begin(), m_wholedata.end(), std::back_inserter(parDest)); } } //namespace dk