mirror of
https://github.com/gelldur/EventBus.git
synced 2024-12-26 18:51:02 +08:00
Add EventBus::notify for simple strings
This commit is contained in:
parent
257cc90c86
commit
23ab070061
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user