MCPcopy Create free account
hub / github.com/Hopson97/HopsonCraft / loadFromStream

Method loadFromStream

Source/Util/Config.cpp:10–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10void Config::loadFromStream(std::string const& filename, std::istream& is)
11{
12 ConfigParser parser;
13 parser.parse(filename, is);
14 while (!parser.atEnd())
15 {
16 if (parser.atKVP())
17 {
18 parser.error("KVP without section");
19 }
20
21 auto header = parser.getHeader();
22
23 if (header == "screen")
24 {
25 loadScreenSettingsFromStream(parser);
26 }
27 else if (header == "keyboard")
28 {
29 loadKeybindingsFromStream(parser);
30 }
31 else
32 {
33 parser.error("Unrecognised section " + header);
34 }
35 }
36}
37
38sf::Keyboard::Key Config::getKey(Key_Binds::Control control) const
39{

Callers 1

loadConfigFunction · 0.80

Calls 5

parseMethod · 0.80
atEndMethod · 0.80
atKVPMethod · 0.80
errorMethod · 0.80
getHeaderMethod · 0.80

Tested by

no test coverage detected