From 313230a4ca2645c2325c0ee0c043d26a5dac4755 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Mon, 7 Apr 2008 13:09:26 +0200 Subject: [PATCH] push af2ea5b9080b0eebb7f98012cea15b8fe66391ee --- src/core/component.h | 8 -------- src/core/delegators/defaultstate.h | 20 ++++++++++++++++++-- src/core/delegators/state.h | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/core/component.h b/src/core/component.h index c1c6ec7..bf022a0 100644 --- a/src/core/component.h +++ b/src/core/component.h @@ -14,8 +14,6 @@ #include "component_fwd.h" #include "export.h" #include -#include -#include /** * @brief A Component is a reusable unit in the description of a Tagua variant. @@ -26,10 +24,4 @@ public: Component(); }; -static inline void dump_component_methods(Component* c) { - const QMetaObject* mo = c->metaObject(); - for (int i=0; i < mo->methodCount(); i++) - kDebug() << " ** " << mo->method(i).signature() << "->" << mo->method(i).typeName(); -} - #endif // CORE__COMPONENT_H diff --git a/src/core/delegators/defaultstate.h b/src/core/delegators/defaultstate.h index 45ac51b..5881ade 100644 --- a/src/core/delegators/defaultstate.h +++ b/src/core/delegators/defaultstate.h @@ -1,12 +1,28 @@ #ifndef DELEGATORS__DEFAULT_STATE_H #define DELEGATORS__DEFAULT_STATE_H -#include "state.h" +#include "../defaultstate.h" namespace Delegators { -class DefaultState : public State, public DefaultState { + class DefaultState : public State, public ::DefaultState { public: +#if 0 + DefaultState(IState* state) + : State(state) { + ::DefaultState* dstate = dynamic_cast< ::DefaultState*>(state); + if (dstate == NULL) { + kError() << "Delegators::DefaultState needs a ::DefaultState, cannot use a" + << typeid(state).name(); + abort(); + } + + m_state = dstate; + m_state->setDelegator(this); + } + virtual ~DefaultState() { delete m_state; } +#endif + virtual std::vector theoreticalMoves(const Piece& piece, const Point& src) const { return m_state->theoreticalMoves(piece, src); } diff --git a/src/core/delegators/state.h b/src/core/delegators/state.h index d59dde4..a2155ae 100644 --- a/src/core/delegators/state.h +++ b/src/core/delegators/state.h @@ -17,7 +17,7 @@ */ namespace Delegators { -class State : public IState { +class State : virtual public IState { protected: IState* m_state; public: -- 2.11.4.GIT