Add EventBus::notify for simple strings

This commit is contained in:
Dawid Drozd 2017-08-25 16:02:25 +02:00
parent 257cc90c86
commit 23ab070061
3 changed files with 24 additions and 2 deletions

View File

@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
# BUILD_SHARED_LIBS can controll build type!
PROJECT(EventBus
VERSION 2.0.0
VERSION 2.0.1
LANGUAGES CXX
)

View File

@ -167,6 +167,28 @@ public:
notify(Dexode::Event<Args...>{eventName}, std::forward<Args>(params)...);
}
/**
* Notify all listeners for eventName.
* This is wrapper method only
*
* @param eventName name of event
*/
void notify(const std::string& eventName)
{
notify(Dexode::Event<>{eventName});
}
/**
* Notify all listeners for eventName.
* This is wrapper method only
*
* @param eventName name of event
*/
void notify(const char* const eventName)
{
notify(Dexode::Event<>{eventName});
}
private:
struct VectorInterface
{

View File

@ -171,7 +171,7 @@ TEST_CASE("eventbus/Different notification", "Valid check notification")
REQUIRE(called1 == false);
bus.notify(notification, 1);
REQUIRE(called1 == true);
REQUIRE(called2 == false);
called1 = false;