summaryrefslogtreecommitdiff
path: root/src/T2DLL/LListener.cpp
blob: 8c00b498d5624935c4cfdb90fb2a17ea4973172d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "StdAfx.h"
#include "LBroadcaster.h"
#include "LListener.h"

LListener::LListener() {
	mListening = true;
}

LListener::LListener(const LListener& other) {
	mListening = other.mListening;
}

/*virtual*/ LListener::~LListener() {
	LBroadcaster *broadcaster;
	for (int index = mBroadcasters.GetCount(); index > 0; index--) {
		if (mBroadcasters.FetchItemAt(index, &broadcaster))
			broadcaster->RemoveListener(this);
	}
}

void LListener::AddBroadcaster(LBroadcaster* broadcaster) {
	mBroadcasters.Add(&broadcaster);
}

void LListener::RemoveBroadcaster(LBroadcaster* broadcaster) {
	mBroadcasters.Remove(&broadcaster);
}