Debian Codegraph @

plugins/dm.editing/ReadmeTxt.h

raw
1 #pragma once
2
3 #include <stdexcept>
4 #include "MissionInfoTextFile.h"
5
6 namespace map
7 {
8
9 class ReadmeTxt;
10 typedef std::shared_ptr<ReadmeTxt> ReadmeTxtPtr;
11
12 /**
13 * An object representing the readme.txt file as found in the
14 * mission folder's root directory. It contains detailed info
15 * and/or instructions for the player installing the mission.
16 */
17 class ReadmeTxt :
18 public MissionInfoTextFile
19 {
20 private:
21 std::string _contents;
22
23 public:
24 static const char* NAME()
25 {
26 return "readme.txt";
27 }
28
29 std::string getFilename() override;
30
31 const std::string& getContents();
32 void setContents(const std::string& contents);
33
34 // Named constructor parsing the given string into a DarkmodTxt instance
35 // A parse exception will be thrown if the file is not compliant
36 static ReadmeTxtPtr CreateFromString(const std::string& contents);
37
38 // Named constructor parsing the given stream into a DarkmodTxt instance
39 // A parse exception will be thrown if the file is not compliant
40 static ReadmeTxtPtr CreateFromStream(std::istream& stream);
41
42 // A parse exception will be thrown if the file is not compliant
43 static ReadmeTxtPtr LoadForCurrentMod();
44
45 // Retrieves the text representation of this instance, as it will be written to the readme.txt file
46 std::string toString() override;
47 };
48
49 }