Colobot
Loading...
Searching...
No Matches
CLevelParser Class Reference

Public Member Functions

 CLevelParser ()
 Create an empty level file.
 CLevelParser (std::string filename)
 Load level from file.
 CLevelParser (LevelCategory category, int chapter, int rank)
 Load given level.
 CLevelParser (std::string category, int chapter, int rank)
bool Exists ()
 Check if level file exists.
void Load ()
 Load file.
void Save ()
 Save file.
void SetLevelPaths (LevelCategory category, int chapter=0, int rank=0)
 Configure level paths for the given level.
std::string InjectLevelPaths (const std::string &path, const std::string &defaultDir="")
 Inject something% paths.
const std::string & GetFilename ()
 Get filename.
const std::vector< CLevelParserLineUPtr > & GetLines ()
 Get all lines from file.
void AddLine (CLevelParserLineUPtr line)
 Insert new line to file.
CLevelParserLineGet (const std::string &command)
 Find first line with given command.
CLevelParserLineGetIfDefined (const std::string &command)
 Find first line with given command, null if doesn't exist.
int CountLines (const std::string &command)
 Count lines with given command.

Static Public Member Functions

static std::string BuildCategoryPath (LevelCategory category)
 Build category path.
static std::string BuildCategoryPath (std::string category)
static std::string BuildScenePath (LevelCategory category, int chapter, int rank, bool sceneFile=true)
 Build level filename.
static std::string BuildScenePath (std::string category, int chapter, int rank, bool sceneFile=true)

Constructor & Destructor Documentation

◆ CLevelParser() [1/3]

CLevelParser::CLevelParser ( )

Create an empty level file.

◆ CLevelParser() [2/3]

CLevelParser::CLevelParser ( std::string filename)

Load level from file.

◆ CLevelParser() [3/3]

CLevelParser::CLevelParser ( LevelCategory category,
int chapter,
int rank )

Load given level.

Member Function Documentation

◆ BuildCategoryPath()

std::string CLevelParser::BuildCategoryPath ( LevelCategory category)
static

Build category path.

◆ BuildScenePath()

std::string CLevelParser::BuildScenePath ( LevelCategory category,
int chapter,
int rank,
bool sceneFile = true )
static

Build level filename.

◆ Exists()

bool CLevelParser::Exists ( )

Check if level file exists.

◆ Load()

void CLevelParser::Load ( )

Load file.

◆ Save()

void CLevelParser::Save ( )

Save file.

◆ SetLevelPaths()

void CLevelParser::SetLevelPaths ( LevelCategory category,
int chapter = 0,
int rank = 0 )

Configure level paths for the given level.

◆ InjectLevelPaths()

std::string CLevelParser::InjectLevelPaths ( const std::string & path,
const std::string & defaultDir = "" )

Inject something% paths.

◆ GetFilename()

const std::string & CLevelParser::GetFilename ( )

Get filename.

◆ GetLines()

const std::vector< CLevelParserLineUPtr > & CLevelParser::GetLines ( )
inline

Get all lines from file.

◆ AddLine()

void CLevelParser::AddLine ( CLevelParserLineUPtr line)

Insert new line to file.

◆ Get()

CLevelParserLine * CLevelParser::Get ( const std::string & command)

Find first line with given command.

◆ GetIfDefined()

CLevelParserLine * CLevelParser::GetIfDefined ( const std::string & command)

Find first line with given command, null if doesn't exist.

◆ CountLines()

int CLevelParser::CountLines ( const std::string & command)

Count lines with given command.


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