Classes | Typedefs | Enumerations | Functions

help Namespace Reference

Classes

class  topic_generator
 Generate a topic text on the fly. More...
class  text_topic_generator
class  topic_text
 The text displayed in a topic. More...
struct  topic
 A topic contains a title, an id and some text. More...
struct  section
 A section contains topics and sections along with title and ID. More...
class  has_id
 To be used as a function object to locate sections and topics with a specified ID. More...
class  title_less
 To be used as a function object when sorting topic lists on the title. More...
class  section_less
 To be used as a function object when sorting section lists on the title. More...
class  string_less
struct  delete_section
struct  create_section
class  help_menu
 The menu to the left in the help browser, where topics can be navigated through and chosen. More...
struct  parse_error
 Thrown when the help system fails to parse something. More...
class  help_text_area
 The area where the content is shown in the help browser. More...
class  help_browser
 A help browser widget. More...
class  unit_topic_generator
struct  help_manager
class  help_button

Typedefs

typedef std::vector< section * > section_list
typedef std::list< topictopic_list

Enumerations

enum  UNIT_DESCRIPTION_TYPE { FULL_DESCRIPTION, NO_DESCRIPTION, NON_REVEALING_DESCRIPTION }

Functions

static void generate_contents ()
 Generate the help contents from the configurations given to the manager.
static void generate_sections (const config *help_cfg, const std::string &generator, section &sec, int level)
 Dispatch generators to their appropriate functions.
static std::vector< topicgenerate_topics (const bool sort_topics, const std::string &generator)
static std::string generate_topic_text (const std::string &generator, const config *help_cfg, const section &sec, const std::vector< topic > &generated_topics)
static std::string generate_about_text ()
static std::string generate_contents_links (const std::string &section_name, config const *help_cfg)
static std::string generate_contents_links (const section &sec, const std::vector< topic > &topics)
static 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 unit is hidden.
static std::vector< std::string > make_unit_links_list (const std::vector< std::string > &type_id_list, bool ordered=false)
 return a list of hyperlinks to unit's pages (ordered or not)
static void generate_races_sections (const config *help_cfg, section &sec, int level)
static std::vector< topicgenerate_unit_topics (const bool, const std::string &race)
static 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.
static std::vector< topicgenerate_ability_topics (const bool)
static std::vector< topicgenerate_weapon_special_topics (const bool)
static std::vector< topicgenerate_faction_topics (const bool)
static section parse_config (const config *cfg)
 Parse a help config, return the top level section.
static void parse_config_internal (const config *help_cfg, const config *section_cfg, section &sec, int level=0)
 Recursive function used by parse_config.
static bool section_is_referenced (const std::string &section_id, const config &cfg)
 Return true if the section with id section_id is referenced from another section in the config, or the toplevel.
static 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, or the toplevel.
static const topicfind_topic (const section &sec, const std::string &id)
 Search for the topic with the specified identifier in the section and its subsections.
static const sectionfind_section (const section &sec, const std::string &id)
 Search for the section with the specified identifier in the section and its subsections.
static std::vector< std::string > parse_text (const std::string &text)
 Parse a text string.
static 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 SDL_Color string_to_color (const std::string &s)
 Return the color the string represents.
static 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. All parts are less than width.
static std::string remove_first_space (const std::string &text)
static std::string escape (const std::string &s)
 Prepend all chars with meaning inside attributes with a backslash.
static std::string get_first_word (const std::string &s)
 Return the first word in s, not removing any spaces in the start of it.
void show_help (display &disp, const std::string &show_topic, int xloc, int yloc)
 Open the help browser, show topic with id show_topic.
void show_unit_help (display &disp, const std::string &show_topic, bool hidden, int xloc, int yloc)
 Open the help browser, show unit with id unit_id.
void show_help (display &disp, const section &toplevel_sec, const std::string &show_topic, int xloc, int yloc)
 Open a help dialog using a toplevel other than the default.

Typedef Documentation

typedef std::vector<section *> help::section_list

Definition at line 96 of file help.cpp.

typedef std::list<topic> help::topic_list

Definition at line 179 of file help.cpp.


Enumeration Type Documentation

Enumerator:
FULL_DESCRIPTION 
NO_DESCRIPTION 
NON_REVEALING_DESCRIPTION 

Definition at line 532 of file help.cpp.


Function Documentation

std::string help::convert_to_wml ( const std::string &  element_name,
const std::string &  contents 
) [static]

Convert the contents to wml attributes, surrounded within [element_name]...[/element_name].

Return the resulting WML.

Definition at line 2986 of file help.cpp.

References pos.

Referenced by parse_text().

Here is the caller graph for this function:

UNIT_DESCRIPTION_TYPE help::description_type ( const unit_type type  )  [static]

Return the type of description that should be shown for a unit of the given kind.

This method is intended to filter out information about units that should not be shown, for example due to not being encountered.

Definition at line 1805 of file help.cpp.

References game_config::debug, preferences::encountered_units(), unit_type::id(), and preferences::show_all_units_in_help().

