Bomberman
Classes | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
BBM::ParserYAML Class Reference

#include <ParserYaml.hpp>

Collaboration diagram for BBM::ParserYAML:

Classes

struct  PlayerInfos
 

Static Public Member Functions

static Node parseFile (const std::string &path)
 
static void save (std::shared_ptr< WAL::Scene > scene)
 save yaml More...
 
static void load (std::shared_ptr< WAL::Scene > scene)
 load yaml More...
 

Static Public Attributes

static std::vector< PlayerInfosplayersInfos = {}
 
static const std::string fileName = "save"
 save file name More...
 

Static Private Member Functions

static void _saveBlock (const WAL::Entity &entity)
 save block in _block More...
 
static void _saveBonus (const WAL::Entity &entity)
 save bonus in _bonus More...
 
static void _savePlayer (const WAL::Entity &entity)
 save player in _player More...
 
static std::string _getBlockType (const std::string &blockName)
 transform block name More...
 
static std::string _getBonusType (const std::string &bonusName)
 transform bonus name More...
 
static int _parseMaxBomb (const std::string &str)
 return max bomb parsed More...
 
static int _parseExplosionRadius (const std::string &line)
 return explosion radius parsed More...
 
static float _parseSpeed (const std::string &line)
 return speed parsed More...
 
static Vector3f _parsePosition (const std::string &line)
 return vector3f of position parsed More...
 
static MapGenerator::BlockType _parseBlockType (const std::string &blockType)
 return BlockType of type parsed More...
 
static Bonus::BonusType _parseBonusType (const std::string &bonusType)
 return bonusType of type parsed More...
 
static void _loadPlayer (std::shared_ptr< WAL::Scene > scene, Node &node, int countPlayer)
 add player into scene More...
 
static void _loadBlock (std::shared_ptr< WAL::Scene > scene, Node child, MapGenerator::MapBlock &map)
 add block into scene More...
 
static void _loadBonus (std::shared_ptr< WAL::Scene > scene, Node &node)
 add bonus into scene More...
 
static void _loadPlayers (std::shared_ptr< WAL::Scene > scene, Node &node)
 load all players into scene More...
 
static void _loadBlocks (std::shared_ptr< WAL::Scene > scene, Node &node)
 load all blocks into scene More...
 
static void _loadBonuses (std::shared_ptr< WAL::Scene > scene, Node &node)
 load all blocks into scene More...
 
static std::string parseHeader (const std::string &line)
 
static std::pair< std::string,std::string > parseProperty (const std::string &line)
 
static bool isHeader (const std::string &line)
 
static Node parseNode (std::ifstream &file, const std::string &nodeName, int indentLevel=0)
 
static float getIndent (const std::string &line)
 

Static Private Attributes

static std::stringstream _block
 The number of chars for endl. More...
 
static std::stringstream _bonus
 file bonus of the parser More...
 
static std::stringstream _player
 file player of the parser More...
 
static constexpr const char * indent = " "
 

Member Function Documentation

◆ _getBlockType()

std::string BBM::ParserYAML::_getBlockType ( const std::string &  blockName)
staticprivate

transform block name

Parameters
blockNameblock name

◆ _getBonusType()

std::string BBM::ParserYAML::_getBonusType ( const std::string &  bonusName)
staticprivate

transform bonus name

Parameters
blockNamebonus name

◆ _loadBlock()

void BBM::ParserYAML::_loadBlock ( std::shared_ptr< WAL::Scene scene,
Node  child,
MapGenerator::MapBlock map 
)
staticprivate

add block into scene

Parameters
sceneScene to update
linesLines of the file
indexindex of the vector
mapmap of all the block

◆ _loadBlocks()

void BBM::ParserYAML::_loadBlocks ( std::shared_ptr< WAL::Scene scene,
Node node 
)
staticprivate

load all blocks into scene

Parameters
sceneScene to update

◆ _loadBonus()

void BBM::ParserYAML::_loadBonus ( std::shared_ptr< WAL::Scene scene,
Node node 
)
staticprivate

add bonus into scene

Parameters
sceneScene to update
linesLines of the file
indexindex of the vector

