Colobot
parserline.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
25 #pragma once
26 
28 
29 #include <string>
30 #include <map>
31 #include <memory>
32 
33 class CLevelParser;
34 class CLevelParserLine;
35 using CLevelParserLineUPtr = std::unique_ptr<CLevelParserLine>;
36 
38 {
39 public:
40  CLevelParserLine(int lineNumber, std::string command);
41  CLevelParserLine(std::string command);
42 
44  int GetLineNumber();
45 
49  void SetLevel(CLevelParser* level);
50 
51  const std::string& GetLevelFilename();
52 
53  std::string GetCommand();
54  void SetCommand(std::string command);
55 
56  CLevelParserParam* GetParam(std::string name);
57  void AddParam(std::string name, CLevelParserParamUPtr value);
58 
59  friend std::ostream& operator<<(std::ostream& str, const CLevelParserLine& line);
60 
61 private:
62  CLevelParser* m_level;
63  std::string m_levelFilename;
64  int m_lineNumber;
65  std::string m_command;
66  std::map<std::string, CLevelParserParamUPtr> m_params;
67 };
Value of command argument in level file.
Definition: parserline.h:37
Definition: parserparam.h:51
Definition: parser.h:40
void SetLevel(CLevelParser *level)
Set CLevelParser this line is part of.
Definition: parserline.cpp:51
int GetLineNumber()
Get line number.
Definition: parserline.cpp:41
CLevelParser * GetLevel()
Get CLevelParser this line is part of.
Definition: parserline.cpp:46