DoorKeeper/include/doorkeeper/helpers/asciimapsource.hpp

51 lines
1.5 KiB
C++
Raw Normal View History

#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<implem::AsciiMapTileType, 2> {
public:
2014-12-29 15:14:36 +00:00
typedef dk::Vector<dk::CoordinateScalarType, 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 );
AsciiMapSource ( const std::string& parFilename, const coords& parSize, dk::MapTypes parMapType );
AsciiMapSource ( std::istream& parData, const coords& parSize, dk::MapTypes parMapType );
virtual ~AsciiMapSource ( void ) noexcept = default;
virtual const coords& mapSize ( void ) const;
virtual void fetch ( std::vector<MapTileType>& parOut, const coords& parFrom, const coords& parTo );
virtual dk::MapTypes mapType ( void ) const;
virtual int layersCount ( void ) const;
private:
enum {
DataSize = sizeof(MapTileType)
};
void parse_map_data ( std::istream& parSrc );
std::vector<MapTileType> m_wholedata;
const coords m_mapSize;
std::size_t m_bytepos;
const dk::MapTypes m_mapType;
};
2014-12-29 15:14:36 +00:00
} //namespace dkh
#endif