◆ _loadBonuses()

void BBM::ParserYAML::_loadBonuses ( std::shared_ptr< WAL::Scene scene,
Node node 
)
staticprivate

load all blocks into scene

Parameters
sceneScene to update

◆ _loadPlayer()

void BBM::ParserYAML::_loadPlayer ( std::shared_ptr< WAL::Scene scene,
Node node,
int  countPlayer 
)
staticprivate

add player into scene

Parameters
sceneScene to update
linesLines of the file
indexindex of the vector

◆ _loadPlayers()

void BBM::ParserYAML::_loadPlayers ( std::shared_ptr< WAL::Scene scene,
Node node 
)
staticprivate

load all players into scene

Parameters
sceneScene to update

◆ _parseBlockType()

MapGenerator::BlockType BBM::ParserYAML::_parseBlockType ( const std::string &  blockType)
staticprivate

return BlockType of type parsed

Parameters
blockTypeto parse

◆ _parseBonusType()

Bonus::BonusType BBM::ParserYAML::_parseBonusType ( const std::string &  bonusType)
staticprivate

return bonusType of type parsed

Parameters
bonusTypeto parse

◆ _parseExplosionRadius()

int BBM::ParserYAML::_parseExplosionRadius ( const std::string &  line)
staticprivate

return explosion radius parsed

Parameters
lineto parse

◆ _parseMaxBomb()

int BBM::ParserYAML::_parseMaxBomb ( const std::string &  str)
staticprivate

return max bomb parsed

Parameters
strto parse

◆ _parsePosition()

Vector3f BBM::ParserYAML::_parsePosition ( const std::string &  line)
staticprivate

return vector3f of position parsed

Parameters
lineto parse

◆ _parseSpeed()

float BBM::ParserYAML::_parseSpeed ( const std::string &  line)
staticprivate

return speed parsed

Parameters
lineto parse

◆ _saveBlock()

void BBM::ParserYAML::_saveBlock ( const WAL::Entity entity)
staticprivate

save block in _block

Parameters
entityentity to save

◆ _saveBonus()

void BBM::ParserYAML::_saveBonus ( const WAL::Entity entity)
staticprivate

save bonus in _bonus

Parameters
entityentity to save

◆ _savePlayer()

void BBM::ParserYAML::_savePlayer ( const WAL::Entity entity)
staticprivate

save player in _player

Parameters
entityentity to save

◆ getIndent()

float BBM::ParserYAML::getIndent ( const std::string &  line)
staticprivate

◆ isHeader()

bool BBM::ParserYAML::isHeader ( const std::string &  line)
staticprivate

◆ load()

void BBM::ParserYAML::load ( std::shared_ptr< WAL::Scene scene)
static

load yaml

Parameters
sceneScene to update

◆ parseFile()

Node BBM::ParserYAML::parseFile ( const std::string &  path)
static

◆ parseHeader()

std::string BBM::ParserYAML::parseHeader ( const std::string &  line)
staticprivate

◆ parseNode()

Node BBM::ParserYAML::parseNode ( std::ifstream &  file,
const std::string &  nodeName,
int  indentLevel = 0 
)
staticprivate

◆ parseProperty()

std::pair< std::string, std::string > BBM::ParserYAML::parseProperty ( const std::string &  line)
staticprivate

◆ save()

void BBM::ParserYAML::save ( std::shared_ptr< WAL::Scene scene)
static

save yaml

Parameters
sceneScene to update

Member Data Documentation

◆ _block

std::stringstream BBM::ParserYAML::_block
staticprivate

The number of chars for endl.

file block of the parser

◆ _bonus

std::stringstream BBM::ParserYAML::_bonus
staticprivate

file bonus of the parser

◆ _player

std::stringstream BBM::ParserYAML::_player
staticprivate

file player of the parser

◆ fileName

const std::string BBM::ParserYAML::fileName = "save"
static

save file name

◆ indent

constexpr const char* BBM::ParserYAML::indent = " "
staticconstexprprivate

◆ playersInfos

std::vector< ParserYAML::PlayerInfos > BBM::ParserYAML::playersInfos = {}
static

The documentation for this class was generated from the following files: