⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsgstation.cpp

📁 陆其明的实务精选中附带光盘中的视频聊天源代码
💻 CPP
字号:
//
// CMsgStation.cpp
// 

/*-----------------------------------------------------*\
			HQ Tech, Make Technology Easy!       
 More information, please go to http://hqtech.nease.net.
/*-----------------------------------------------------*/

#include "stdafx.h"
#include "CMsgStation.h"
#include "CMsgReceiver.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CMsgStation::CMsgStation(void)
{
}

CMsgStation::~CMsgStation(void)
{
	Broadcast(msg_StationDestroyed, (void *)this);
}

void CMsgStation::AddMsgReceiver(CMsgReceiver * inReceiver)
{
	if (inReceiver)
	{
		if (mReceivers.GetIndex(inReceiver) == -1)
		{
			mReceivers.Add(inReceiver);
			inReceiver->AddMsgStation(this);
		}
	}
}

void CMsgStation::RemoveMsgReceiver(CMsgReceiver * inReceiver)
{
	if (inReceiver)
	{
		inReceiver->RemoveMsgStation(this);
		mReceivers.Remove(inReceiver);
	}
}

bool CMsgStation::Broadcast(MessageT inMessage, void * ioParam, void * ioParam2)
{
	for (int i = mReceivers.GetSize() - 1; i >= 0; i --)
	{
		CMsgReceiver * receiver = (CMsgReceiver *)mReceivers.GetAt(i);
		if (receiver)
		{
			receiver->ReceiveMessage(inMessage, ioParam, ioParam2);
		}
	}
	return true;
}

bool CMsgStation::Notify(NotifyT inNotification, long inParam1, long inParam2)
{
	SNotificationStruct   notification;
	notification.mNotification = inNotification;
	notification.mStation = this;
	notification.mParam1  = inParam1;
	notification.mParam2  = inParam2;
	return Broadcast(msg_Notify, &notification);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -