bazaar: Dispatcher cleanup and fixes

git-svn-id: svn://ultimatepp.org/upp/trunk@3737 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
kohait 2011-08-04 21:02:18 +00:00
parent 1156f14317
commit 0f31efcc6c
15 changed files with 150 additions and 269 deletions

View file

@ -1,45 +1,12 @@
#include "Dispatcher.hpp"
DispatcherGen::DispatcherGen()
{
}
DispatcherGen::~DispatcherGen()
{
//ASSERT(dests.IsEmpty()); //FIXME, DispatcherGen does keep the Dispatcher<T> instances, cause Dispatchable<T> are Register()ed there (forwarded) and do Unregister() only there as well.
}
//Callback variant
DispatcherCBGen::DispatcherCBGen()
{
}
DispatcherCBGen::~DispatcherCBGen()
{
//ASSERT(dests.IsEmpty()); //FIXME, DispatcherGen does keep the Dispatcher<T> instances, cause Dispatchable<T> are Register()ed there (forwarded) and do Unregister() only there as well.
}
//Dispatcher0
Dispatcher0::Dispatcher0()
{
}
Dispatcher0::~Dispatcher0()
{
ASSERT(dests.IsEmpty());
}
void Dispatcher0::DoDispatch() const
{
if(!R::IsEnabled()) return;
for(int i = 0; i < dests.GetCount(); i++)
{
const Callback & dest = dests.operator[](i);
dest();
}
dests[i]();
}
void Dispatcher0::Register(Callback d, unsigned key)
@ -60,43 +27,17 @@ Callback* Dispatcher0::GetDispatchable(unsigned key)
{
int i = dests.Find(key);
if(i<0) return NULL;
Callback & dest = dests.operator[](i);
return &dest;
return &dests[i];
}
//DispatcherL0
DispatcherL0::DispatcherL0()
{
}
DispatcherL0::~DispatcherL0()
{
ASSERT(dests.IsEmpty());
}
void DispatcherL0::DoDispatch() const
{
int c = 0;
const Handler *list = dests.GetNext(), *e = list;
do
const Handler *list = dests.GetPtr(), *e = list;
while((e = e->GetNext()) != list)
{
++c;
e->h();
e = e->GetNext();
e->h(); ++c;
}
while(e != list);
}
#if 0 //for compile / debug only
template class Dispatchable<int>;
template class Dispatcher<int>;
template void DispatcherGen::DoDispatch<int>(const int & o, unsigned param) const;
template void DispatcherGen::Register<int>(Dispatchable<int> & d, unsigned key);
template void DispatcherGen::Unregister<int>(Dispatchable<int> & d, unsigned key);
DispatcherGen gen;
DispatcherCBGen gencb;
#endif

View file

