Replace tconst_duplicator with tconst_clone.
Both did about the same, so removed one of them.
This commit is contained in:
parent
cbc0cf5827
commit
202e833210
5 changed files with 14 additions and 31 deletions
|
@ -34,6 +34,7 @@
|
|||
#include "gui/widgets/grid.hpp"
|
||||
|
||||
#include "foreach.hpp"
|
||||
#include "utils/const_clone.tpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
|
@ -52,10 +53,10 @@ struct tgrid_implementation
|
|||
* @tparam W twidget or const twidget.
|
||||
*/
|
||||
template<class W>
|
||||
static W* find_at(typename tconst_duplicator<W, tgrid>::type& grid,
|
||||
static W* find_at(typename utils::tconst_clone<tgrid, W>::reference grid,
|
||||
const tpoint& coordinate, const bool must_be_active)
|
||||
{
|
||||
typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
|
||||
typedef typename utils::tconst_clone<tgrid::tchild, W>::type hack;
|
||||
foreach(hack& child, grid.children_) {
|
||||
|
||||
W* widget = child.widget();
|
||||
|
@ -81,7 +82,7 @@ struct tgrid_implementation
|
|||
* @tparam W twidget or const twidget.
|
||||
*/
|
||||
template<class W>
|
||||
static W* find(typename tconst_duplicator<W, tgrid>::type& grid,
|
||||
static W* find(typename utils::tconst_clone<tgrid, W>::reference grid,
|
||||
const std::string& id, const bool must_be_active)
|
||||
{
|
||||
// Inherited.
|
||||
|
@ -90,7 +91,7 @@ struct tgrid_implementation
|
|||
return widget;
|
||||
}
|
||||
|
||||
typedef typename tconst_duplicator<W, tgrid::tchild>::type hack;
|
||||
typedef typename utils::tconst_clone<tgrid::tchild, W>::type hack;
|
||||
foreach(hack& child, grid.children_) {
|
||||
|
||||
widget = child.widget();
|
||||
|
|
|
@ -160,27 +160,6 @@ void get_screen_size_variables(game_logic::map_formula_callable& variable);
|
|||
*/
|
||||
game_logic::map_formula_callable get_screen_size_variables();
|
||||
|
||||
/**
|
||||
* Helper struct to get the same constness for T and U.
|
||||
*
|
||||
* @param T A type to determine the constness.
|
||||
* @param U Non const type to set the constness off.
|
||||
*/
|
||||
template<class T, class U>
|
||||
struct tconst_duplicator
|
||||
{
|
||||
/** The type to use, if T not const U is also not const. */
|
||||
typedef U type;
|
||||
};
|
||||
|
||||
/** Specialialized version of tconst_duplicator when T is a const type. */
|
||||
template<class T, class U>
|
||||
struct tconst_duplicator<const T, U>
|
||||
{
|
||||
/** The type to use, const U. */
|
||||
typedef const U type;
|
||||
};
|
||||
|
||||
/** Returns the current mouse position. */
|
||||
tpoint get_mouse_position();
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "gui/widgets/scrollbar_container.hpp"
|
||||
|
||||
#include "utils/const_clone.tpp"
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Helper for header for the scrollbar_container.
|
||||
|
@ -52,7 +54,7 @@ struct tscrollbar_container_implementation
|
|||
*/
|
||||
template<class W>
|
||||
static W* find_at(
|
||||
typename tconst_duplicator<W, tscrollbar_container>::type&
|
||||
typename utils::tconst_clone<tscrollbar_container, W>::reference
|
||||
scrollbar_container,
|
||||
const tpoint& coordinate, const bool must_be_active)
|
||||
{
|
||||
|
@ -80,7 +82,7 @@ struct tscrollbar_container_implementation
|
|||
*/
|
||||
template<class W>
|
||||
static W* find(
|
||||
typename tconst_duplicator<W, tscrollbar_container>::type&
|
||||
typename utils::tconst_clone<tscrollbar_container, W>::reference
|
||||
scrollbar_container,
|
||||
const std::string& id, const bool must_be_active)
|
||||
{
|
||||
|
|
|
@ -254,7 +254,7 @@ public:
|
|||
|
||||
template<class W>
|
||||
static W* find_at(
|
||||
typename tconst_duplicator<W, ttree_view_node>::type&
|
||||
typename utils::tconst_clone<ttree_view_node, W>::reference
|
||||
tree_view_node
|
||||
, const tpoint& coordinate, const bool must_be_active)
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ public:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
typedef typename tconst_duplicator<W, ttree_view_node>::type thack;
|
||||
typedef typename utils::tconst_clone<ttree_view_node, W>::type thack;
|
||||
return find_at_aux<W>(tree_view_node.children_.begin(),
|
||||
tree_view_node.children_.end(),
|
||||
coordinate, must_be_active);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "gui/auxiliary/event/dispatcher.hpp"
|
||||
#include "gui/widgets/event_executor.hpp"
|
||||
#include "gui/widgets/helper.hpp"
|
||||
#include "utils/const_clone.tpp"
|
||||
#include "wml_exception.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
@ -778,7 +779,7 @@ template<class T> T* get_parent(twidget* widget)
|
|||
* @returns The widget with the id.
|
||||
*/
|
||||
template<class T>
|
||||
T* find_widget(typename tconst_duplicator<T, twidget>::type* widget
|
||||
T* find_widget(typename utils::tconst_clone<twidget, T>::pointer widget
|
||||
, const std::string& id
|
||||
, const bool must_be_active
|
||||
, const bool must_exist)
|
||||
|
@ -806,7 +807,7 @@ T* find_widget(typename tconst_duplicator<T, twidget>::type* widget
|
|||
* @returns The widget with the id.
|
||||
*/
|
||||
template<class T>
|
||||
T& find_widget(typename tconst_duplicator<T, twidget>::type* widget
|
||||
T& find_widget(typename utils::tconst_clone<twidget, T>::pointer widget
|
||||
, const std::string& id
|
||||
, const bool must_be_active)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue