6 #include "interfaces/observer.h"
16 mObserverList.clear();
19 void ISubject::attach( Interface::Observer * pObserver )
21 if ( tqFind( mObserverList.begin(), mObserverList.end(), pObserver ) == mObserverList.end() )
22 mObserverList.push_back( pObserver );
25 void ISubject::detach( Interface::Observer * pObserver ) {
26 TQValueVector<Interface::Observer*>::iterator it = tqFind( mObserverList.begin(), mObserverList.end(), pObserver );
27 if ( it != mObserverList.end() )
28 mObserverList.erase( it );
31 void ISubject::notify()
33 kdDebug(5006) << "ISubject::notify " << mObserverList.size() << endl;
37 const TQValueVector<Interface::Observer*> copy = mObserverList;
38 for ( TQValueVector<Interface::Observer*>::const_iterator it = copy.begin() ; it != copy.end() ; ++it ) {
40 (*it)->update( this );
|