DoorKeeper/include/helpers/asciimapsource.hpp

41 lines
1.1 KiB
C++
Raw Normal View History

#ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B
#define id263B7DAF9A1C40BB8517D5D328DF8A1B
2014-12-29 16:14:36 +01:00
#include "primitivetypes.hpp"
#include "implem/vector.hpp"
#include <streambuf>
#include <vector>
2014-12-29 16:14:36 +01:00
#include <boost/iostreams/categories.hpp> // source_tag
namespace dkh {
2014-12-29 16:14:36 +01:00
class AsciiMapSource : public std::streambuf {
public:
2014-12-29 16:14:36 +01:00
typedef dk::Vector<dk::CoordinateScalarType, 2> coords;
typedef int MapTileType;
2014-12-29 16:14:36 +01:00
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;
2014-12-29 16:14:36 +01:00
const coords& mapSize ( void ) const noexcept { return m_mapSize; }
private:
void parse_map_data ( std::istream& parSrc );
std::vector<MapTileType> m_wholedata;
2014-12-29 16:14:36 +01:00
coords m_mapSize;
};
2014-12-29 16:14:36 +01:00
} //namespace dkh
#endif