#ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B #define id263B7DAF9A1C40BB8517D5D328DF8A1B #include "primitivetypes.hpp" #include "implem/vector.hpp" #include #include #include // source_tag namespace dkh { class AsciiMapSource : public std::streambuf { public: typedef dk::Vector coords; typedef int MapTileType; typedef boost::iostreams::source_tag category; enum { MapDimensions = 2 }; AsciiMapSource ( void ) = delete; AsciiMapSource ( const AsciiMapSource& ) = delete; AsciiMapSource ( AsciiMapSource&& parOther ) = default; explicit AsciiMapSource ( const char* parFilename ); explicit AsciiMapSource ( const std::string& parFilename ); explicit AsciiMapSource ( std::istream& parData ); template AsciiMapSource ( I parDataFrom, I parDataTo ); ~AsciiMapSource ( void ) noexcept = default; const coords& mapSize ( void ) const noexcept { return m_mapSize; } protected: virtual int_type underflow ( void ); virtual int_type uflow ( void ); virtual int_type pbackfail ( int_type parCh ); virtual std::streamsize showmanyc ( void ); virtual pos_type seekoff ( off_type parOff, std::ios_base::seekdir parDir, std::ios_base::openmode parWhich ); virtual pos_type seekpos( pos_type parPos, std::ios_base::openmode parWhich ); private: enum { DataSize = sizeof(MapTileType) }; void parse_map_data ( std::istream& parSrc ); std::vector m_wholedata; coords m_mapSize; std::size_t m_bytepos; }; } //namespace dkh #endif