const std::string& twindow_builder::read(const config& cfg) { /*WIKI * @page = GUIToolkitWML * @order = 1_window * * = Window definition = * * A window defines how a window looks in the game. * * @start_table = config * id (string) Unique id for this window. * description (t_string) Unique translatable name for this window. * * resolution (section) The definitions of the window in various * resolutions. * @end_table * */ id_ = cfg["id"]; description_ = cfg["description"]; VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id")); VALIDATE(!description_.empty(), missing_mandatory_wml_key("window", "description")); DBG_GUI_P << "Window builder: reading data for window " << id_ << ".\n"; config::const_child_itors cfgs = cfg.child_range("resolution"); VALIDATE(cfgs.first != cfgs.second, _("No resolution defined.")); foreach (const config &i, cfgs) { resolutions.push_back(tresolution(i)); }
/*WIKI * @page = GUIToolkitWML * @order = 1_window * @begin{parent}{name="gui/"} * = Window definition = * @begin{tag}{name="window"}{min="0"}{max="-1"} * * A window defines how a window looks in the game. * * @begin{table}{config} * id & string & & Unique id for this window. $ * description & t_string & & Unique translatable name for this * window. $ * * resolution & section & & The definitions of the window in various * resolutions. $ * @end{table} * @end{tag}{name="window"} * @end{parent}{name="gui/"} * * */ const std::string& twindow_builder::read(const config& cfg) { id_ = cfg["id"].str(); description_ = cfg["description"].str(); VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id")); VALIDATE(!description_.empty(), missing_mandatory_wml_key("window", "description")); DBG_GUI_P << "Window builder: reading data for window " << id_ << ".\n"; config::const_child_itors cfgs = cfg.child_range("resolution"); VALIDATE(cfgs.first != cfgs.second, _("No resolution defined.")); for(const auto & i : cfgs) { resolutions.push_back(tresolution(i)); } return id_; }
const std::string& twindow_builder::read(const config& cfg) { /*WIKI * @page = GUIToolkitWML * @order = 1_window * @begin{parent}{name="gui/"} * = Window definition = * @begin{tag}{name="window"}{min="0"}{max="-1"} * * A window defines how a window looks in the game. * * @begin{table}{config} * id & string & & Unique id for this window. $ * description & t_string & & Unique translatable name for this window. $ * * resolution & section & & The definitions of the window in various * resolutions. $ * @end{table} * @end{tag}{name="window"} * @end{parent}{name="gui/"} * * */ id_ = cfg["id"].str(); description_ = cfg["description"].str(); VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id")); VALIDATE(!description_.empty(), missing_mandatory_wml_key("window", "description")); DBG_GUI_P << "Window builder: reading data for window " << id_ << ".\n"; config::const_child_itors cfgs = cfg.child_range("resolution"); VALIDATE(cfgs.first != cfgs.second, _("No resolution defined.")); resolutions.clear(); BOOST_FOREACH(const config &i, cfgs) { resolutions.push_back(tresolution(i)); }
const std::string& twindow_builder::read(const config& cfg) { /*WIKI * @page = GUIToolkitWML * @order = 1_window * * = Window definition = * * A window defines how a window looks in the game. * * @start_table = config * id (string) Unique id for this window. * description (t_string) Unique translatable name for this window. * * resolution (section) The definitions of the window in various * resolutions. * @end_table * */ id_ = cfg["id"]; description_ = cfg["description"]; VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id")); VALIDATE(!description_.empty(), missing_mandatory_wml_key("window", "description")); DBG_G_P << "Window builder: reading data for window " << id_ << ".\n"; const config::child_list& cfgs = cfg.get_children("resolution"); VALIDATE(!cfgs.empty(), _("No resolution defined.")); for(std::vector<config*>::const_iterator itor = cfgs.begin(); itor != cfgs.end(); ++itor) { resolutions.push_back(tresolution(**itor)); } return id_; }