@ -2,36 +2,36 @@
#define _Dispatcher_Dispatcher_h
#include <Core/Core.h>
using namespace Upp;
#include <Gen/Gen.h>
template<class T>
class Dispatcher;
template<class T> class Dispatcher;
class DispatcherGen;
template<class T, class B = EmptyClass>
class Dispatchable
: public EnableOption<>
class Dispatchable : public EnableOption<B>
{
friend class Dispatcher<T>;
friend class DispatcherGen;
public:
typedef Dispatchable<T,B> CLASSNAME;
Dispatchable();
virtual ~Dispatchable();
typedef EnableOption<B> R;
Dispatchable() : act(true) {}
virtual ~Dispatchable() { UnregisterAll(); }
public:
virtual void Dispatch(const T & o) = 0;
virtual void Dispatch(const T& o) = 0;
void Unregister(const Any & _src);
void UnregisterAll();
void Unregister(Dispatcher<T> & from) { int i = src.Find(GetPtrHashValue(&from)); if(i<0) return; Unregister(src[i]); }
void Unregister(DispatcherGen & from) { int i = src.Find(GetPtrHashValue(&from)); if(i<0) return; Unregister(src[i]); }
void Unregister(const Any& _src);
void UnregisterAll() { while(src.GetCount()>0) Unregister(src[0]); }
const VectorMap<unsigned, Any> & GetSrc() const { return src; }
void Unregister(Dispatcher<T>& from) { int i = src.Find(GetPtrHashValue(&from)); if(i<0) return; Unregister(src[i]); }
void Unregister(DispatcherGen& from) { int i = src.Find(GetPtrHashValue(&from)); if(i<0) return; Unregister(src[i]); }
const VectorMap<unsigned, Any>& GetSrc() const { return src; }
private:
bool act;
@ -46,20 +46,20 @@ class Dispatcher
public:
typedef Dispatcher<T> CLASSNAME;
typedef EnableOption<> R;
Dispatcher();
virtual ~Dispatcher();
void DoDispatch(const T & o) const;
virtual ~Dispatcher() { ASSERT(dests.IsEmpty()); }
void DoDispatch(const T& o) const;
int GetCount() const { return dests.GetCount(); }
void Register(Dispatchable<T> & d, unsigned key = 0);
void Unregister(Dispatchable<T> & d, unsigned key = 0);
Dispatchable<T> * GetDispatchable(unsigned key) const;
const VectorMap<unsigned, Dispatchable<T> * > & GetDests() const { return dests; }
void Register(Dispatchable<T>& d, unsigned key = 0);
void Unregister(Dispatchable<T>& d, unsigned key = 0);
Dispatchable<T>* GetDispatchable(unsigned key) const;
const VectorMap<unsigned, Dispatchable<T>*>& GetDests() const { return dests; }
void Clear() { while(dests.GetCount()>0) dests[0].Unregister(); }
private:
VectorMap<unsigned, Dispatchable<T> * > dests;
VectorMap<unsigned, Dispatchable<T>*> dests;
};
//a generic version that accepts any Dispatchable<T>
@ -67,24 +67,21 @@ class DispatcherGen
{
public:
typedef DispatcherGen CLASSNAME;
DispatcherGen();
virtual ~DispatcherGen();
template<class T>
void DoDispatch(const T & o) const;
void DoDispatch(const T& o) const;
template<class T>
void Register(Dispatchable<T> & d, unsigned key = 0);
void Register(Dispatchable<T>& d, unsigned key = 0);
template<class T>
void Unregister(Dispatchable<T> & d, unsigned key = 0);
void Unregister(Dispatchable<T>& d, unsigned key = 0);
template<class T>
Dispatcher<T> & GetDispatcher();
Dispatcher<T>& GetDispatcher();
private:
Vector<Any> dests; //now does store the different Dispatcher<T>
Vector<Any> dests; //now does store the different Dispatcher<T>
};
//Callback variant
//spares out Dispatchable<T> interface
@ -95,53 +92,52 @@ class DispatcherCB
public:
typedef DispatcherCB<T> CLASSNAME;
typedef EnableOption<> R;
DispatcherCB();
virtual ~DispatcherCB();
void DoDispatch(const T & o) const;
virtual ~DispatcherCB() { ASSERT(dests.IsEmpty()); }
void DoDispatch(const T& o) const;
int GetCount() const { return dests.GetCount(); }
void Register(Callback1<const T &> d, unsigned key);
void Register(Callback1<const T&> d, unsigned key);
void Unregister(unsigned key);
Callback1<const T &>* GetDispatchable(unsigned key);
const VectorMap<unsigned, Callback1<const T &> > & GetDests() const { return dests; }
Callback1<const T&>* GetDispatchable(unsigned key);
const VectorMap<unsigned, Callback1<const T&> >& GetDests() const { return dests; }
void Clear() { dests.Clear(); }
private:
VectorMap<unsigned, Callback1<const T &> > dests;
VectorMap<unsigned, Callback1<const T&> > dests;
};
//a generic version that accepts any Callback<cons T &, unsigned>
//a generic version that accepts any Callback<cons T&, unsigned>
class DispatcherCBGen
{
public:
typedef DispatcherCBGen CLASSNAME;
DispatcherCBGen();
virtual ~DispatcherCBGen();
template<class T>
void DoDispatch(const T & o) const;
void DoDispatch(const T& o) const;
template<class T>
void Register(Callback1<const T &> d, unsigned key);
void Register(Callback1<const T&> d, unsigned key);
template<class T>
void Unregister(unsigned key);
template<class T>
DispatcherCB<T> & GetDispatcherCB();
DispatcherCB<T>& GetDispatcherCB();
private:
Vector<Any> dests; //now does store the different DispatcherCB<T>
Vector<Any> dests; //now does store the different DispatcherCB<T>
};
//void param variant
class Dispatcher0
: public EnableOption<>
{
public:
typedef Dispatcher0 CLASSNAME;
typedef EnableOption<> R;
Dispatcher0();
virtual ~Dispatcher0();
virtual ~Dispatcher0() { ASSERT(dests.IsEmpty()); }
void DoDispatch() const;
int GetCount() const { return dests.GetCount(); }
@ -149,32 +145,14 @@ public:
void Register(Callback d, unsigned key);
void Unregister(unsigned key);
Callback* GetDispatchable(unsigned key);
const VectorMap<unsigned, Callback> & GetDests() const { return dests; }
const VectorMap<unsigned, Callback>& GetDests() const { return dests; }
void Clear() { dests.Clear(); }
private:
VectorMap<unsigned, Callback> dests;
};
class DispatcherL0
: public EnableOption<>
{
public:
typedef DispatcherL0 CLASSNAME;
typedef EnableOption<> R;
struct Handler : public Link<Handler> { Callback h; };
DispatcherL0();
virtual ~DispatcherL0();
void DoDispatch() const;
int GetCount() const { GetLinkCount(dests); }
void Clear() { dests.Unlink(); }
Link<Handler> dests;
};
//Link<> list as managed data structure for easy handling
template<class T>
class DispatcherL
: public EnableOption<>
@ -184,11 +162,30 @@ public:
typedef EnableOption<> R;
struct Handler : public Link<Handler> { Callback h; };
DispatcherL();
virtual ~DispatcherL();
virtual ~DispatcherL() { ASSERT(dests.IsEmpty()); }
void DoDispatch(const T& o) const;
int GetCount() const { GetLinkCount(dests); }
int GetCount() const { return GetLinkCount(dests); }
void Clear() { dests.Unlink(); }
Link<Handler> dests;
};
//Link<> list as managed data structure for easy handling
//void param list
class DispatcherL0
: public EnableOption<>
{
public:
typedef DispatcherL0 CLASSNAME;
typedef EnableOption<> R;
struct Handler : public Link<Handler> { Callback h; };
virtual ~DispatcherL0() { ASSERT(dests.IsEmpty()); }
void DoDispatch() const;
int GetCount() const { return GetLinkCount(dests); }
void Clear() { dests.Unlink(); }

View file

@ -3,82 +3,52 @@
#include "Dispatcher.h"
template<class T, class B>
Dispatchable<T, B>::Dispatchable()
: act(true)
{
}
//Dispatchable<T>
template<class T, class B>
Dispatchable<T, B>::~Dispatchable()
void Dispatchable<T, B>::Unregister(const Any& _src)
{
UnregisterAll();
}
template<class T, class B>
void Dispatchable<T, B>::Unregister(const Any & _src)
{
if(_src.Is<Dispatcher<T> * >())
if(_src.Is<Dispatcher<T>* >())
{
Dispatcher<T> * disp = _src.Get<Dispatcher<T> * >();
Dispatcher<T>* disp = _src.Get<Dispatcher<T>*>();
disp->Unregister(*this, key.Get(GetPtrHashValue(disp)));
}
else
if(_src.Is<DispatcherGen * >())
if(_src.Is<DispatcherGen* >())
{
DispatcherGen * disp = _src.Get<DispatcherGen * >();
DispatcherGen* disp = _src.Get<DispatcherGen*>();
disp->Unregister(*this, key.Get(GetPtrHashValue(disp)));
}
}
template<class T, class B>
void Dispatchable<T, B>::UnregisterAll()
{
while(src.GetCount()>0)
{
Unregister(src[0]);
}
}
//Dispatcher<T>
template<class T>
Dispatcher<T>::Dispatcher()
{
}
template<class T>
Dispatcher<T>::~Dispatcher()
{
ASSERT(dests.IsEmpty());
}
template<class T>
void Dispatcher<T>::DoDispatch(const T & o) const
void Dispatcher<T>::DoDispatch(const T& o) const
{
if(!R::IsEnabled()) return;
for(int i = 0; i < dests.GetCount(); i++)
{
Dispatchable<T> * dest = dests.operator[](i);
Dispatchable<T>* dest = dests[i];
if(dest->IsEnabled())
dest->Dispatch(o);
}
}
template<class T>
void Dispatcher<T>::Register(Dispatchable<T> & d, unsigned key)
void Dispatcher<T>::Register(Dispatchable<T>& d, unsigned key)
{
if(key == 0) key = GetPtrHashValue(&d);
int i = dests.Find(key);
if(i>=0) return;
dests.Add(key) = &d;
Any & a = d.src.Add(GetPtrHashValue(this));
a.Create<Dispatcher<T> * >() = this;
Any& a = d.src.Add(GetPtrHashValue(this));
a.Create<Dispatcher<T>*>() = this;
d.key.Add(GetPtrHashValue(this)) = key;
}
template<class T>
void Dispatcher<T>::Unregister(Dispatchable<T> & d, unsigned key)
void Dispatcher<T>::Unregister(Dispatchable<T>& d, unsigned key)
{
if(key == 0) key = GetPtrHashValue(&d);
int i = dests.Find(key);
@ -89,35 +59,36 @@ void Dispatcher<T>::Unregister(Dispatchable<T> & d, unsigned key)
}
template<class T>
Dispatchable<T> * Dispatcher<T>::GetDispatchable(unsigned key) const
Dispatchable<T>* Dispatcher<T>::GetDispatchable(unsigned key) const
{
int i = dests.Find(key);
if(i<0) return NULL;
Dispatchable<T> * dest = dests.operator[](i);
return dest;
return &dests[i];
}
//DispatcherGen
template<class T>
void DispatcherGen::DoDispatch(const T & o) const
void DispatcherGen::DoDispatch(const T& o) const
{
for(int i = 0; i < dests.GetCount(); i++)
{
const Any & a = dests.operator[](i);
const Any& a = dests[i];
if(!a.Is<Dispatcher<T> >()) continue;
const Dispatcher<T> & dest = a.Get<Dispatcher<T> >();
const Dispatcher<T>& dest = a.Get<Dispatcher<T> >();
dest.DoDispatch(o);
return;
}
}
template<class T>
void DispatcherGen::Register(Dispatchable<T> & d, unsigned key)
void DispatcherGen::Register(Dispatchable<T>& d, unsigned key)
{
for(int i = 0; i < dests.GetCount(); i++)
{
Any & a = dests.operator[](i);
Any& a = dests[i];
if(!a.Is<Dispatcher<T> >()) continue;
Dispatcher<T> & dest = a.Get<Dispatcher<T> >();
Dispatcher<T>& dest = a.Get<Dispatcher<T> >();
dest.Register(d, key);
return;
}
@ -125,13 +96,13 @@ void DispatcherGen::Register(Dispatchable<T> & d, unsigned key)
}
template<class T>
void DispatcherGen::Unregister(Dispatchable<T> & d, unsigned key)
void DispatcherGen::Unregister(Dispatchable<T>& d, unsigned key)
{
for(int i = 0; i < dests.GetCount(); i++)
{
Any & a = dests.operator[](i);
Any& a = dests[i];
if(!a.Is<Dispatcher<T> >()) continue;
Dispatcher<T> & dest = a.Get<Dispatcher<T> >();
Dispatcher<T>& dest = a.Get<Dispatcher<T> >();
dest.Unregister(d, key);
if(dest.GetDests().GetCount()<=0)
dests.Remove(i);
@ -140,45 +111,30 @@ void DispatcherGen::Unregister(Dispatchable<T> & d, unsigned key)
}
template<class T>
Dispatcher<T> & DispatcherGen::GetDispatcher()
Dispatcher<T>& DispatcherGen::GetDispatcher()
{
for(int i = 0; i < dests.GetCount(); i++)
{
const Any & a = dests.operator[](i);
const Any& a = dests[i];
if(!a.Is<Dispatcher<T> >()) continue;
Dispatcher<T> & dest = a.Get<Dispatcher<T> >();
Dispatcher<T>& dest = a.Get<Dispatcher<T> >();
return dest;
}
return dests.Add().Create<Dispatcher<T> >();
}
//Callback variant
//DispatcherCB<T>
template<class T>
DispatcherCB<T>::DispatcherCB()
{
}
template<class T>
DispatcherCB<T>::~DispatcherCB()
{
ASSERT(dests.IsEmpty());
}
template<class T>
void DispatcherCB<T>::DoDispatch(const T & o) const
void DispatcherCB<T>::DoDispatch(const T& o) const
{
if(!R::IsEnabled()) return;
for(int i = 0; i < dests.GetCount(); i++)
{
const Callback1<const T &> & dest = dests.operator[](i);
dest(o);
}
dests[i](o);
}
template<class T>
void DispatcherCB<T>::Register(Callback1<const T &> d, unsigned key)
void DispatcherCB<T>::Register(Callback1<const T&> d, unsigned key)
{
int i = dests.Find(key);
if(i>=0) return;
@ -194,35 +150,36 @@ void DispatcherCB<T>::Unregister(unsigned key)
}
template<class T>
Callback1<const T &>* DispatcherCB<T>::GetDispatchable(unsigned key)
Callback1<const T&>* DispatcherCB<T>::GetDispatchable(unsigned key)
{
int i = dests.Find(key);
if(i<0) return NULL;
Callback1<const T &> & dest = dests.operator[](i);
return &dest;
return &dests[i];
}
//DispatcherCBGen
template<class T>
void DispatcherCBGen::DoDispatch(const T & o) const
void DispatcherCBGen::DoDispatch(const T& o) const
{
for(int i = 0; i < dests.GetCount(); i++)
{
const Any & a = dests.operator[](i);
const Any& a = dests[i];
if(!a.Is<DispatcherCB<T> >()) continue;
const DispatcherCB<T> & dest = a.Get<DispatcherCB<T> >();
const DispatcherCB<T>& dest = a.Get<DispatcherCB<T> >();
dest.DoDispatch(o);
return;
}
}
template<class T>
void DispatcherCBGen::Register(Callback1<const T &> d, unsigned key)
void DispatcherCBGen::Register(Callback1<const T&> d, unsigned key)
{
for(int i = 0; i < dests.GetCount(); i++)
{
Any & a = dests.operator[](i);
Any& a = dests[i];
if(!a.Is<DispatcherCB<T> >()) continue;
DispatcherCB<T> & dest = a.Get<DispatcherCB<T> >();
DispatcherCB<T>& dest = a.Get<DispatcherCB<T> >();
dest.Register(d, key);
return;
}
@ -234,9 +191,9 @@ void DispatcherCBGen::Unregister(unsigned key)
{
for(int i = 0; i < dests.GetCount(); i++)
{
Any & a = dests.operator[](i);
Any& a = dests[i];
if(!a.Is<DispatcherCB<T> >()) continue;
DispatcherCB<T> & dest = a.Get<DispatcherCB<T> >();
DispatcherCB<T>& dest = a.Get<DispatcherCB<T> >();
dest.Unregister(key);
if(dest.GetDests().GetCount()<=0)
dests.Remove(i);
@ -245,13 +202,13 @@ void DispatcherCBGen::Unregister(unsigned key)
}
template<class T>
DispatcherCB<T> & DispatcherCBGen::GetDispatcherCB()
DispatcherCB<T>& DispatcherCBGen::GetDispatcherCB()
{
for(int i = 0; i < dests.GetCount(); i++)
{
const Any & a = dests.operator[](i);
const Any& a = dests[i];
if(!a.Is<DispatcherCB<T> >()) continue;
DispatcherCB<T> & dest = a.Get<DispatcherCB<T> >();
DispatcherCB<T>& dest = a.Get<DispatcherCB<T> >();
return dest;
}
return dests.Add().Create<DispatcherCB<T> >();
@ -259,29 +216,15 @@ DispatcherCB<T> & DispatcherCBGen::GetDispatcherCB()
//DispatcherL
template<class T>
DispatcherL<T>::DispatcherL()
{
}
template<class T>
DispatcherL<T>::~DispatcherL()
{
ASSERT(dests.IsEmpty());
}
template<class T>
void DispatcherL<T>::DoDispatch(const T& o) const
{
int c = 0;
const Handler *list = dests.GetNext(), *e = list;
do
const Handler *list = dests.GetPtr(), *e = list;
while((e = e->GetNext()) != list)
{
++c;
e->h(o);
e = e->GetNext();
e->h(o); ++c;
}
while(e != list);
}
#endif

View file

@ -18,7 +18,7 @@ public:
typedef MyPane CLASSNAME;
MyPane();
virtual void Dispatch(const Value & o);
virtual void Dispatch(const Value& o);
};
class DispatcherTest : public WithDispatcherTestLayout<TopWindow>

View file

@ -10,7 +10,7 @@ MyPane::MyPane()
dl.Add(i);
}
void MyPane::Dispatch(const Value & o)
void MyPane::Dispatch(const Value& o)
{
ei.SetData(o);
//pi.SetData(o);

View file

@ -19,8 +19,8 @@ public:
typedef MyPane CLASSNAME;
MyPane();
virtual void Dispatch(const Value & o);
virtual void Dispatch(const int & o);
virtual void Dispatch(const Value& o);
virtual void Dispatch(const int& o);
};
class DispatcherTest : public WithDispatcherTestLayout<TopWindow>

View file

@ -10,7 +10,7 @@ MyPane::MyPane()
dl.Add(i);
}
void MyPane::Dispatch(const Value & o)
void MyPane::Dispatch(const Value& o)
{
ei.SetData(o);
//pi.SetData(o);
@ -19,7 +19,7 @@ void MyPane::Dispatch(const Value & o)
st.SetText(String().Cat() << o);
}
void MyPane::Dispatch(const int & o)
void MyPane::Dispatch(const int& o)
{
ei.SetData(o);
//pi.SetData(o);

View file

@ -19,7 +19,7 @@ class WithDispatch
public:
typedef WithDispatch<C, T> CLASSNAME;
virtual void Dispatch(const T & o)
virtual void Dispatch(const T& o)
{
C::SetData(o);
}
@ -34,7 +34,7 @@ class ProgressIndicatorWithDispatch
public:
typedef ProgressIndicatorWithDispatch<T> CLASSNAME;
virtual void Dispatch(const T & o)
virtual void Dispatch(const T& o)
{
Set(o);
}

View file

@ -21,7 +21,7 @@ DispatcherTest::DispatcherTest()
splitv1.Vert();
for(int i = 0; i < 10; i++)
{
WithDispatch<EditInt, Value> * pctrl = new WithDispatch<EditInt, Value>();
WithDispatch<EditInt, Value>* pctrl = new WithDispatch<EditInt, Value>();
ctrls.Add(pctrl);
pctrl->MinMax(0, 100);
disp.Register(*pctrl);
@ -31,7 +31,7 @@ DispatcherTest::DispatcherTest()
splitv2.Vert();
for(int i = 0; i < 10; i++)
{
ProgressIndicatorWithDispatch<Value> * pctrl = new ProgressIndicatorWithDispatch<Value>();
ProgressIndicatorWithDispatch<Value>* pctrl = new ProgressIndicatorWithDispatch<Value>();
ctrls.Add(pctrl);
pctrl->SetTotal(100);
disp.Register(*pctrl);

View file

@ -18,11 +18,11 @@ class MyEditInt
public:
typedef MyEditInt CLASSNAME;
virtual void Dispatch(const Value & o)
virtual void Dispatch(const Value& o)
{
SetData(o);
}
virtual void Dispatch(const int & o)
virtual void Dispatch(const int& o)
{
SetData(o);
}
@ -36,11 +36,11 @@ class MyProgressIndicator
public:
typedef MyProgressIndicator CLASSNAME;
virtual void Dispatch(const Value & o)
virtual void Dispatch(const Value& o)
{
Set(o);
}
virtual void Dispatch(const int & o)
virtual void Dispatch(const int& o)
{
Set(o);
}

View file

@ -20,7 +20,7 @@ DispatcherTest::DispatcherTest()
splitv1.Vert();
for(int i = 0; i < 10; i++)
{
MyEditInt * pctrl = new MyEditInt();
MyEditInt* pctrl = new MyEditInt();
ctrls.Add(pctrl);
pctrl->MinMax(0, 100);
disp.Register(*pctrl);
@ -35,7 +35,7 @@ DispatcherTest::DispatcherTest()
splitv2.Vert();
for(int i = 0; i < 10; i++)
{
MyProgressIndicator * pctrl = new MyProgressIndicator();
MyProgressIndicator* pctrl = new MyProgressIndicator();
ctrls.Add(pctrl);
pctrl->SetTotal(100);
disp.Register(*pctrl);

View file

@ -18,11 +18,11 @@ class MyEditInt
public:
typedef MyEditInt CLASSNAME;
virtual void Dispatch(const Value & o)
virtual void Dispatch(const Value& o)
{
SetData(o);
}
virtual void Dispatch(const int & o)
virtual void Dispatch(const int& o)
{
SetData(o);
}
@ -36,11 +36,11 @@ class MyProgressIndicator
public:
typedef MyProgressIndicator CLASSNAME;
virtual void Dispatch(const Value & o)
virtual void Dispatch(const Value& o)
{
Set(o);
}
virtual void Dispatch(const int & o)
virtual void Dispatch(const int& o)
{
Set(o);
}

View file

@ -20,7 +20,7 @@ DispatcherTest::DispatcherTest()
splitv1.Vert();
for(int i = 0; i < 10; i++)
{
MyEditInt * pctrl = new MyEditInt();
MyEditInt* pctrl = new MyEditInt();
ctrls.Add(pctrl);
pctrl->MinMax(0, 100);
@ -36,7 +36,7 @@ DispatcherTest::DispatcherTest()
splitv2.Vert();
for(int i = 0; i < 10; i++)
{
MyProgressIndicator * pctrl = new MyProgressIndicator();
MyProgressIndicator* pctrl = new MyProgressIndicator();
ctrls.Add(pctrl);
pctrl->SetTotal(100);
disp.Register<Value>(*pctrl);

View file

@ -16,11 +16,11 @@ class MyEditInt
public:
typedef MyEditInt CLASSNAME;
virtual void DispatchV(const Value & o)
virtual void DispatchV(const Value& o)
{
SetData(o);
}
virtual void DispatchI(const int & o)
virtual void DispatchI(const int& o)
{
SetData(o);
}
@ -32,11 +32,11 @@ class MyProgressIndicator
public:
typedef MyProgressIndicator CLASSNAME;
virtual void DispatchV(const Value & o)
virtual void DispatchV(const Value& o)
{
Set(o);
}
virtual void DispatchI(const int & o)
virtual void DispatchI(const int& o)
{
Set(o);
}

View file

@ -25,7 +25,7 @@ DispatcherTest::DispatcherTest()
int i = 0;
for(; i < 10; i++)
{
MyEditInt * pctrl = new MyEditInt();
MyEditInt* pctrl = new MyEditInt();
ctrls.Add(pctrl);
pctrl->MinMax(0, 100);
@ -41,7 +41,7 @@ DispatcherTest::DispatcherTest()
splitv2.Vert();
for(; i < 20; i++)
{
MyProgressIndicator * pctrl = new MyProgressIndicator();
MyProgressIndicator* pctrl = new MyProgressIndicator();
ctrls.Add(pctrl);
pctrl->SetTotal(100);