40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B
|
|
#define id263B7DAF9A1C40BB8517D5D328DF8A1B
|
|
|
|
#include "primitivetypes.hpp"
|
|
#include "implem/vector.hpp"
|
|
#include <streambuf>
|
|
#include <vector>
|
|
#include <boost/iostreams/categories.hpp> // source_tag
|
|
|
|
namespace dkh {
|
|
class AsciiMapSource : public std::streambuf {
|
|
public:
|
|
typedef dk::Vector<dk::CoordinateScalarType, 2> coords;
|
|
typedef int MapTileType;
|
|
typedef boost::iostreams::source_tag category;
|
|
enum {
|
|
MapDimensions = 2
|
|
};
|
|
|
|
AsciiMapSource ( void ) = delete;
|
|
AsciiMapSource ( const AsciiMapSource& ) = default;
|
|
AsciiMapSource ( AsciiMapSource&& parOther ) = delete;
|
|
explicit AsciiMapSource ( const char* parFilename );
|
|
explicit AsciiMapSource ( const std::string& parFilename );
|
|
explicit AsciiMapSource ( std::istream& parData );
|
|
template <typename I>
|
|
AsciiMapSource ( I parDataFrom, I parDataTo );
|
|
~AsciiMapSource ( void ) noexcept = default;
|
|
|
|
const coords& mapSize ( void ) const noexcept { return m_mapSize; }
|
|
|
|
private:
|
|
void parse_map_data ( std::istream& parSrc );
|
|
|
|
std::vector<MapTileType> m_wholedata;
|
|
coords m_mapSize;
|
|
};
|
|
} //namespace dkh
|
|
|
|
#endif
|