The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
controller.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2009 - 2025
3 by Iris Morelle <shadowm2006@gmail.com>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
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 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16/**
17 * @file
18 * Storyscreen controller (interface).
19 */
20
21#pragma once
22
24
25#include <memory>
26#include <string>
27#include <vector>
28
29namespace storyscreen
30{
31class part;
32
33class controller : private story_parser
34{
35public:
36 typedef std::shared_ptr<part> part_pointer_type;
37
38 controller(const vconfig& data, const std::string& scenario_name);
39
40 part_pointer_type get_part(int index) const
41 {
42 return parts_.at(index);
43 }
44
45 int max_parts() const
46 {
47 return parts_.size();
48 }
49
50private:
51 /** Inherited from story_parser. */
52 virtual bool resolve_wml_helper(const std::string& key, const vconfig& node) override;
53
54 std::string scenario_name_;
55
56 // The part cache.
57 std::vector<part_pointer_type> parts_;
58};
59
60} // end namespace storyscreen
part_pointer_type get_part(int index) const
std::shared_ptr< part > part_pointer_type
virtual bool resolve_wml_helper(const std::string &key, const vconfig &node) override
Inherited from story_parser.
std::vector< part_pointer_type > parts_
Small helper class to encapsulate the common logic for parsing storyscreen WML.
Definition parser.hpp:29
A variable-expanding proxy for the config class.
Definition variable.hpp:45
std::string_view data
Definition picture.cpp:188