changed: update version strings for beta4
[xbmc.git] / xbmc / utils / AnnouncementManager.cpp
blobc84e06bf7260c50f40a410afed77cd2df4fda9b9
1 /*
2 * Copyright (C) 2005-2010 Team XBMC
3 * http://www.xbmc.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "AnnouncementManager.h"
23 #include "SingleLock.h"
24 #include <stdio.h>
25 #include "log.h"
27 using namespace std;
28 using namespace ANNOUNCEMENT;
30 CCriticalSection CAnnouncementManager::m_critSection;
31 vector<IAnnouncer *> CAnnouncementManager::m_announcers;
33 void CAnnouncementManager::AddAnnouncer(IAnnouncer *listener)
35 CSingleLock lock (m_critSection);
36 m_announcers.push_back(listener);
39 void CAnnouncementManager::RemoveAnnouncer(IAnnouncer *listener)
41 CSingleLock lock (m_critSection);
42 for (unsigned int i = 0; i < m_announcers.size(); i++)
44 if (m_announcers[i] == listener)
46 m_announcers.erase(m_announcers.begin() + i);
47 return;
52 void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, const char *message, const char *data)
54 CLog::Log(LOGDEBUG, "CAnnouncementManager - Announcement: %s from %s", message, sender);
55 CSingleLock lock (m_critSection);
56 for (unsigned int i = 0; i < m_announcers.size(); i++)
57 m_announcers[i]->Announce(flag, sender, message, data);