Class Browser fails
Oliver Eichler
oliver.eichler at gmx.de
Mon Nov 1 11:14:11 GMT 1999
Hi
This piece of code is getting the class browser completely out of state. Is it
possible to fix it?
#ifndef SIGNAL_H
#define SIGNAL_H
#include <list>
/**
*@author Oliver Eichler
*/
template<typename P1 = void, typename P2 = void>
class CSignal {
struct SlotLinkBase{
virtual void call(){};
virtual void call(P1 &){};
};
template<typename ObjType>
struct SlotLink0 : public SlotLinkBase{
ObjType &object;
void (ObjType::*method)();
SlotLink0(ObjType &o, void (ObjType::*m)()) : object (o), method (m){};
virtual void call (){(object.*method)();};
};
template<typename ObjType>
struct SlotLink1 : public SlotLinkBase{
ObjType &object;
void (ObjType::*method)(P1);
SlotLink1(ObjType &o, void (ObjType::*m)(P1)) : object (o), method(m){};
virtual void call (P1 &p1){(object.*method)(p1);}
};
std::list<SlotLinkBase*> listeners;
public:
template<typename ObjType>
void connect(ObjType &o, void (ObjType::*m)()){listeners.push_back(new
SlotLink0<ObjType>(o,m));};
template<typename ObjType>
void connect(ObjType &o, void (ObjType::*m)(P1)){listeners.push_back(new
SlotLink1<ObjType>(o,m));};
void emit(){
for(std::list<SlotLinkBase*>::iterator i = listeners.begin();i
!=listeners.end(); i++){
(*i)->call();
}
}
void emit(P1 &p1){
for(std::list<SlotLinkBase*>::iterator i = listeners.begin();i
!=listeners.end(); i++){
(*i)->call(p1);
}
}
CSignal(){};
virtual ~CSignal(){};
};
#endif
--
Oliver Eichler
DSP Solutions
Ingenieure Kellermann, Hoepfel, Voigt, Eichler, Weidner
Partnerschaft
More information about the KDevelop
mailing list