libtcod
Loading...
Searching...
No Matches
TCODParser Class Reference

Public Member Functions

 TCODParser ()
 Use this function to create a generic parser.
 
 TCODParser (const TCODParser &)=delete
 
TCODParseroperator= (const TCODParser &)=delete
 
 TCODParser (TCODParser &&rhs) noexcept
 
TCODParseroperator= (TCODParser &&rhs) noexcept
 
TCODParserStructnewStructure (const char *name)
 
TCOD_value_type_t newCustomType (TCOD_parser_custom_t custom_type_parser)
 
void run (const char *filename, ITCODParserListener *listener=NULL)
 Once you defined all the structure types and created your listener, you can start the actual parsing of the file :
 
 ~TCODParser ()
 Once you've done with the file parsing, you can release the resources used by the parser :
 
void error (const char *msg,...)
 
bool hasProperty (const char *name) const
 
bool getBoolProperty (const char *name) const
 
int getIntProperty (const char *name) const
 
int getCharProperty (const char *name) const
 
float getFloatProperty (const char *name) const
 
TCODColor getColorProperty (const char *name) const
 
TCOD_dice_t getDiceProperty (const char *name) const
 
const char * getStringProperty (const char *name) const
 
void * getCustomProperty (const char *name) const
 
TCOD_list_t getListProperty (const char *name, TCOD_value_type_t type) const
 

Friends

bool new_struct (TCOD_parser_struct_t def, const char *name) noexcept
 
bool end_struct (TCOD_parser_struct_t def, const char *name) noexcept
 

Constructor & Destructor Documentation

◆ TCODParser()

TCODParser::TCODParser ( )

Use this function to create a generic parser.

Then you'll specialize this parser by defining the structures it can read.

◆ ~TCODParser()

TCODParser::~TCODParser ( )

Once you've done with the file parsing, you can release the resources used by the parser :

Parameters
parserIn the C version, the parser handler, returned by TCOD_parser_new.

Member Function Documentation

◆ newStructure()

TCODParserStruct * TCODParser::newStructure ( const char * name)
Parameters
parserIn the C version, the parser handler, returned by TCOD_parser_new.
nameThe name of the structure type (in the example, this would be "item_type").

TCODParser parser(); TCODParserStruct *itemTypeStruct = parser.newStructure("item_type");

TCOD_parser_t parser = TCOD_parser_new(); TCOD_parser_struct_t item_type_struct = TCOD_parser_new_struct(parser, "item_type");

parser=libtcod.parser_new() item_type_struct = libtcod.parser_new_struct(parser, "item_type")

◆ run()

void TCODParser::run ( const char * filename,
ITCODParserListener * listener = NULL )

Once you defined all the structure types and created your listener, you can start the actual parsing of the file :

Parameters
parserIn the C version, the parser handler, returned by TCOD_parser_new.
filenameThe name of the text file to parse, absolute or relative to current directory.
listenerThe listener containing the callbacks. Use NULL for the default listener

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