/* Copyright 2015, Michele Santullo * This file is part of DoorKeeper. * * DoorKeeper is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * DoorKeeper is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with DoorKeeper. If not, see . */ #ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B #define id263B7DAF9A1C40BB8517D5D328DF8A1B #include "doorkeeper/primitivetypes.hpp" #include "doorkeeper/implem/vector.hpp" #include "doorkeeper/components/basemapsource.hpp" #include "doorkeeper/components/pixelconv.hpp" #include #include namespace dkh { namespace implem { typedef int AsciiMapTileType; } //namespace implem class AsciiMapSource : public dk::BaseMapSource<2> { public: typedef dk::Vector<2> coords; typedef implem::AsciiMapTileType MapTileType; enum { MapDimensions = 2 }; AsciiMapSource ( void ) = delete; AsciiMapSource ( const AsciiMapSource& ) = delete; AsciiMapSource ( AsciiMapSource&& parOther ) = default; AsciiMapSource ( const char* parFilename, dk::MapTypes parMapType, const coords& parTileSize ); AsciiMapSource ( const std::string& parFilename, dk::MapTypes parMapType, const coords& parTileSize ); AsciiMapSource ( std::istream& parData, dk::MapTypes parMapType, const coords& parTileSize ); virtual ~AsciiMapSource ( void ) noexcept = default; virtual const coords& mapSize ( void ) const; virtual dk::MapTypes mapType ( void ) const; virtual int layersCount ( void ) const; virtual const coords& tileSize ( void ) const; virtual void chainedMaps ( std::vector& parOut ) const; virtual dk::HashType layerTypeHash ( int parIndex ) const; virtual const dk::PixelConv<2>& pixel_conv ( void ) const; private: void parse_map_data ( std::istream& parSrc ); virtual void fetch_raw ( char* parOut, const coords& parFrom, const coords& parTo, std::size_t parSize ); std::vector m_wholedata; coords m_mapSize; const dk::PixelConvSquare<2> m_pixel_conv; const dk::MapTypes m_mapType; }; } //namespace dkh #endif