48 #include <boost/logic/tribool.hpp> 106 topic_text& operator=(std::shared_ptr<topic_generator>
g);
108 const std::vector<std::string>& parsed_text()
const;
121 topic(
const std::string &_title,
const std::string &_id) :
128 topic(
const std::string &_title,
const std::string &_id,
const std::string &_text)
129 : title(_title),
id(_id), text(_text) {}
130 topic(
const std::string &_title,
const std::string &_id, std::shared_ptr<topic_generator>
g)
131 : title(_title),
id(_id), text(g) {}
176 has_id(
const std::string &
id) : id_(id) {}
207 bool operator() (
const std::string &s1,
const std::string &s2)
const {
224 std::vector<topic>
generate_topics(
const bool sort_topics,
const std::string &generator);
226 const section &sec,
const std::vector<topic>& generated_topics);
237 const std::vector<std::string>& type_id_list,
bool ordered =
false);
313 std::vector<std::string>
parse_text(
const std::string &text);
319 std::string
convert_to_wml(
const std::string &element_name,
const std::string &contents);
328 std::vector<std::string>
split_in_width(
const std::string &
s,
const int font_size,
const unsigned width);
333 std::string
escape(
const std::string &
s);
386 inline std::string
make_link(
const std::string& text,
const std::string& dst)
392 inline std::string
jump_to(
const unsigned pos)
394 std::stringstream ss;
395 ss <<
"<jump>to=" << pos <<
"</jump>";
399 inline std::string
jump(
const unsigned amount)
401 std::stringstream ss;
402 ss <<
"<jump>amount=" << amount <<
"</jump>";
406 inline std::string
bold(
const std::string &
s)
408 std::stringstream ss;
414 typedef std::pair< std::string, unsigned >
item;
427 void push_tab_pair(std::vector<help::item> &v,
const std::string &
s,
const std::optional<std::string> &
image = {},
unsigned padding = 0);
std::string jump_to(const unsigned pos)
const std::string ability_prefix
section parse_config(const config *cfg)
Parse a help config, return the top level section.
Ignore this unit for documentation purposes.
std::string make_unit_link(const std::string &type_id)
return a hyperlink with the unit's name and pointing to the unit page return empty string if this uni...
const std::string open_section_img
std::vector< topic > generate_trait_topics(const bool sort_generated)
const std::string unit_prefix
void push_tab_pair(std::vector< help::item > &v, const std::string &s, const std::optional< std::string > &image, unsigned padding)
std::vector< topic > generate_unit_topics(const bool sort_generated, const std::string &race)
const std::string era_prefix
const std::string topic_img
topic_text(const std::string &t)
bool operator()(const section &s)
const std::string closed_section_img
std::string remove_first_space(const std::string &text)
A section contains topics and sections along with title and ID.
const std::string unknown_unit_topic
const std::string race_prefix
std::string generate_topic_text(const std::string &generator, const config *help_cfg, const section &sec, const std::vector< topic > &generated_topics)
virtual std::string operator()() const
topic(const std::string &_title, const std::string &_id, const std::string &_text)
int compare(const std::string &s1, const std::string &s2)
Case-sensitive lexicographical comparison.
boost::tribool last_debug_state
int relative_size(int size)
Thrown when the help system fails to parse something.
parse_error(const std::string &msg)
void clear(const std::string &key)
topic_text(std::shared_ptr< topic_generator > g)
std::vector< std::string > empty_string_vector
Although the unit itself is hidden, traits reachable via this unit are not hidden.
text_topic_generator(const std::string &t)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
const int normal_font_size
unsigned image_width(const std::string &filename)
const std::string terrain_prefix
int last_num_encountered_terrains
std::list< section > section_list
color_t string_to_color(const std::string &cmp_str)
Return the color the string represents.
bool is_visible_id(const std::string &id)
std::vector< topic > generate_weapon_special_topics(const bool sort_generated)
std::vector< std::string > make_unit_links_list(const std::vector< std::string > &type_id_list, bool ordered)
return a list of hyperlinks to unit's pages (ordered or not)
std::string bold(const std::string &s)
A single unit type that the player may recruit.
void generate_sections(const config *help_cfg, const std::string &generator, section &sec, int level)
Dispatch generators to their appropriate functions.
help::section hidden_sections
Contains the database of all known terrain types, both those defined explicitly by WML [terrain_type]...
const section * find_section(const section &sec, const std::string &id)
Search for the section with the specified identifier in the section and its subsections.
To be used as a function object to locate sections and topics with a specified ID.
The text displayed in a topic.
std::string generate_table(const table_spec &tab, const unsigned int spacing)
std::vector< std::vector< help::item > > table_spec
std::string hidden_symbol(bool hidden)
std::shared_ptr< terrain_type_data > load_terrain_types_data()
Load the appropriate terrain types data to use.
bool operator()(const topic &t1, const topic &t2)
std::vector< topic > generate_era_topics(const bool sort_generated, const std::string &era_id)
std::vector< topic > generate_faction_topics(const config &era, const bool sort_generated)
The basic class for representing 8-bit RGB or RGBA colour values.
std::vector< std::string > parsed_text_
topic_generator()=default
std::list< topic > topic_list
std::shared_ptr< topic_generator > generator_
void parse_config_internal(const config *help_cfg, const config *section_cfg, section &sec, int level)
Recursive function used by parse_config.
bool operator!=(const topic &t) const
bool section_is_referenced(const std::string §ion_id, const config &cfg)
Return true if the section with id section_id is referenced from another section in the config...
bool topic_is_referenced(const std::string &topic_id, const config &cfg)
Return true if the topic with id topic_id is referenced from another section in the config...
void generate_unit_sections(const config *, section &sec, int, const bool, const std::string &race)
To be used as a function object when sorting section lists on the title.
std::string id
Text to match against addon_info.tags()
const std::string variation_prefix
void generate_terrain_sections(section &sec, int)
int last_num_encountered_units
bool operator()(const section *s)
std::string make_link(const std::string &text, const std::string &dst)
bool operator==(const config &a, const config &b)
std::string convert_to_wml(const std::string &element_name, const std::string &contents)
Convert the contents to wml attributes, surrounded within [element_name]...[/element_name].
static map_location::DIRECTION s
static bool operator<(const placing_info &a, const placing_info &b)
const game_config_view * game_cfg
void generate_races_sections(const config *help_cfg, section &sec, int level)
rng * generator
This generator is automatically synced during synced context.
std::string escape(const std::string &s)
Prepend all chars with meaning inside attributes with a backslash.
std::vector< std::string > parse_text(const std::string &text)
Parse a text string.
const unsigned max_history
std::vector< topic > generate_time_of_day_topics(const bool)
std::string generate_contents_links(const std::string §ion_name, config const *help_cfg)
const std::string faction_prefix
std::string jump(const unsigned amount)
has_id(const std::string &id)
const std::string default_show_topic
void generate_contents()
Generate the help contents from the configurations given to the manager.
Base class for all the errors encountered by the engine.
std::vector< topic > generate_topics(const bool sort_generated, const std::string &generator)
virtual std::string operator()() const =0
const topic * find_topic(const section &sec, const std::string &id)
Search for the topic with the specified identifier in the section and its subsections.
topic(const std::string &_title, const std::string &_id, std::shared_ptr< topic_generator > g)
Functions to load and save images from/to disk.
Generate a topic text on the fly.
bool operator()(const topic &t)
A topic contains a title, an id and some text.
virtual ~topic_generator()
topic(const std::string &_title, const std::string &_id)
bool is_valid_id(const std::string &id)
Return true if the id is valid for user defined topics and sections.
A config object defines a single node in a WML file, with access to child nodes.
std::string get_first_word(const std::string &s)
Return the first word in s, not removing any spaces in the start of it.
UNIT_DESCRIPTION_TYPE description_type(const unit_type &type)
Return the type of description that should be shown for a unit of the given kind. ...
std::vector< topic > generate_ability_topics(const bool sort_generated)
void generate_era_sections(const config *help_cfg, section &sec, int level)
const int max_section_level
bool operator()(const section &s1, const section &s2)
To be used as a function object when sorting topic lists on the title.
std::vector< std::string > split_in_width(const std::string &s, const int font_size, const unsigned width)
Make a best effort to word wrap s.
std::pair< std::string, unsigned > item
help::section default_toplevel