Referenced by generate_ability_topics(), generate_races_sections(), generate_unit_topics(), generate_weapon_special_topics(), make_unit_link(), and help::unit_topic_generator::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

static std::string help::escape ( const std::string &  s  )  [static]

Prepend all chars with meaning inside attributes with a backslash.

Definition at line 585 of file help.cpp.

Referenced by bold(), generate_ability_topics(), generate_contents_links(), generate_unit_topics(), generate_weapon_special_topics(), make_link(), help::unit_topic_generator::operator()(), and gui2::tchat_log::model::populate_chat_message_list().

Here is the caller graph for this function:

const section * help::find_section ( const section &  sec,
const std::string &  id 
) [static]

Search for the section with the specified identifier in the section and its subsections.

Return the found section or NULL if none could be found.

Definition at line 2863 of file help.cpp.

References help::section::sections.

Referenced by generate_contents().

Here is the caller graph for this function:

const topic * help::find_topic ( const section &  sec,
const std::string &  id 
) [static]

Search for the topic with the specified identifier in the section and its subsections.

Return the found topic, or NULL if none could be found.

Definition at line 2846 of file help.cpp.

References help::section::sections, and help::section::topics.

Referenced by generate_contents(), help::help_browser::handle_event(), help::help_text_area::handle_ref_cfg(), help::help_menu::process(), and help::help_browser::show_topic().

Here is the caller graph for this function:

std::vector< topic > help::generate_ability_topics ( const bool  sort_generated  )  [static]
std::string help::generate_about_text (  )  [static]

Definition at line 1818 of file help.cpp.

References about::get_text(), utils::join(), and schema_validation::remove.

Referenced by generate_topic_text().

Here is the call graph for this function:

Here is the caller graph for this function:

void help::generate_contents (  )  [static]

Generate the help contents from the configurations given to the manager.

Definition at line 777 of file help.cpp.

References config::add_child(), config::child(), config::child_range(), help::section::clear(), config::clear_children(), find_section(), find_topic(), game::error::message, parse_config(), section_is_referenced(), and topic_is_referenced().

Here is the call graph for this function:

std::string help::generate_contents_links ( const std::string &  section_name,
config const *  help_cfg 
) [static]

Definition at line 1829 of file help.cpp.

References escape(), config::find_child(), utils::quoted_split(), and sort().

Referenced by generate_topic_text().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string help::generate_contents_links ( const section &  sec,
const std::vector< topic > &  topics 
) [static]

Definition at line 1867 of file help.cpp.

References escape(), and help::section::sections.

Here is the call graph for this function:

std::vector< topic > help::generate_faction_topics ( const bool  sort_generated  )  [static]

Definition at line 1241 of file help.cpp.

References _, config::child(), config::child_range(), config::attribute_value::empty(), preferences::era(), make_link(), make_unit_links_list(), sort(), utils::split(), and config::attribute_value::t_str().

Referenced by generate_topics().

Here is the call graph for this function:

Here is the caller graph for this function:

void help::generate_races_sections ( const config help_cfg,
section &  sec,
int  level 
) [static]

Definition at line 1695 of file help.cpp.

References _, help::section::add_section(), description_type(), unit_type_data::find_race(), FULL_DESCRIPTION, unit_type::hide_help(), parse_config_internal(), unit_type::race(), type, unit_type_data::types(), and unit_types.

Referenced by generate_sections().

Here is the call graph for this function:

Here is the caller graph for this function:

void help::generate_sections ( const config help_cfg,
const std::string &  generator,
section &  sec,
int  level 
) [static]

Dispatch generators to their appropriate functions.

Definition at line 1041 of file help.cpp.

References generate_races_sections().

Referenced by parse_config_internal().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string help::generate_topic_text ( const std::string &  generator,
const config help_cfg,
const section &  sec,
const std::vector< topic > &  generated_topics 
) [static]

Definition at line 1048 of file help.cpp.

References empty_string, generate_about_text(), generate_contents_links(), and utils::split().

Referenced by parse_config_internal().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< topic > help::generate_topics ( const bool  sort_topics,
const std::string &  generator 
) [static]

Definition at line 1018 of file help.cpp.

References generate_ability_topics(), generate_faction_topics(), generate_unit_topics(), generate_weapon_special_topics(), utils::split(), and utils::STRIP_SPACES.

Referenced by parse_config_internal().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< topic > help::generate_unit_topics ( const bool  sort_generated,
const std::string &  race 
) [static]

Definition at line 1737 of file help.cpp.

References _, description_type(), escape(), unit_type_data::find_race(), FULL_DESCRIPTION, unit_type::hide_help(), unit_type::id(), unit_type::race(), sort(), help::topic::text, type, unit_type::type_name(), unit_type_data::types(), and unit_types.

Referenced by generate_topics().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< topic > help::generate_weapon_special_topics ( const bool  sort_generated  )  [static]

Definition at line 1099 of file help.cpp.

References _, unit_type::attacks(), description_type(), escape(), unit_type::hide_help(), unit_type::id(), sort(), type, unit_type::type_name(), unit_type_data::types(), unit_types, and resources::units.

