DoorKeeper/include/doorkeeper/helpers/asciimapsource.hpp

49 lines
1.7 KiB
C++

#ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B
#define id263B7DAF9A1C40BB8517D5D328DF8A1B
#include "doorkeeper/primitivetypes.hpp"
#include "doorkeeper/implem/vector.hpp"
#include "doorkeeper/components/basemapsource.hpp"
#include <vector>
#include <memory>
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, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize );
AsciiMapSource ( const std::string& parFilename, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize );
AsciiMapSource ( std::istream& parData, const coords& parSize, 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<std::string>& parOut ) 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<MapTileType> m_wholedata;
const coords m_mapSize;
const coords m_tileSize;
std::size_t m_bytepos;
const dk::MapTypes m_mapType;
};
} //namespace dkh
#endif