nsnake
Classic snake game for the terminal
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Game
BoardParser.hpp
1
#ifndef BOARDPARSER_H_DEFINED
2
#define BOARDPARSER_H_DEFINED
3
4
#include <Game/Board.hpp>
5
6
#include <exception>
7
#include <string>
8
12
class
BoardParserException :
public
std::exception
13
{
14
public
:
15
BoardParserException(std::string message):
16
message(message)
17
{ }
18
~BoardParserException()
throw
()
19
{ }
20
21
std::string message;
22
};
23
24
#define COMMENT_CHAR ';'
25
#define WALL_CHAR '#'
26
#define SNAKE_CHAR '@'
27
31
class
BoardParser
32
{
33
public
:
38
static
std::string
directory
;
39
47
static
std::string
extension
;
48
56
static
Board
*
load
(std::string filename);
57
63
static
Board
*
loadFile
(std::string filename);
64
66
static
bool
save
(
Board
* board, std::string filename);
67
73
static
std::vector<std::string>
listLevels
();
74
};
75
76
#endif
//BOARDPARSER_H_DEFINED
77
BoardParser
Opens, loads and parses a level file, returning a well-formed Board.
Definition
BoardParser.hpp:32
BoardParser::loadFile
static Board * loadFile(std::string filename)
Loads and parses the level at filename.
Definition
BoardParser.cpp:28
BoardParser::directory
static std::string directory
Default directory where the level files are.
Definition
BoardParser.hpp:38
BoardParser::listLevels
static std::vector< std::string > listLevels()
Lists all levels found by the game.
Definition
BoardParser.cpp:170
BoardParser::load
static Board * load(std::string filename)
Loads and parses level with name.
Definition
BoardParser.cpp:18
BoardParser::save
static bool save(Board *board, std::string filename)
TODO.
BoardParser::extension
static std::string extension
Default extension for nSnake level files.
Definition
BoardParser.hpp:47
Board
A level where the snake runs and eats fruits.
Definition
Board.hpp:33
Generated on
for nsnake by
1.17.0