diff --git a/src/game_initialization/multiplayer_lobby.cpp b/src/game_initialization/multiplayer_lobby.cpp index 951beda84d91..a92a6d6c6f9f 100644 --- a/src/game_initialization/multiplayer_lobby.cpp +++ b/src/game_initialization/multiplayer_lobby.cpp @@ -548,7 +548,7 @@ void gamebrowser::populate_game_item_campaign_or_scenario_info(gamebrowser::game assert(difficulties.size() == difficulty_options.size()); for (const std::string& difficulty : difficulties) { if (difficulty == game["difficulty_define"]) { - gui2::tlegacy_menu_item menu_item(difficulty_options[index]); + gui2::legacy_menu_item menu_item(difficulty_options[index]); item.map_info += " — "; item.map_info += menu_item.label(); item.map_info += " "; diff --git a/src/gui/auxiliary/field-fwd.hpp b/src/gui/auxiliary/field-fwd.hpp index 279f7a288a61..22b7969b4ec8 100644 --- a/src/gui/auxiliary/field-fwd.hpp +++ b/src/gui/auxiliary/field-fwd.hpp @@ -26,16 +26,16 @@ namespace gui2 class widget; class window; -class tfield_; -class tfield_bool; -class tfield_label; -class tfield_text; +class field_base; +class field_bool; +class field_label; +class field_text; // NOTE the const must be in the template else things fail :/ bug in gcc? template -class tfield; +class field; class integer_selector; -typedef tfield tfield_integer; +typedef field field_integer; } // namespace gui2 diff --git a/src/gui/auxiliary/field.hpp b/src/gui/auxiliary/field.hpp index 5dadd52011e9..922381a824ec 100644 --- a/src/gui/auxiliary/field.hpp +++ b/src/gui/auxiliary/field.hpp @@ -41,7 +41,7 @@ namespace gui2 * gui2::widget. This name widget is a generic name and fits, however some * functions used are first declared in a control. */ -class tfield_ +class field_base { public: /** @@ -51,12 +51,12 @@ class tfield_ * A widget can only be connected once. * @param mandatory Is the widget mandatory */ - tfield_(const std::string& id, const bool mandatory) + field_base(const std::string& id, const bool mandatory) : id_(id), mandatory_(mandatory), widget_(nullptr) { } - virtual ~tfield_() + virtual ~field_base() { } @@ -258,7 +258,7 @@ class tfield_ * or not). */ template -class tfield : public tfield_ +class field : public field_base { public: /** @@ -277,11 +277,11 @@ class tfield : public tfield_ * some variable in the engine after the window * is closed with OK. */ - tfield(const std::string& id, + field(const std::string& id, const bool mandatory, const std::function& callback_load_value, const std::function& callback_save_value) - : tfield_(id, mandatory) + : field_base(id, mandatory) , value_(T()) , link_(value_) , callback_load_value_(callback_load_value) @@ -304,8 +304,8 @@ class tfield : public tfield_ * the widget. * * else, its value is undefined. */ - tfield(const std::string& id, const bool mandatory, T& linked_variable) - : tfield_(id, mandatory) + field(const std::string& id, const bool mandatory, T& linked_variable) + : field_base(id, mandatory) , value_(T()) , link_(linked_variable) , callback_load_value_(std::function()) @@ -331,8 +331,8 @@ class tfield : public tfield_ * A widget can only be connected once. * @param value The value of the widget. */ - tfield(const std::string& id, const bool mandatory, const T& value) - : tfield_(id, mandatory) + field(const std::string& id, const bool mandatory, const T& value) + : field_base(id, mandatory) , value_(value) , link_(value_) , callback_load_value_(std::function()) @@ -341,7 +341,7 @@ class tfield : public tfield_ static_assert((std::is_same::value), "Second template argument must be control"); } - /** Inherited from tfield_. */ + /** Inherited from field_base. */ void widget_restore(window& window) { validate_widget(window); @@ -377,7 +377,7 @@ class tfield : public tfield_ value_ = value; } - /** Inherited from tfield_. */ + /** Inherited from field_base. */ void widget_save(window& window) { save(window, false); @@ -423,7 +423,7 @@ class tfield : public tfield_ */ std::function callback_load_value_; - /** Inherited from tfield_. */ + /** Inherited from field_base. */ void init_generic(window& window) { validate_widget(window); @@ -437,7 +437,7 @@ class tfield : public tfield_ restore(window); } - /** Inherited from tfield_. */ + /** Inherited from field_base. */ void finalize_generic(window& window) { save(window, true); @@ -488,7 +488,7 @@ class tfield : public tfield_ }; template -void tfield::save(window& window, const bool must_be_active) +void field::save(window& window, const bool must_be_active) { const W* widget = find_widget(&window, id(), must_be_active, false); @@ -499,7 +499,7 @@ void tfield::save(window& window, const bool must_be_active) } template <> -inline void tfield::save( +inline void field::save( window& window, const bool must_be_active) { const selectable_item* selectable @@ -511,7 +511,7 @@ inline void tfield::save( } template <> -inline void tfield::save( +inline void field::save( window& window, const bool must_be_active) { const control* ctrl @@ -523,7 +523,7 @@ inline void tfield::save( } template -void tfield::restore(window& window) +void field::restore(window& window) { W* widget = find_widget(&window, id(), false, false); @@ -534,7 +534,7 @@ void tfield::restore(window& window) template <> inline void -tfield::restore(window& window) +field::restore(window& window) { control* ctrl = find_widget(&window, id(), false, false); @@ -544,35 +544,35 @@ tfield::restore(window& window) } /** Specialized field class for boolean. */ -class tfield_bool : public tfield +class field_bool : public field { public: - tfield_bool(const std::string& id, + field_bool(const std::string& id, const bool mandatory, const std::function& callback_load_value, const std::function& callback_save_value, const std::function& callback_change, const bool initial_fire) - : tfield( + : field( id, mandatory, callback_load_value, callback_save_value) , callback_change_(callback_change) , initial_fire_(initial_fire) { } - tfield_bool(const std::string& id, + field_bool(const std::string& id, const bool mandatory, bool& linked_variable, const std::function& callback_change, const bool initial_fire) - : tfield(id, mandatory, linked_variable) + : field(id, mandatory, linked_variable) , callback_change_(callback_change) , initial_fire_(initial_fire) { } private: - /** Overridden from tfield_. */ + /** Overridden from field_base. */ void init_specialized(window& window) { if(callback_change_) { @@ -592,29 +592,29 @@ class tfield_bool : public tfield }; /** Specialized field class for text. */ -class tfield_text : public tfield +class field_text : public field { public: - tfield_text(const std::string& id, + field_text(const std::string& id, const bool mandatory, const std::function& callback_load_value, const std::function& callback_save_value) - : tfield( + : field( id, mandatory, callback_load_value, callback_save_value) { } - tfield_text(const std::string& id, + field_text(const std::string& id, const bool mandatory, std::string& linked_variable) - : tfield( + : field( id, mandatory, linked_variable) { } private: - /** Overridden from tfield_. */ + /** Overridden from field_base. */ void finalize_specialized(window& window) { text_box* widget = dynamic_cast(window.find(id(), false)); @@ -626,14 +626,14 @@ class tfield_text : public tfield +class field_label : public field { public: - tfield_label(const std::string& id, + field_label(const std::string& id, const bool mandatory, const std::string& text, const bool use_markup) - : tfield(id, mandatory, text) + : field(id, mandatory, text) , use_markup_(use_markup) { @@ -643,7 +643,7 @@ class tfield_label : public tfield /** Whether or not the label uses markup. */ bool use_markup_; - /** Overridden from tfield_. */ + /** Overridden from field_base. */ void init_specialized(window& window) { find_widget(&window, id(), false).set_use_markup(use_markup_); diff --git a/src/gui/auxiliary/formula.hpp b/src/gui/auxiliary/formula.hpp index cbe4b9ed47cf..60c3b650dd2f 100644 --- a/src/gui/auxiliary/formula.hpp +++ b/src/gui/auxiliary/formula.hpp @@ -45,7 +45,7 @@ namespace gui2 * this header. */ template -class tformula +class typed_formula { public: /** @@ -56,7 +56,7 @@ class tformula * be converted to the type T. * @param value The default value for the object. */ - explicit tformula(const std::string& str, const T value = T()); + explicit typed_formula(const std::string& str, const T value = T()); /** * Returns the value, can only be used if the data is no formula. @@ -136,7 +136,7 @@ class tformula }; template -tformula::tformula(const std::string& str, const T value) +typed_formula::typed_formula(const std::string& str, const T value) : formula_(), value_(value) { if(str.empty()) { @@ -151,7 +151,7 @@ tformula::tformula(const std::string& str, const T value) } template -inline T tformula:: +inline T typed_formula:: operator()(const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { @@ -167,7 +167,7 @@ operator()(const game_logic::map_formula_callable& variables, template <> inline bool -tformula::execute(const game_logic::map_formula_callable& variables, +typed_formula::execute(const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { return game_logic::formula(formula_, functions) @@ -177,7 +177,7 @@ tformula::execute(const game_logic::map_formula_callable& variables, template <> inline int -tformula::execute(const game_logic::map_formula_callable& variables, +typed_formula::execute(const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { return game_logic::formula(formula_, functions) @@ -187,7 +187,7 @@ tformula::execute(const game_logic::map_formula_callable& variables, template <> inline unsigned -tformula::execute(const game_logic::map_formula_callable& variables, +typed_formula::execute(const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { return game_logic::formula(formula_, functions) @@ -196,7 +196,7 @@ tformula::execute(const game_logic::map_formula_callable& variables, } template <> -inline std::string tformula::execute( +inline std::string typed_formula::execute( const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { @@ -207,7 +207,7 @@ inline std::string tformula::execute( template <> inline t_string -tformula::execute(const game_logic::map_formula_callable& variables, +typed_formula::execute(const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { return game_logic::formula(formula_, functions) @@ -216,7 +216,7 @@ tformula::execute(const game_logic::map_formula_callable& variables, } template <> -inline PangoAlignment tformula::execute( +inline PangoAlignment typed_formula::execute( const game_logic::map_formula_callable& variables, game_logic::function_symbol_table* functions) const { @@ -227,42 +227,42 @@ inline PangoAlignment tformula::execute( template inline T -tformula::execute(const game_logic::map_formula_callable& /*variables*/ +typed_formula::execute(const game_logic::map_formula_callable& /*variables*/ , game_logic::function_symbol_table* /*functions*/) const { // Every type needs its own execute function avoid instantiation of the // default execute. - static_assert(sizeof(T) == 0, "tformula: Missing execute specialization"); + static_assert(sizeof(T) == 0, "typed_formula: Missing execute specialization"); return T(); } template <> -inline void tformula::convert(const std::string& str) +inline void typed_formula::convert(const std::string& str) { value_ = utils::string_bool(str); } template <> -inline void tformula::convert(const std::string& str) +inline void typed_formula::convert(const std::string& str) { value_ = str; } template <> -inline void tformula::convert(const std::string& str) +inline void typed_formula::convert(const std::string& str) { value_ = str; } template <> -inline void tformula::convert(const std::string& str) +inline void typed_formula::convert(const std::string& str) { value_ = decode_text_alignment(str); } template -inline void tformula::convert(const std::string& str) +inline void typed_formula::convert(const std::string& str) { value_ = lexical_cast_default(str); } diff --git a/src/gui/auxiliary/iterator/exception.hpp b/src/gui/auxiliary/iterator/exception.hpp index 2706ab549131..c71230f24fa3 100644 --- a/src/gui/auxiliary/iterator/exception.hpp +++ b/src/gui/auxiliary/iterator/exception.hpp @@ -14,7 +14,7 @@ /** * @file - * Contains the exceptions throw by the @ref gui2::iterator::titerator classes. + * Contains the exceptions throw by the @ref gui2::iterator::iterator classes. */ #ifndef GUI_WIDGETS_AUXILIARY_ITERATOR_EXCEPTION_HPP_INCLUDED @@ -36,17 +36,17 @@ namespace iterator * * Invalid means the initial state at_end() == true. */ -class tlogic_error : public std::logic_error, public lua_jailbreak_exception +class logic_error : public std::logic_error, public lua_jailbreak_exception { public: - explicit tlogic_error(const std::string& message) + explicit logic_error(const std::string& message) : std::logic_error("GUI2 ITERATOR: " + message) , lua_jailbreak_exception() { } private: - IMPLEMENT_LUA_JAILBREAK_EXCEPTION(tlogic_error) + IMPLEMENT_LUA_JAILBREAK_EXCEPTION(logic_error) }; /** @@ -54,17 +54,17 @@ class tlogic_error : public std::logic_error, public lua_jailbreak_exception * * Invalid means the initial state at_end() == true. */ -class trange_error : public std::range_error, public lua_jailbreak_exception +class range_error : public std::range_error, public lua_jailbreak_exception { public: - explicit trange_error(const std::string& message) + explicit range_error(const std::string& message) : std::range_error("GUI2 ITERATOR: " + message) , lua_jailbreak_exception() { } private: - IMPLEMENT_LUA_JAILBREAK_EXCEPTION(trange_error) + IMPLEMENT_LUA_JAILBREAK_EXCEPTION(range_error) }; } // namespace iterator diff --git a/src/gui/auxiliary/iterator/iterator.cpp b/src/gui/auxiliary/iterator/iterator.cpp index 769d101b8c7b..6502fd46e257 100644 --- a/src/gui/auxiliary/iterator/iterator.cpp +++ b/src/gui/auxiliary/iterator/iterator.cpp @@ -46,16 +46,16 @@ namespace iterator * * @section gui2_iterator_level Level * - * The levels are defined in @ref gui2::iterator::twalker_::tlevel. The + * The levels are defined in @ref gui2::iterator::walker_base::level. The * level allows the user to only visit a part of the widget tree. * - * @note At the moment when gui2::iterator::twalker_::widget is skipped the + * @note At the moment when gui2::iterator::walker_base::widget is skipped the * child class also skips its children. This behavior might change. * * * @section gui2_iterator_walker Walker * - * The is a group of classes inheriting from @ref gui2::iterator::twalker_ + * The is a group of classes inheriting from @ref gui2::iterator::walker_base * the objects are created from @ref gui2::widget::create_walker. The * walker allows to visit the several levels of the widget. This means * several widgets need to override the function in a subclass. For example @@ -68,8 +68,8 @@ namespace iterator * * This policy simply defines whether or not to visit the widgets at a * certain level. There are two visit policies: - * - @ref gui2::iterator::policy::visit::tvisit visits the widget at the level. - * - @ref gui2::iterator::policy::visit::tskip skips the widget at the level. + * - @ref gui2::iterator::policy::visit::visit_level visits the widget at the level. + * - @ref gui2::iterator::policy::visit::skip_level skips the widget at the level. * * There are no more visit policies expected for the future. These policies * are normally not used directly, but set from the @ref @@ -82,8 +82,8 @@ namespace iterator * first, this level before diving down etc. @ref tests/gui/iterator.cpp * shows more information. * The following policies have been defined: - * - @ref gui2::iterator::policy::order::ttop_down - * - @ref gui2::iterator::policy::order::tbottom_up + * - @ref gui2::iterator::policy::order::top_down + * - @ref gui2::iterator::policy::order::bottom_up * * The next sections describe in which order the widgets are visited. In the * description we use the following widget tree. @@ -139,7 +139,7 @@ namespace iterator * can be used. It the policy visits the widget, it's certain there is at least * one widget to visit. Below some sample code: @code -titerator itor(root); +iterator itor(root); assert(!itor.at_end()); do { ... @@ -149,7 +149,7 @@ do { * * When there might be no widget to visit a simple for loop can be used: @code -for(titerator itor(root); !itor.at_end(); ++itor) { +for(iterator itor(root); !itor.at_end(); ++itor) { ... ... } diff --git a/src/gui/auxiliary/iterator/iterator.hpp b/src/gui/auxiliary/iterator/iterator.hpp index 2a86032b0915..953f0f25865e 100644 --- a/src/gui/auxiliary/iterator/iterator.hpp +++ b/src/gui/auxiliary/iterator/iterator.hpp @@ -36,7 +36,7 @@ namespace iterator * See @ref gui2_iterator_iterator for more information. */ template -class titerator : private order, private boost::noncopyable +class iterator : private order, private boost::noncopyable { public: /** @@ -44,7 +44,7 @@ class titerator : private order, private boost::noncopyable * * @param root The widget where to start the iteration. */ - titerator(widget& root) : order(root) + iterator(widget& root) : order(root) { } @@ -66,7 +66,7 @@ class titerator : private order, private boost::noncopyable * @pre The following assertion holds: * @code at_end() == false @endcode * - * @throws A @ref trange_error exception upon pre + * @throws A @ref range_error exception upon pre * condition violation. * * @returns Whether the next widget can be safely @@ -78,7 +78,7 @@ class titerator : private order, private boost::noncopyable } /** See @ref next. */ - titerator& operator++() + iterator& operator++() { order::next(); return *this; diff --git a/src/gui/auxiliary/iterator/policy_order.hpp b/src/gui/auxiliary/iterator/policy_order.hpp index 54d656f69c16..f2b1953a48fe 100644 --- a/src/gui/auxiliary/iterator/policy_order.hpp +++ b/src/gui/auxiliary/iterator/policy_order.hpp @@ -34,22 +34,22 @@ namespace policy namespace order { -template -class tbottom_up : public tvisit, - public tvisit, - public tvisit +template +class bottom_up : public visit_level, + public visit_level, + public visit_level { - typedef tvisit tvisit_widget; - typedef tvisit tvisit_grid; - typedef tvisit tvisit_child; + typedef visit_level visit_widget; + typedef visit_level visit_grid; + typedef visit_level visit_child; public: - explicit tbottom_up(widget& root) : root_(root.create_walker()), stack_() + explicit bottom_up(widget& root) : root_(root.create_walker()), stack_() { TST_GUI_I << "Constructor: "; - while(!tvisit_child::at_end(*root_)) { + while(!visit_child::at_end(*root_)) { stack_.push_back(root_); - root_ = tvisit_child::get(*root_)->create_walker(); + root_ = visit_child::get(*root_)->create_walker(); TST_GUI_I << " Down widget '" << operator*().id() << "'."; } @@ -60,10 +60,10 @@ class tbottom_up : public tvisit, } } - ~tbottom_up() + ~bottom_up() { delete root_; - for(std::vector::iterator itor = stack_.begin(); + for(std::vector::iterator itor = stack_.begin(); itor != stack_.end(); ++itor) { @@ -73,8 +73,8 @@ class tbottom_up : public tvisit, bool at_end() const { - return tvisit_widget::at_end(*root_) && tvisit_grid::at_end(*root_) - && tvisit_child::at_end(*root_); + return visit_widget::at_end(*root_) && visit_grid::at_end(*root_) + && visit_child::at_end(*root_); } bool next() @@ -82,26 +82,26 @@ class tbottom_up : public tvisit, if(at_end()) { ERR_GUI_I << "Tried to move beyond end of the iteration range." << std::endl; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } TST_GUI_I << "At '" << operator*().id() << "'."; /***** WIDGET *****/ TST_GUI_I << " Iterate widget:"; - if(!tvisit_widget::at_end(*root_)) { - switch(tvisit_widget::next(*root_)) { - case twalker_::valid: + if(!visit_widget::at_end(*root_)) { + switch(visit_widget::next(*root_)) { + case walker_base::valid: TST_GUI_I << " visit '" << operator*().id() << "'.\n"; return true; - case twalker_::invalid: + case walker_base::invalid: TST_GUI_I << " reached the end."; break; - case twalker_::fail: + case walker_base::fail: TST_GUI_I << "\n"; ERR_GUI_E << "Tried to move beyond end of " "the widget iteration range.\n"; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } } else { TST_GUI_I << " failed."; @@ -109,19 +109,19 @@ class tbottom_up : public tvisit, /***** GRID *****/ TST_GUI_I << " Iterate grid:"; - if(!tvisit_grid::at_end(*root_)) { - switch(tvisit_grid::next(*root_)) { - case twalker_::valid: + if(!visit_grid::at_end(*root_)) { + switch(visit_grid::next(*root_)) { + case walker_base::valid: TST_GUI_I << " visit '" << operator*().id() << "'.\n"; return true; - case twalker_::invalid: + case walker_base::invalid: TST_GUI_I << " reached the end."; break; - case twalker_::fail: + case walker_base::fail: TST_GUI_I << "\n"; ERR_GUI_E << "Tried to move beyond end of " "the grid iteration range.\n"; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } } else { TST_GUI_I << " failed."; @@ -130,7 +130,7 @@ class tbottom_up : public tvisit, /***** TRAVERSE CHILDREN *****/ TST_GUI_I << " Iterate child:"; - if(tvisit_child::at_end(*root_)) { + if(visit_child::at_end(*root_)) { if(stack_.empty()) { TST_GUI_I << " Finished iteration.\n"; return false; @@ -143,27 +143,27 @@ class tbottom_up : public tvisit, } } TST_GUI_I << " Iterate child:"; - if(!tvisit_child::at_end(*root_)) { - switch(tvisit_child::next(*root_)) { - case twalker_::valid: + if(!visit_child::at_end(*root_)) { + switch(visit_child::next(*root_)) { + case walker_base::valid: TST_GUI_I << " visit '" << operator*().id() << "'."; break; - case twalker_::invalid: + case walker_base::invalid: TST_GUI_I << " reached the end."; break; - case twalker_::fail: + case walker_base::fail: TST_GUI_I << "\n"; ERR_GUI_E << "Tried to move beyond end of " "the child iteration range.\n"; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } } else { TST_GUI_I << " already at the end."; } - while(!tvisit_child::at_end(*root_)) { + while(!visit_child::at_end(*root_)) { stack_.push_back(root_); - root_ = tvisit_child::get(*root_)->create_walker(); + root_ = visit_child::get(*root_)->create_walker(); TST_GUI_I << " Down widget '" << operator*().id() << "'."; } TST_GUI_I << " Visit '" << operator*().id() << "'.\n"; @@ -175,46 +175,46 @@ class tbottom_up : public tvisit, if(at_end()) { ERR_GUI_I << "Tried to defer beyond end its " "iteration range iterator.\n"; - throw tlogic_error("Tried to defer an invalid iterator."); + throw logic_error("Tried to defer an invalid iterator."); } - if(!tvisit_widget::at_end(*root_)) { - return *tvisit_widget::get(*root_); + if(!visit_widget::at_end(*root_)) { + return *visit_widget::get(*root_); } - if(!tvisit_grid::at_end(*root_)) { - return *tvisit_grid::get(*root_); + if(!visit_grid::at_end(*root_)) { + return *visit_grid::get(*root_); } - if(!tvisit_child::at_end(*root_)) { - return *tvisit_child::get(*root_); + if(!visit_child::at_end(*root_)) { + return *visit_child::get(*root_); } ERR_GUI_I << "The iterator ended in an unknown " "state while deferring itself.\n"; - throw tlogic_error("Tried to defer an invalid iterator."); + throw logic_error("Tried to defer an invalid iterator."); } private: - iterator::twalker_* root_; + iterator::walker_base* root_; - std::vector stack_; + std::vector stack_; }; -template -class ttop_down : public tvisit, - public tvisit, - public tvisit +template +class top_down : public visit_level, + public visit_level, + public visit_level { - typedef tvisit tvisit_widget; - typedef tvisit tvisit_grid; - typedef tvisit tvisit_child; + typedef visit_level visit_widget; + typedef visit_level visit_grid; + typedef visit_level visit_child; public: - explicit ttop_down(widget& root) : root_(root.create_walker()), stack_() + explicit top_down(widget& root) : root_(root.create_walker()), stack_() { } - ~ttop_down() + ~top_down() { delete root_; - for(std::vector::iterator itor = stack_.begin(); + for(std::vector::iterator itor = stack_.begin(); itor != stack_.end(); ++itor) { @@ -224,8 +224,8 @@ class ttop_down : public tvisit, bool at_end() const { - return tvisit_widget::at_end(*root_) && tvisit_grid::at_end(*root_) - && tvisit_child::at_end(*root_); + return visit_widget::at_end(*root_) && visit_grid::at_end(*root_) + && visit_child::at_end(*root_); } bool next() @@ -233,26 +233,26 @@ class ttop_down : public tvisit, if(at_end()) { ERR_GUI_I << "Tried to move beyond end of the iteration range." << std::endl; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } TST_GUI_I << "At '" << operator*().id() << "'."; /***** WIDGET *****/ TST_GUI_I << " Iterate widget:"; - if(!tvisit_widget::at_end(*root_)) { - switch(tvisit_widget::next(*root_)) { - case twalker_::valid: + if(!visit_widget::at_end(*root_)) { + switch(visit_widget::next(*root_)) { + case walker_base::valid: TST_GUI_I << " visit '" << operator*().id() << "'.\n"; return true; - case twalker_::invalid: + case walker_base::invalid: TST_GUI_I << " reached the end."; break; - case twalker_::fail: + case walker_base::fail: TST_GUI_I << "\n"; ERR_GUI_E << "Tried to move beyond end of the " "widget iteration range.\n"; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } } else { TST_GUI_I << " failed."; @@ -260,19 +260,19 @@ class ttop_down : public tvisit, /***** GRID *****/ TST_GUI_I << " Iterate grid:"; - if(!tvisit_grid::at_end(*root_)) { - switch(tvisit_grid::next(*root_)) { - case twalker_::valid: + if(!visit_grid::at_end(*root_)) { + switch(visit_grid::next(*root_)) { + case walker_base::valid: TST_GUI_I << " visit '" << operator*().id() << "'.\n"; return true; - case twalker_::invalid: + case walker_base::invalid: TST_GUI_I << " reached the end."; break; - case twalker_::fail: + case walker_base::fail: TST_GUI_I << "\n"; ERR_GUI_E << "Tried to move beyond end of the grid " "iteration range.\n"; - throw trange_error("Tried to move beyond end of range."); + throw range_error("Tried to move beyond end of range."); } } else { TST_GUI_I << " failed."; @@ -281,16 +281,16 @@ class ttop_down : public tvisit, /***** TRAVERSE CHILDREN *****/ TST_GUI_I << " Iterate child:"; - if(tvisit_child::at_end(*root_)) { + if(visit_child::at_end(*root_)) { TST_GUI_I << " reached the end."; up(); } else { TST_GUI_I << " proceed."; } - if(!tvisit_child::at_end(*root_)) { + if(!visit_child::at_end(*root_)) { stack_.push_back(root_); - root_ = tvisit_child::get(*root_)->create_walker(); + root_ = visit_child::get(*root_)->create_walker(); assert(root_); assert(!at_end()); @@ -307,20 +307,20 @@ class ttop_down : public tvisit, if(at_end()) { ERR_GUI_I << "Tried to defer beyond end of the iteration " "range iterator.\n"; - throw tlogic_error("Tried to defer an invalid iterator."); + throw logic_error("Tried to defer an invalid iterator."); } - if(!tvisit_widget::at_end(*root_)) { - return *tvisit_widget::get(*root_); + if(!visit_widget::at_end(*root_)) { + return *visit_widget::get(*root_); } - if(!tvisit_grid::at_end(*root_)) { - return *tvisit_grid::get(*root_); + if(!visit_grid::at_end(*root_)) { + return *visit_grid::get(*root_); } - if(!tvisit_child::at_end(*root_)) { - return *tvisit_child::get(*root_); + if(!visit_child::at_end(*root_)) { + return *visit_child::get(*root_); } ERR_GUI_I << "The iterator ended in an unknown " "state while deferring iteself.\n"; - throw tlogic_error("Tried to defer an invalid iterator."); + throw logic_error("Tried to defer an invalid iterator."); } private: @@ -332,23 +332,23 @@ class ttop_down : public tvisit, root_ = stack_.back(); stack_.pop_back(); TST_GUI_I << " Up widget '" << operator*().id() << "'. Iterate:"; - switch(tvisit_child::next(*root_)) { - case twalker_::valid: + switch(visit_child::next(*root_)) { + case walker_base::valid: TST_GUI_I << " reached '" << operator*().id() << "'."; return true; - case twalker_::invalid: + case walker_base::invalid: TST_GUI_I << " failed."; break; - case twalker_::fail: - throw trange_error("Tried to move beyond end of range."); + case walker_base::fail: + throw range_error("Tried to move beyond end of range."); } } return true; } - iterator::twalker_* root_; + iterator::walker_base* root_; - std::vector stack_; + std::vector stack_; }; } // namespace order diff --git a/src/gui/auxiliary/iterator/policy_visit.hpp b/src/gui/auxiliary/iterator/policy_visit.hpp index b949e48dfb57..3f64dafc1086 100644 --- a/src/gui/auxiliary/iterator/policy_visit.hpp +++ b/src/gui/auxiliary/iterator/policy_visit.hpp @@ -34,29 +34,29 @@ namespace visit /** * This policy skips the current level. */ -class tskip +class skip_level { public: /** - * Acts like @ref twalker_::next for the level where the policy is used. + * Acts like @ref walker_base::next for the level where the policy is used. */ - twalker_::state_t next(twalker_&) + walker_base::state_t next(walker_base&) { - return twalker_::fail; + return walker_base::fail; } /** - * Acts like @ref twalker_::at_end for the level where the policy is used. + * Acts like @ref walker_base::at_end for the level where the policy is used. */ - bool at_end(const twalker_&) const + bool at_end(const walker_base&) const { return true; } /** - * Acts like @ref twalker_::get for the level where the policy is used. + * Acts like @ref walker_base::get for the level where the policy is used. */ - gui2::widget* get(twalker_&) + gui2::widget* get(walker_base&) { return nullptr; } @@ -67,30 +67,30 @@ class tskip * * @tparam level The level to visit. */ -template -class tvisit +template +class visit_level { public: /** - * Acts like @ref twalker_::next for the level where the policy is used. + * Acts like @ref walker_base::next for the level where the policy is used. */ - twalker_::state_t next(twalker_& visitor) + walker_base::state_t next(walker_base& visitor) { return visitor.next(level); } /** - * Acts like @ref twalker_::at_end for the level where the policy is used. + * Acts like @ref walker_base::at_end for the level where the policy is used. */ - bool at_end(const twalker_& visitor) const + bool at_end(const walker_base& visitor) const { return visitor.at_end(level); } /** - * Acts like @ref twalker_::get for the level where the policy is used. + * Acts like @ref walker_base::get for the level where the policy is used. */ - gui2::widget* get(twalker_& visitor) + gui2::widget* get(walker_base& visitor) { return visitor.get(level); } @@ -103,20 +103,20 @@ class tvisit * * @tparam level The level to determine the policy for. */ -template -class tvisit +template +class visit_level { }; -/** Specialized to select the @ref visit::tskip policy. */ -template -class tvisit : public visit::tskip +/** Specialized to select the @ref visit::skip_level policy. */ +template +class visit_level : public visit::skip_level { }; -/** Specialized to select the @ref visit::tvisit policy. */ -template -class tvisit : public visit::tvisit +/** Specialized to select the @ref visit::visit_level policy. */ +template +class visit_level : public visit::visit_level { }; diff --git a/src/gui/auxiliary/iterator/walker.hpp b/src/gui/auxiliary/iterator/walker.hpp index efedc87326a8..c0df3c70a13a 100644 --- a/src/gui/auxiliary/iterator/walker.hpp +++ b/src/gui/auxiliary/iterator/walker.hpp @@ -24,15 +24,15 @@ namespace iterator { /** The walker abstract base class. */ -class twalker_ +class walker_base { public: - virtual ~twalker_() + virtual ~walker_base() { } /** The level to walk at. */ - enum tlevel { + enum level { /** Visit the widget itself. */ self, /** Visit its nested grid. */ @@ -87,7 +87,7 @@ class twalker_ * * @returns The status of the operation. */ - virtual state_t next(const tlevel level) = 0; + virtual state_t next(const level level) = 0; /** * Returns whether the current widget is valid. @@ -98,7 +98,7 @@ class twalker_ * * @returns Whether the current widget is valid. */ - virtual bool at_end(const tlevel level) const = 0; + virtual bool at_end(const level level) const = 0; /** * Returns a pointer to the current widget. @@ -111,7 +111,7 @@ class twalker_ * * @returns Pointer to the current widget. */ - virtual gui2::widget* get(const tlevel level) = 0; + virtual gui2::widget* get(const level level) = 0; }; } // namespace iterator diff --git a/src/gui/auxiliary/iterator/walker_grid.cpp b/src/gui/auxiliary/iterator/walker_grid.cpp index d165d3dd5e8b..887aeeb0a786 100644 --- a/src/gui/auxiliary/iterator/walker_grid.cpp +++ b/src/gui/auxiliary/iterator/walker_grid.cpp @@ -29,7 +29,7 @@ grid::grid(gui2::grid& grid) { } -twalker_::state_t grid::next(const tlevel level) +walker_base::state_t grid::next(const level level) { if(at_end(level)) { return fail; @@ -59,7 +59,7 @@ twalker_::state_t grid::next(const tlevel level) return fail; } -bool grid::at_end(const tlevel level) const +bool grid::at_end(const level level) const { switch(level) { case self: @@ -74,7 +74,7 @@ bool grid::at_end(const tlevel level) const return true; } -gui2::widget* grid::get(const tlevel level) +gui2::widget* grid::get(const level level) { switch(level) { case self: diff --git a/src/gui/auxiliary/iterator/walker_grid.hpp b/src/gui/auxiliary/iterator/walker_grid.hpp index 871d5b4c6e90..9ce6b7b9b11b 100644 --- a/src/gui/auxiliary/iterator/walker_grid.hpp +++ b/src/gui/auxiliary/iterator/walker_grid.hpp @@ -26,7 +26,7 @@ namespace iterator { /** A walker for a @ref gui2::grid. */ -class grid : public twalker_ +class grid : public walker_base { public: /** @@ -36,14 +36,14 @@ class grid : public twalker_ */ explicit grid(gui2::grid& grid); - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual state_t next(const tlevel level); + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual state_t next(const level level); - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual bool at_end(const tlevel level) const; + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual bool at_end(const level level) const; - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual gui2::widget* get(const tlevel level); + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual gui2::widget* get(const level level); private: /** The grid which the walker is attached to. */ @@ -53,7 +53,7 @@ class grid : public twalker_ * The grid which the walker is attached to. * * This variable is used to track whether the @ref - * gui2::iterator::twalker_::widget level has been visited. + * gui2::iterator::walker_base::widget level has been visited. */ gui2::widget* widget_; @@ -61,7 +61,7 @@ class grid : public twalker_ * The iterator to the children of @ref grid_. * * This variable is used to track where the @ref - * gui2::iterator::twalker_::child level visiting is. + * gui2::iterator::walker_base::child level visiting is. */ gui2::grid::iterator itor_; }; diff --git a/src/gui/auxiliary/iterator/walker_tree_node.cpp b/src/gui/auxiliary/iterator/walker_tree_node.cpp index 6cac0ce04702..7ab0c0812f5f 100644 --- a/src/gui/auxiliary/iterator/walker_tree_node.cpp +++ b/src/gui/auxiliary/iterator/walker_tree_node.cpp @@ -30,7 +30,7 @@ tree_node::tree_node(gui2::tree_view_node& node, boost::ptr_vector& children); - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual state_t next(const tlevel level); + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual state_t next(const level level); - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual bool at_end(const tlevel level) const; + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual bool at_end(const level level) const; - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual gui2::widget* get(const tlevel level); + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual gui2::widget* get(const level level); private: /** The children of the node which the walker is attached to. */ @@ -56,7 +56,7 @@ class tree_node : public twalker_ * The node which the walker is attached to. * * This variable is used to track whether the @ref - * gui2::iterator::twalker_::widget level has been visited. + * gui2::iterator::walker_base::widget level has been visited. */ gui2::widget* widget_; @@ -64,7 +64,7 @@ class tree_node : public twalker_ * The iterator to the children of @ref node_. * * This variable is used to track where the @ref - * gui2::iterator::twalker_::child level visiting is. + * gui2::iterator::walker_base::child level visiting is. */ boost::ptr_vector::iterator itor_; }; diff --git a/src/gui/auxiliary/iterator/walker_widget.cpp b/src/gui/auxiliary/iterator/walker_widget.cpp index 8ca9711b4744..58f1d436a438 100644 --- a/src/gui/auxiliary/iterator/walker_widget.cpp +++ b/src/gui/auxiliary/iterator/walker_widget.cpp @@ -32,7 +32,7 @@ widget::widget(gui2::widget& widget) : widget_(&widget) { } -twalker_::state_t widget::next(const tlevel level) +walker_base::state_t widget::next(const level level) { if(at_end(level)) { return fail; @@ -55,7 +55,7 @@ twalker_::state_t widget::next(const tlevel level) return fail; } -bool widget::at_end(const tlevel level) const +bool widget::at_end(const level level) const { switch(level) { case self: @@ -69,7 +69,7 @@ bool widget::at_end(const tlevel level) const return true; } -gui2::widget* widget::get(const tlevel level) +gui2::widget* widget::get(const level level) { switch(level) { case self: diff --git a/src/gui/auxiliary/iterator/walker_widget.hpp b/src/gui/auxiliary/iterator/walker_widget.hpp index a87fbdc132c9..aa5cec927a09 100644 --- a/src/gui/auxiliary/iterator/walker_widget.hpp +++ b/src/gui/auxiliary/iterator/walker_widget.hpp @@ -27,7 +27,7 @@ namespace walker { /** A walker for a @ref gui2::control. */ -class widget : public twalker_ +class widget : public walker_base { public: /** @@ -37,14 +37,14 @@ class widget : public twalker_ */ explicit widget(gui2::widget& widget); - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual state_t next(const tlevel level); + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual state_t next(const level level); - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual bool at_end(const tlevel level) const; + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual bool at_end(const level level) const; - /** Inherited from @ref gui2::iterator::twalker_. */ - virtual gui2::widget* get(const tlevel level); + /** Inherited from @ref gui2::iterator::walker_base. */ + virtual gui2::widget* get(const level level); private: /** The control which the walker is attached to. */ diff --git a/src/gui/auxiliary/old_markup.cpp b/src/gui/auxiliary/old_markup.cpp index d7b879e45910..9d76f034ce2e 100644 --- a/src/gui/auxiliary/old_markup.cpp +++ b/src/gui/auxiliary/old_markup.cpp @@ -17,7 +17,7 @@ namespace gui2 { -tlegacy_menu_item::tlegacy_menu_item(const std::string& str) +legacy_menu_item::legacy_menu_item(const std::string& str) : icon_(), label_(str), desc_(), default_(false) { if(label_.empty()) { diff --git a/src/gui/auxiliary/old_markup.hpp b/src/gui/auxiliary/old_markup.hpp index e77945cfae5b..9de0c8a9e68f 100644 --- a/src/gui/auxiliary/old_markup.hpp +++ b/src/gui/auxiliary/old_markup.hpp @@ -23,7 +23,7 @@ namespace gui2 /** * Implements simple parsing of legacy GUI1 item markup. */ -class tlegacy_menu_item +class legacy_menu_item { /* * Legacy options/menu items have some special markup: @@ -40,7 +40,7 @@ class tlegacy_menu_item * with special meanings for certain characters. */ public: - explicit tlegacy_menu_item(const std::string& str = std::string()); + explicit legacy_menu_item(const std::string& str = std::string()); const std::string& icon() const { @@ -62,7 +62,7 @@ class tlegacy_menu_item return default_; } - tlegacy_menu_item& operator=(const tlegacy_menu_item& rhs) + legacy_menu_item& operator=(const legacy_menu_item& rhs) { if(&rhs != this) { icon_ = rhs.icon_; diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index 175af6524d5b..097011647ec1 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -221,7 +221,7 @@ class line_shape : public canvas::shape const game_logic::map_formula_callable& variables); private: - tformula x1_, /**< The start x coordinate of the line. */ + typed_formula x1_, /**< The start x coordinate of the line. */ y1_, /**< The start y coordinate of the line. */ x2_, /**< The end x coordinate of the line. */ y2_, /**< The end y coordinate of the line. */ @@ -628,7 +628,7 @@ class rectangle_shape : public canvas::shape const game_logic::map_formula_callable& variables); private: - tformula x_, /**< The x coordinate of the rectangle. */ + typed_formula x_, /**< The x coordinate of the rectangle. */ y_, /**< The y coordinate of the rectangle. */ w_, /**< The width of the rectangle. */ h_; /**< The height of the rectangle. */ @@ -782,7 +782,7 @@ class circle_shape : public canvas::shape const game_logic::map_formula_callable& variables); private: - tformula x_, /**< The center x coordinate of the circle. */ + typed_formula x_, /**< The center x coordinate of the circle. */ y_, /**< The center y coordinate of the circle. */ radius_; /**< The radius of the circle. */ @@ -895,7 +895,7 @@ class image_shape : public canvas::shape const game_logic::map_formula_callable& variables); private: - tformula x_, /**< The x coordinate of the image. */ + typed_formula x_, /**< The x coordinate of the image. */ y_, /**< The y coordinate of the image. */ w_, /**< The width of the image. */ h_; /**< The height of the image. */ @@ -915,7 +915,7 @@ class image_shape : public canvas::shape * formula the image will be loaded in the constructor. If it's a formula it * will be loaded every draw cycles. This allows 'changing' images. */ - tformula image_name_; + typed_formula image_name_; /** * Determines the way an image will be resized. @@ -936,7 +936,7 @@ class image_shape : public canvas::shape resize_mode resize_mode_; /** Mirror the image over the vertical axis. */ - tformula vertical_mirror_; + typed_formula vertical_mirror_; }; /*WIKI @@ -1192,7 +1192,7 @@ class text_shape : public canvas::shape const game_logic::map_formula_callable& variables); private: - tformula x_, /**< The x coordinate of the text. */ + typed_formula x_, /**< The x coordinate of the text. */ y_, /**< The y coordinate of the text. */ w_, /**< The width of the text. */ h_; /**< The height of the text. */ @@ -1207,31 +1207,31 @@ class text_shape : public canvas::shape font::pango_text::FONT_STYLE font_style_; /** The alignment of the text. */ - tformula text_alignment_; + typed_formula text_alignment_; /** The color of the text. */ Uint32 color_; /** The text to draw. */ - tformula text_; + typed_formula text_; /** The text markup switch of the text. */ - tformula text_markup_; + typed_formula text_markup_; /** The link aware switch of the text. */ - tformula link_aware_; + typed_formula link_aware_; /** The link color of the text. */ - tformula link_color_; + typed_formula link_color_; /** The maximum width for the text. */ - tformula maximum_width_; + typed_formula maximum_width_; /** The number of characters per line. */ unsigned characters_per_line_; /** The maximum height for the text. */ - tformula maximum_height_; + typed_formula maximum_height_; }; /*WIKI diff --git a/src/gui/core/window_builder.hpp b/src/gui/core/window_builder.hpp index 71d1f937619a..01f8201cd8d6 100644 --- a/src/gui/core/window_builder.hpp +++ b/src/gui/core/window_builder.hpp @@ -167,11 +167,11 @@ class builder_window bool automatic_placement; - tformula x; - tformula y; - tformula width; - tformula height; - tformula reevaluate_best_size; + typed_formula x; + typed_formula y; + typed_formula width; + typed_formula height; + typed_formula reevaluate_best_size; game_logic::function_symbol_table functions; diff --git a/src/gui/dialogs/addon/filter_options.cpp b/src/gui/dialogs/addon/filter_options.cpp index 47c4bebf443e..eaf4362016b7 100644 --- a/src/gui/dialogs/addon/filter_options.cpp +++ b/src/gui/dialogs/addon/filter_options.cpp @@ -35,7 +35,7 @@ namespace { bool unchecked_bool_field_finder(gui2::window& window, - gui2::tfield_bool* bool_field) + gui2::field_bool* bool_field) { return bool_field->get_widget_value(window) == false; } diff --git a/src/gui/dialogs/addon/filter_options.hpp b/src/gui/dialogs/addon/filter_options.hpp index a4c88f5a18dc..840c4141b57e 100644 --- a/src/gui/dialogs/addon/filter_options.hpp +++ b/src/gui/dialogs/addon/filter_options.hpp @@ -77,7 +77,7 @@ class taddon_filter_options : public tdialog private: ADDON_STATUS_FILTER displayed_status_; std::array displayed_types_; - std::vector displayed_types_fields_; + std::vector displayed_types_fields_; ADDON_SORT sort_; ADDON_SORT_DIRECTION dir_; diff --git a/src/gui/dialogs/campaign_difficulty.cpp b/src/gui/dialogs/campaign_difficulty.cpp index 6c2dac21854d..3d458a840f9d 100644 --- a/src/gui/dialogs/campaign_difficulty.cpp +++ b/src/gui/dialogs/campaign_difficulty.cpp @@ -93,7 +93,7 @@ config generate_difficulty_config(const config& source) for(std::size_t i = 0; i < difficulty_opts.size(); i++) { config temp; - gui2::tlegacy_menu_item parsed(difficulty_opts[i]); + gui2::legacy_menu_item parsed(difficulty_opts[i]); temp["define"] = difficulty_list[i]; temp["image"] = parsed.icon(); diff --git a/src/gui/dialogs/dialog.cpp b/src/gui/dialogs/dialog.cpp index 2b6d625da31a..24ed33abb81f 100644 --- a/src/gui/dialogs/dialog.cpp +++ b/src/gui/dialogs/dialog.cpp @@ -93,7 +93,7 @@ bool tdialog::show(CVideo& video, const unsigned auto_close_time) return retval_ == window::OK; } -tfield_bool* tdialog::register_bool( +field_bool* tdialog::register_bool( const std::string& id, const bool mandatory, const std::function callback_load_value, @@ -101,7 +101,7 @@ tfield_bool* tdialog::register_bool( const std::function callback_change, const bool initial_fire) { - tfield_bool* field = new tfield_bool(id, + field_bool* field = new field_bool(id, mandatory, callback_load_value, callback_save_value, @@ -112,51 +112,51 @@ tfield_bool* tdialog::register_bool( return field; } -tfield_bool* +field_bool* tdialog::register_bool(const std::string& id, const bool mandatory, bool& linked_variable, const std::function callback_change, const bool initial_fire) { - tfield_bool* field - = new tfield_bool(id, mandatory, linked_variable, callback_change, initial_fire); + field_bool* field + = new field_bool(id, mandatory, linked_variable, callback_change, initial_fire); fields_.push_back(field); return field; } -tfield_integer* tdialog::register_integer( +field_integer* tdialog::register_integer( const std::string& id, const bool mandatory, const std::function callback_load_value, const std::function callback_save_value) { - tfield_integer* field = new tfield_integer( + field_integer* field = new field_integer( id, mandatory, callback_load_value, callback_save_value); fields_.push_back(field); return field; } -tfield_integer* tdialog::register_integer(const std::string& id, +field_integer* tdialog::register_integer(const std::string& id, const bool mandatory, int& linked_variable) { - tfield_integer* field = new tfield_integer(id, mandatory, linked_variable); + field_integer* field = new field_integer(id, mandatory, linked_variable); fields_.push_back(field); return field; } -tfield_text* tdialog::register_text( +field_text* tdialog::register_text( const std::string& id, const bool mandatory, const std::function callback_load_value, const std::function callback_save_value, const bool capture_focus) { - tfield_text* field = new tfield_text( + field_text* field = new field_text( id, mandatory, callback_load_value, callback_save_value); if(capture_focus) { @@ -167,12 +167,12 @@ tfield_text* tdialog::register_text( return field; } -tfield_text* tdialog::register_text(const std::string& id, +field_text* tdialog::register_text(const std::string& id, const bool mandatory, std::string& linked_variable, const bool capture_focus) { - tfield_text* field = new tfield_text(id, mandatory, linked_variable); + field_text* field = new field_text(id, mandatory, linked_variable); if(capture_focus) { focus_ = id; @@ -182,12 +182,12 @@ tfield_text* tdialog::register_text(const std::string& id, return field; } -tfield_label* tdialog::register_label(const std::string& id, +field_label* tdialog::register_label(const std::string& id, const bool mandatory, const std::string& text, const bool use_markup) { - tfield_label* field = new tfield_label(id, mandatory, text, use_markup); + field_label* field = new field_label(id, mandatory, text, use_markup); fields_.push_back(field); return field; diff --git a/src/gui/dialogs/dialog.hpp b/src/gui/dialogs/dialog.hpp index 88520ec149e2..b0ee3c51a5d2 100644 --- a/src/gui/dialogs/dialog.hpp +++ b/src/gui/dialogs/dialog.hpp @@ -205,7 +205,7 @@ class tdialog * * @returns Pointer to the created widget. */ - tfield_bool* + field_bool* register_bool(const std::string& id, const bool mandatory, const std::function callback_load_value = nullptr, @@ -222,13 +222,13 @@ class tdialog * @param id Id of the widget, same value as in WML. * @param mandatory Is the widget mandatory or mandatory. * @param linked_variable The variable the widget is linked to. See - * @ref tfield::tfield for more information. + * @ref field::field for more information. * @param callback_change When the value of the widget changes this * callback is called. * * @returns Pointer to the created widget. */ - tfield_bool* + field_bool* register_bool(const std::string& id, const bool mandatory, bool& linked_variable, @@ -240,7 +240,7 @@ class tdialog * * See @ref register_bool for more info. */ - tfield_integer* + field_integer* register_integer(const std::string& id, const bool mandatory, const std::function callback_load_value = nullptr, @@ -251,7 +251,7 @@ class tdialog * * See @ref register_bool for more info. */ - tfield_integer* register_integer(const std::string& id, + field_integer* register_integer(const std::string& id, const bool mandatory, int& linked_variable); /** @@ -259,7 +259,7 @@ class tdialog * * See @ref register_bool for more info. */ - tfield_text* register_text( + field_text* register_text( const std::string& id, const bool mandatory, const std::function callback_load_value = nullptr, @@ -271,7 +271,7 @@ class tdialog * * See @ref register_bool for more info. */ - tfield_text* register_text(const std::string& id, + field_text* register_text(const std::string& id, const bool mandatory, std::string& linked_variable, const bool capture_focus = false); @@ -293,13 +293,13 @@ class tdialog * @param text The text for the label. * @param use_markup Whether or not use markup for the label. */ - tfield_label* register_label(const std::string& id, + field_label* register_label(const std::string& id, const bool mandatory, const std::string& text, const bool use_markup = false); /** Registers a new control as image. */ - tfield_label* register_image(const std::string& id, + field_label* register_image(const std::string& id, const bool mandatory, const std::string& filename) { @@ -327,7 +327,7 @@ class tdialog * functions defined we don't offer access to the vector. If access is * needed the creator should store a copy of the pointer. */ - std::vector fields_; + std::vector fields_; /** * Contains the widget that should get the focus when the window is shown. diff --git a/src/gui/dialogs/editor/custom_tod.hpp b/src/gui/dialogs/editor/custom_tod.hpp index 0456d9b9d0d3..6e46afacd53f 100644 --- a/src/gui/dialogs/editor/custom_tod.hpp +++ b/src/gui/dialogs/editor/custom_tod.hpp @@ -98,7 +98,7 @@ class tcustom_tod : public tdialog label* current_tod_sound_; label* current_tod_number_; - tfield_integer* lawful_bonus_field_; + field_integer* lawful_bonus_field_; slider* tod_red_field_; slider* tod_green_field_; slider* tod_blue_field_; diff --git a/src/gui/dialogs/editor/generator_settings.cpp b/src/gui/dialogs/editor/generator_settings.cpp index 0c966b6aedf5..721cce634e78 100644 --- a/src/gui/dialogs/editor/generator_settings.cpp +++ b/src/gui/dialogs/editor/generator_settings.cpp @@ -72,7 +72,7 @@ void tgenerator_settings::adjust_minimum_size_by_players(window& window) { const int extra_size = (players_->get_widget_value(window) - 2) * extra_size_per_player; - const auto update_dimension_slider = [&](tfield_integer* field) { + const auto update_dimension_slider = [&](field_integer* field) { slider& w = dynamic_cast(*field->get_widget()); w.set_minimum_value(min_size + extra_size); }; diff --git a/src/gui/dialogs/editor/generator_settings.hpp b/src/gui/dialogs/editor/generator_settings.hpp index c1d2a0c88200..9e62f16aafe8 100644 --- a/src/gui/dialogs/editor/generator_settings.hpp +++ b/src/gui/dialogs/editor/generator_settings.hpp @@ -43,9 +43,9 @@ class tgenerator_settings : public tdialog virtual const std::string& window_id() const; /** We need to own these fields to access the underlying widget */ - tfield_integer* players_; - tfield_integer* width_; - tfield_integer* height_; + field_integer* players_; + field_integer* width_; + field_integer* height_; std::function update_width_label_, update_height_label_; }; diff --git a/src/gui/dialogs/editor/resize_map.hpp b/src/gui/dialogs/editor/resize_map.hpp index 817366f07643..a4b197747087 100644 --- a/src/gui/dialogs/editor/resize_map.hpp +++ b/src/gui/dialogs/editor/resize_map.hpp @@ -84,10 +84,10 @@ class teditor_resize_map : public tdialog private: /** The currently selected width. */ - tfield_integer* width_; + field_integer* width_; /** The currently selected height. */ - tfield_integer* height_; + field_integer* height_; /** The original width. */ int old_width_; diff --git a/src/gui/dialogs/game_load.hpp b/src/gui/dialogs/game_load.hpp index e5e8d0783ffd..a504845a1b71 100644 --- a/src/gui/dialogs/game_load.hpp +++ b/src/gui/dialogs/game_load.hpp @@ -58,9 +58,9 @@ class tgame_load : public tdialog std::string& filename_; - tfield_bool* change_difficulty_; - tfield_bool* show_replay_; - tfield_bool* cancel_orders_; + field_bool* change_difficulty_; + field_bool* show_replay_; + field_bool* cancel_orders_; config& summary_; diff --git a/src/gui/dialogs/multiplayer/mp_connect.cpp b/src/gui/dialogs/multiplayer/mp_connect.cpp index cd254787b3e3..0900e3f6768a 100644 --- a/src/gui/dialogs/multiplayer/mp_connect.cpp +++ b/src/gui/dialogs/multiplayer/mp_connect.cpp @@ -150,7 +150,7 @@ void tmp_server_list::post_show(window& window) REGISTER_DIALOG(mp_connect) static void -show_server_list(CVideo& video, window& window, tfield_text* host_name) +show_server_list(CVideo& video, window& window, field_text* host_name) { assert(host_name); diff --git a/src/gui/dialogs/multiplayer/mp_connect.hpp b/src/gui/dialogs/multiplayer/mp_connect.hpp index f779897b4a80..49309b49c719 100644 --- a/src/gui/dialogs/multiplayer/mp_connect.hpp +++ b/src/gui/dialogs/multiplayer/mp_connect.hpp @@ -36,7 +36,7 @@ class tmp_connect : public tdialog void pre_show(window& window); /** The host name of the selected servef. */ - tfield_text* host_name_; + field_text* host_name_; /** * The unit test needs to be able to test the tmp_connect dialog. diff --git a/src/gui/dialogs/multiplayer/mp_create_game.cpp b/src/gui/dialogs/multiplayer/mp_create_game.cpp index cdb8ec0031ba..661309d3efc0 100644 --- a/src/gui/dialogs/multiplayer/mp_create_game.cpp +++ b/src/gui/dialogs/multiplayer/mp_create_game.cpp @@ -821,7 +821,7 @@ void tmp_create_game::post_show(window& window) config_engine_->set_random_faction_mode(rfm_types_[selected_rfm_index_]); - // Since we don't have a tfield handling this option, we need to save the value manually + // Since we don't have a field handling this option, we need to save the value manually prefs::set_random_faction_mode(mp_game_settings::RANDOM_FACTION_MODE::enum_to_string(rfm_types_[selected_rfm_index_])); // Save custom option settings diff --git a/src/gui/dialogs/multiplayer/mp_create_game.hpp b/src/gui/dialogs/multiplayer/mp_create_game.hpp index 60848e77edd2..52058a027c30 100644 --- a/src/gui/dialogs/multiplayer/mp_create_game.hpp +++ b/src/gui/dialogs/multiplayer/mp_create_game.hpp @@ -62,7 +62,7 @@ class tmp_create_game : public tdialog, private plugin_executor std::vector level_types_; /* We keep and work with a vector of the RFM types since it's the easiest way to get a value for the - * config_engine and preferences setters, since menu_buttons aren't supported by tfield. Even if they + * config_engine and preferences setters, since menu_buttons aren't supported by field. Even if they * were, the above functions take a RANDOM_FACTION_MODE value, not an index. Even if we try to keep a * copy of the selected RFM type index in a int value and update it every time you perform a selection, * there's still the problem of getting an initial value from preferences, which again is provided as a @@ -87,24 +87,24 @@ class tmp_create_game : public tdialog, private plugin_executor * manually controlled as well so add the pointers here as well. */ - tfield_bool* use_map_settings_; - tfield_bool* fog_; - tfield_bool* shroud_; - tfield_bool* start_time_; - tfield_bool* time_limit_; - tfield_bool* shuffle_sides_; - tfield_bool* observers_; - tfield_bool* registered_users_; - tfield_bool* strict_sync_; - - tfield_integer* turns_; - tfield_integer* gold_; - tfield_integer* support_; - tfield_integer* experience_; - tfield_integer* init_turn_limit_; - tfield_integer* turn_bonus_; - tfield_integer* reservoir_; - tfield_integer* action_bonus_; + field_bool* use_map_settings_; + field_bool* fog_; + field_bool* shroud_; + field_bool* start_time_; + field_bool* time_limit_; + field_bool* shuffle_sides_; + field_bool* observers_; + field_bool* registered_users_; + field_bool* strict_sync_; + + field_integer* turns_; + field_integer* gold_; + field_integer* support_; + field_integer* experience_; + field_integer* init_turn_limit_; + field_integer* turn_bonus_; + field_integer* reservoir_; + field_integer* action_bonus_; template void on_filter_change(window& window, const std::string& id); diff --git a/src/gui/dialogs/select_orb_colors.cpp b/src/gui/dialogs/select_orb_colors.cpp index da92d6b3f38e..2ae00701dbf3 100644 --- a/src/gui/dialogs/select_orb_colors.cpp +++ b/src/gui/dialogs/select_orb_colors.cpp @@ -89,15 +89,15 @@ void tselect_orb_colors::setup_orb_group(const std::string& base_id, bool& shown grid& selection = find_widget(&window, prefix + "selection", false); group& group = groups_[base_id]; - using iterator::twalker_; - twalker_* iter = selection.create_walker(); - while(!iter->at_end(twalker_::child)) { - widget* next = iter->get(twalker_::child); + using iterator::walker_base; + walker_base* iter = selection.create_walker(); + while(!iter->at_end(walker_base::child)) { + widget* next = iter->get(walker_base::child); if(toggle_button* button = dynamic_cast(next)) { const std::string& id = button->id(); group.add_member(button, id.substr(prefix.size())); } - iter->next(twalker_::child); + iter->next(walker_base::child); } group.set_member_states(initial); } diff --git a/src/gui/widgets/container.hpp b/src/gui/widgets/container.hpp index ed87e4246d36..33612f3a3f5c 100644 --- a/src/gui/widgets/container.hpp +++ b/src/gui/widgets/container.hpp @@ -148,7 +148,7 @@ class container_base : public control * * @todo Implement properly. */ - virtual iterator::twalker_* create_walker() override + virtual iterator::walker_base* create_walker() override { return nullptr; } diff --git a/src/gui/widgets/control.cpp b/src/gui/widgets/control.cpp index 3cd4b231424c..7e0e2626d08f 100644 --- a/src/gui/widgets/control.cpp +++ b/src/gui/widgets/control.cpp @@ -140,7 +140,7 @@ bool control::disable_click_dismiss() const return get_visible() == widget::tvisible::visible && get_active(); } -iterator::twalker_* control::create_walker() +iterator::walker_base* control::create_walker() { return new iterator::walker::widget(*this); } diff --git a/src/gui/widgets/control.hpp b/src/gui/widgets/control.hpp index 9a136f4377e9..81250451052e 100644 --- a/src/gui/widgets/control.hpp +++ b/src/gui/widgets/control.hpp @@ -100,7 +100,7 @@ class control : public widget bool disable_click_dismiss() const override; /** See @ref widget::create_walker. */ - virtual iterator::twalker_* create_walker() override; + virtual iterator::walker_base* create_walker() override; /***** ***** ***** ***** layout functions ***** ***** ***** *****/ diff --git a/src/gui/widgets/drawing.hpp b/src/gui/widgets/drawing.hpp index ef7498b9c370..da3fcffa1a90 100644 --- a/src/gui/widgets/drawing.hpp +++ b/src/gui/widgets/drawing.hpp @@ -111,10 +111,10 @@ struct builder_drawing : public builder_control widget* build() const; /** The width of the widget. */ - tformula width; + typed_formula width; /** The height of the widget. */ - tformula height; + typed_formula height; /** Config containing what to draw on the widgets canvas. */ config draw; diff --git a/src/gui/widgets/generator_private.hpp b/src/gui/widgets/generator_private.hpp index d2b9455b45f2..60768905e2b1 100644 --- a/src/gui/widgets/generator_private.hpp +++ b/src/gui/widgets/generator_private.hpp @@ -907,7 +907,7 @@ class generator : public minimum_selection, * * @todo Implement properly. */ - virtual iterator::twalker_* create_walker() override + virtual iterator::walker_base* create_walker() override { return nullptr; } diff --git a/src/gui/widgets/grid.cpp b/src/gui/widgets/grid.cpp index 7401d056d3f6..493430de00ab 100644 --- a/src/gui/widgets/grid.cpp +++ b/src/gui/widgets/grid.cpp @@ -661,7 +661,7 @@ bool grid::disable_click_dismiss() const return false; } -iterator::twalker_* grid::create_walker() +iterator::walker_base* grid::create_walker() { return new gui2::iterator::grid(*this); } diff --git a/src/gui/widgets/grid.hpp b/src/gui/widgets/grid.hpp index b97e709787a0..2354b0b61dd1 100644 --- a/src/gui/widgets/grid.hpp +++ b/src/gui/widgets/grid.hpp @@ -280,7 +280,7 @@ class grid : public widget bool disable_click_dismiss() const override; /** See @ref widget::create_walker. */ - virtual iterator::twalker_* create_walker() override; + virtual iterator::walker_base* create_walker() override; /***** ***** ***** setters / getters for members ***** ****** *****/ diff --git a/src/gui/widgets/matrix.cpp b/src/gui/widgets/matrix.cpp index bee9b27b56c0..f074b9ff9922 100644 --- a/src/gui/widgets/matrix.cpp +++ b/src/gui/widgets/matrix.cpp @@ -177,7 +177,7 @@ bool matrix::disable_click_dismiss() const return false; } -iterator::twalker_* matrix::create_walker() +iterator::walker_base* matrix::create_walker() { /** * @todo Implement properly. diff --git a/src/gui/widgets/matrix.hpp b/src/gui/widgets/matrix.hpp index afe503287f29..956ce490a380 100644 --- a/src/gui/widgets/matrix.hpp +++ b/src/gui/widgets/matrix.hpp @@ -189,7 +189,7 @@ class matrix : public tbase bool disable_click_dismiss() const override; /** See @ref widget::create_walker. */ - virtual iterator::twalker_* create_walker() override; + virtual iterator::walker_base* create_walker() override; /** * Returns a grid in the pane. diff --git a/src/gui/widgets/pane.cpp b/src/gui/widgets/pane.cpp index bb85771b0735..ad7eb452df1a 100644 --- a/src/gui/widgets/pane.cpp +++ b/src/gui/widgets/pane.cpp @@ -257,7 +257,7 @@ bool pane::disable_click_dismiss() const return false; } -iterator::twalker_* pane::create_walker() +iterator::walker_base* pane::create_walker() { /** * @todo Implement properly. diff --git a/src/gui/widgets/pane.hpp b/src/gui/widgets/pane.hpp index ff6e7974d27e..9054fbd215a8 100644 --- a/src/gui/widgets/pane.hpp +++ b/src/gui/widgets/pane.hpp @@ -124,7 +124,7 @@ class pane : public widget bool disable_click_dismiss() const override; /** See @ref widget::create_walker. */ - virtual iterator::twalker_* create_walker() override; + virtual iterator::walker_base* create_walker() override; /** * Returns a grid in the pane. diff --git a/src/gui/widgets/spacer.hpp b/src/gui/widgets/spacer.hpp index 48510751513f..06511bcbccc1 100644 --- a/src/gui/widgets/spacer.hpp +++ b/src/gui/widgets/spacer.hpp @@ -109,8 +109,8 @@ struct builder_spacer : public builder_control widget* build() const; private: - tformula width_; - tformula height_; + typed_formula width_; + typed_formula height_; }; } // namespace implementation diff --git a/src/gui/widgets/text_box.hpp b/src/gui/widgets/text_box.hpp index f4c2280c78e3..64bb5f6b6205 100644 --- a/src/gui/widgets/text_box.hpp +++ b/src/gui/widgets/text_box.hpp @@ -288,8 +288,8 @@ struct text_box_definition : public control_definition { explicit tresolution(const config& cfg); - tformula text_x_offset; - tformula text_y_offset; + typed_formula text_x_offset; + typed_formula text_y_offset; }; }; diff --git a/src/gui/widgets/tree_view_node.hpp b/src/gui/widgets/tree_view_node.hpp index 95c9d265caf4..923d2d4723fb 100644 --- a/src/gui/widgets/tree_view_node.hpp +++ b/src/gui/widgets/tree_view_node.hpp @@ -143,7 +143,7 @@ class tree_view_node : public widget * * @todo Implement properly. */ - virtual iterator::twalker_* create_walker() override + virtual iterator::walker_base* create_walker() override { return new gui2::iterator::tree_node(*this, children_); } diff --git a/src/gui/widgets/viewport.cpp b/src/gui/widgets/viewport.cpp index a3c7bf66df25..3e27529498fc 100644 --- a/src/gui/widgets/viewport.cpp +++ b/src/gui/widgets/viewport.cpp @@ -178,7 +178,7 @@ bool viewport::disable_click_dismiss() const return false; } -iterator::twalker_* viewport::create_walker() +iterator::walker_base* viewport::create_walker() { /** * @todo Implement properly. diff --git a/src/gui/widgets/viewport.hpp b/src/gui/widgets/viewport.hpp index b3f596dce625..4ac8e97f0edb 100644 --- a/src/gui/widgets/viewport.hpp +++ b/src/gui/widgets/viewport.hpp @@ -91,7 +91,7 @@ class viewport : public widget bool disable_click_dismiss() const override; /** See @ref widget::create_walker. */ - virtual iterator::twalker_* create_walker() override; + virtual iterator::walker_base* create_walker() override; private: widget& widget_; diff --git a/src/gui/widgets/widget.hpp b/src/gui/widgets/widget.hpp index 87bf9d22ba44..bd4190239343 100644 --- a/src/gui/widgets/widget.hpp +++ b/src/gui/widgets/widget.hpp @@ -36,7 +36,7 @@ class window; namespace iterator { -class twalker_; +class walker_base; } // namespace iterator /** @@ -823,7 +823,7 @@ class widget : private boost::noncopyable, virtual bool disable_click_dismiss() const = 0; /** Creates a new walker object on the heap. */ - virtual iterator::twalker_* create_walker() = 0; + virtual iterator::walker_base* create_walker() = 0; }; } // namespace gui2 diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index d5779666c400..a7fa53966dd4 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -290,11 +290,11 @@ window* manager::get_window(const unsigned id) } // namespace window::window(CVideo& video, - tformula x, - tformula y, - tformula w, - tformula h, - tformula reevaluate_best_size, + typed_formula x, + typed_formula y, + typed_formula w, + typed_formula h, + typed_formula reevaluate_best_size, const game_logic::function_symbol_table& functions, const bool automatic_placement, const unsigned horizontal_placement, diff --git a/src/gui/widgets/window.hpp b/src/gui/widgets/window.hpp index 30cc9b4b94b4..d71f7c58f014 100644 --- a/src/gui/widgets/window.hpp +++ b/src/gui/widgets/window.hpp @@ -68,11 +68,11 @@ class window : public panel, public cursor::setter public: window(CVideo& video, - tformula x, - tformula y, - tformula w, - tformula h, - tformula reevaluate_best_size, + typed_formula x, + typed_formula y, + typed_formula w, + typed_formula h, + typed_formula reevaluate_best_size, const game_logic::function_symbol_table& functions, const bool automatic_placement, const unsigned horizontal_placement, @@ -564,19 +564,19 @@ class window : public panel, public cursor::setter unsigned maximum_height_; /** The formula to calulate the x value of the dialog. */ - tformula x_; + typed_formula x_; /** The formula to calulate the y value of the dialog. */ - tformula y_; + typed_formula y_; /** The formula to calulate the width of the dialog. */ - tformula w_; + typed_formula w_; /** The formula to calulate the height of the dialog. */ - tformula h_; + typed_formula h_; /** The formula to determine whether the size is good. */ - tformula reevaluate_best_size_; + typed_formula reevaluate_best_size_; /** The formula definitions available for the calulation formulas. */ game_logic::function_symbol_table functions_; diff --git a/src/scripting/lua_gui2.cpp b/src/scripting/lua_gui2.cpp index a13e158f332b..92ef50ebcf53 100644 --- a/src/scripting/lua_gui2.cpp +++ b/src/scripting/lua_gui2.cpp @@ -291,12 +291,12 @@ int show_message_dialog(lua_State *L, CVideo & video) t_string short_opt; config opt; if(luaW_totstring(L, -1, short_opt)) { - // Note: Although this currently uses the tlegacy_menu_item class + // Note: Although this currently uses the legacy_menu_item class // for the deprecated syntax, this branch should still be retained // when the deprecated syntax is removed, as a simpler method // of specifying options when only a single string is needed. const std::string& opt_str = short_opt; - gui2::tlegacy_menu_item item(opt_str); + gui2::legacy_menu_item item(opt_str); opt["image"] = item.icon(); opt["label"] = item.label(); opt["description"] = item.description(); diff --git a/src/tests/gui/iterator.cpp b/src/tests/gui/iterator.cpp index babc20b30c9a..8005528a491a 100644 --- a/src/tests/gui/iterator.cpp +++ b/src/tests/gui/iterator.cpp @@ -126,7 +126,7 @@ static void test_control() T control; { - gui2::iterator::titerator< gui2::iterator::policy::order::ttop_down< + gui2::iterator::iterator< gui2::iterator::policy::order::top_down< true , true , true> > @@ -146,7 +146,7 @@ static void test_control() } { - gui2::iterator::titerator< gui2::iterator::policy::order::ttop_down< + gui2::iterator::iterator< gui2::iterator::policy::order::top_down< false , true , true> > @@ -158,11 +158,11 @@ static void test_control() } { - gui2::iterator::titerator > iterator(control); + gui2::iterator::iterator > iterator(control); BOOST_CHECK_EQUAL(iterator.at_end(), false); } { - gui2::iterator::titerator > iterator(control); + gui2::iterator::iterator > iterator(control); BOOST_CHECK_EQUAL(iterator.at_end(), true); } } @@ -198,7 +198,7 @@ static void test_grid() std::stringstream sstr; lg::redirect_output_setter redirect_output(sstr); - gui2::iterator::titerator > @@ -214,7 +214,7 @@ static void test_grid() std::stringstream sstr; lg::redirect_output_setter redirect_output(sstr); - gui2::iterator::titerator > @@ -230,7 +230,7 @@ static void test_grid() std::stringstream sstr; lg::redirect_output_setter redirect_output(sstr); - gui2::iterator::titerator > @@ -246,7 +246,7 @@ static void test_grid() std::stringstream sstr; lg::redirect_output_setter redirect_output(sstr); - gui2::iterator::titerator > diff --git a/src/tests/gui/visitor.cpp b/src/tests/gui/visitor.cpp index d4be4dc172f8..c06fb1d4dc86 100644 --- a/src/tests/gui/visitor.cpp +++ b/src/tests/gui/visitor.cpp @@ -47,37 +47,37 @@ static void test_control() //std::cerr << __func__ << ": " << typeid(T).name() << ".\n"; T control; - const std::unique_ptr visitor(control.create_walker()); + const std::unique_ptr visitor(control.create_walker()); BOOST_REQUIRE_NE(visitor.get(), static_cast(nullptr)); /***** INITIAL STATE *****/ - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::widget), false); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::grid), true); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), true); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::widget), false); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::grid), true); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), true); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::widget), &control); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::grid), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::widget), &control); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::grid), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); /***** VISITING WIDGET *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::widget), gui2::iterator::twalker_::invalid); - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::grid), gui2::iterator::twalker_::fail); - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::child), gui2::iterator::twalker_::fail); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::widget), gui2::iterator::walker_base::invalid); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::grid), gui2::iterator::walker_base::fail); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::child), gui2::iterator::walker_base::fail); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::widget), true); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::grid), true); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), true); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::widget), true); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::grid), true); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), true); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::widget), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::grid), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::widget), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::grid), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); /***** POST END *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::widget), gui2::iterator::twalker_::fail); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::widget), gui2::iterator::walker_base::fail); } static void test_control() @@ -101,53 +101,53 @@ static void test_grid() add_widget(grid, new gui2::tlabel(), "(2,1)", 1, 0); add_widget(grid, new gui2::tlabel(), "(2,2)", 1, 1); - const std::unique_ptr visitor(grid.create_walker()); + const std::unique_ptr visitor(grid.create_walker()); /***** LABEL 1,1 *****/ - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), false); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), false); - BOOST_REQUIRE_NE(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child)->id(), "(1,1)"); + BOOST_REQUIRE_NE(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child)->id(), "(1,1)"); /***** LABEL 2,1 *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::child), gui2::iterator::twalker_::valid); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::child), gui2::iterator::walker_base::valid); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), false); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), false); - BOOST_REQUIRE_NE(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child)->id(), "(2,1)"); + BOOST_REQUIRE_NE(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child)->id(), "(2,1)"); /***** LABEL 1,2 *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::child), gui2::iterator::twalker_::valid); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::child), gui2::iterator::walker_base::valid); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), false); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), false); - BOOST_REQUIRE_NE(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child)->id(), "(1,2)"); + BOOST_REQUIRE_NE(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child)->id(), "(1,2)"); /***** LABEL 2,2 *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::child), gui2::iterator::twalker_::valid); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::child), gui2::iterator::walker_base::valid); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), false); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), false); - BOOST_REQUIRE_NE(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child)->id(), "(2,2)"); + BOOST_REQUIRE_NE(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child)->id(), "(2,2)"); /***** END *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::child), gui2::iterator::twalker_::invalid); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::child), gui2::iterator::walker_base::invalid); - BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::twalker_::child), true); + BOOST_CHECK_EQUAL(visitor->at_end(gui2::iterator::walker_base::child), true); - BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::twalker_::child), static_cast(nullptr)); + BOOST_CHECK_EQUAL(visitor->get(gui2::iterator::walker_base::child), static_cast(nullptr)); /***** POST END *****/ - BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::twalker_::child), gui2::iterator::twalker_::fail); + BOOST_CHECK_EQUAL(visitor->next(gui2::iterator::walker_base::child), gui2::iterator::walker_base::fail); } BOOST_AUTO_TEST_CASE(test_gui2_visitor) diff --git a/src/units/types.cpp b/src/units/types.cpp index 46a4450aca18..cd873902ecde 100644 --- a/src/units/types.cpp +++ b/src/units/types.cpp @@ -991,7 +991,7 @@ namespace { // Helpers for set_config() // Don't replace if the key already exists in the config (even if empty). return; } - gui2::tformula formula(formula_str); + gui2::typed_formula formula(formula_str); game_logic::map_formula_callable original; boost::sregex_iterator m(formula_str.begin(), formula_str.end(), fai_identifier); for (const boost::sregex_iterator::value_type& p : std::make_pair(m, boost::sregex_iterator())) {