Referenced by generate_topics().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string help::get_first_word ( const std::string &  s  )  [static]

Return the first word in s, not removing any spaces in the start of it.

Definition at line 3084 of file help.cpp.

References utils::utf8_iterator::end(), font::is_cjk_char(), and utils::wchar_to_string().

Referenced by help::help_text_area::add_text_item().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string help::make_unit_link ( const std::string &  type_id  )  [static]

return a hyperlink with the unit's name and pointing to the unit page return empty string if this unit is hidden.

If not yet discovered add the (?) suffix

Definition at line 1655 of file help.cpp.

References description_type(), unit_type_data::find(), FULL_DESCRIPTION, unit_type::hide_help(), unit_type::id(), make_link(), type, unit_type::type_name(), and unit_types.

Referenced by make_unit_links_list().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > help::make_unit_links_list ( const std::vector< std::string > &  type_id_list,
bool  ordered = false 
) [static]

return a list of hyperlinks to unit's pages (ordered or not)

Definition at line 1680 of file help.cpp.

References make_unit_link(), and sort().

Referenced by generate_faction_topics().

Here is the call graph for this function:

Here is the caller graph for this function:

section help::parse_config ( const config cfg  )  [static]

Parse a help config, return the top level section.

Return an empty section if cfg is NULL.

Definition at line 1008 of file help.cpp.

References config::child(), and parse_config_internal().

Referenced by generate_contents().

Here is the call graph for this function:

Here is the caller graph for this function:

void help::parse_config_internal ( const config help_cfg,
const config section_cfg,
section &  sec,
int  level = 0 
) [static]

Recursive function used by parse_config.

Definition at line 900 of file help.cpp.

References help::section::add_section(), config::find_child(), generate_sections(), generate_topic_text(), generate_topics(), help::topic::id, help::section::id, help::section::level, utils::quoted_split(), help::section::sections, sort(), help::section::title, and help::section::topics.

Referenced by generate_races_sections(), and parse_config().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > help::parse_text ( const std::string &  text  )  [static]

Parse a text string.

Return a vector with the different parts of the text. Each markup item is a separate part while the text between markups are separate parts.

Definition at line 2913 of file help.cpp.

References convert_to_wml(), game_logic::msg(), and pos.

Referenced by help::topic_text::parsed_text().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string help::remove_first_space ( const std::string &  text  )  [static]

Definition at line 3076 of file help.cpp.

Referenced by help::help_text_area::add_text_item().

Here is the caller graph for this function:

bool help::section_is_referenced ( const std::string &  section_id,
const config cfg 
) [static]

Return true if the section with id section_id is referenced from another section in the config, or the toplevel.

Definition at line 852 of file help.cpp.

References config::child(), config::child_range(), gui2::event::find(), and utils::quoted_split().

Referenced by generate_contents().

Here is the call graph for this function:

Here is the caller graph for this function:

void help::show_help ( display disp,
const section &  toplevel_sec,
const std::string &  show_topic,
int  xloc,
int  yloc 
)

Open a help dialog using a toplevel other than the default.

This allows for complete customization of the contents, although not in a very easy way.

void help::show_help ( display disp,
const std::string &  show_topic,
int  xloc,
int  yloc 
)

Open the help browser, show topic with id show_topic.

Open the help browser.

If show_topic is the empty string, the default topic will be shown.

The help browser will have the topic with id show_topic open if it is not the empty string. The default topic will be shown if show_topic is the empty string.

Referenced by do_gameloop(), and WML_HANDLER_FUNCTION().

Here is the caller graph for this function:

void help::show_unit_help ( display disp,
const std::string &  show_topic,
bool  hidden,
int  xloc,
int  yloc 
)

Open the help browser, show unit with id unit_id.

wrapper to add unit prefix and hidding symbol

If show_topic is the empty string, the default topic will be shown.

std::vector< std::string > help::split_in_width ( const std::string &  s,
const int  font_size,
const unsigned  width 
) [static]

Make a best effort to word wrap s. All parts are less than width.

Definition at line 3057 of file help.cpp.

References _, and font::word_wrap_text().

Referenced by help::help_text_area::add_text_item().

Here is the call graph for this function:

Here is the caller graph for this function:

SDL_Color help::string_to_color ( const std::string &  s  )  [static]

Return the color the string represents.

Return font::NORMAL_COLOR if the string is empty or can't be matched against any other color.

Definition at line 3037 of file help.cpp.

References font::BAD_COLOR, font::BIGMAP_COLOR, font::BLACK_COLOR, font::GOOD_COLOR, font::NORMAL_COLOR, and font::YELLOW_COLOR.

Referenced by help::help_text_area::handle_format_cfg().

Here is the caller graph for this function:

bool help::topic_is_referenced ( const std::string &  topic_id,
const config cfg 
) [static]

Return true if the topic with id topic_id is referenced from another section in the config, or the toplevel.

Definition at line 876 of file help.cpp.

References config::child(), config::child_range(), gui2::event::find(), and utils::quoted_split().

Referenced by generate_contents().

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:23:47 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs