|
@@ -3,7 +3,7 @@
|
|
* Company: Lynar Studios
|
|
* Company: Lynar Studios
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* Created: 2020-11-27
|
|
* Created: 2020-11-27
|
|
- * Changed: 2023-02-04
|
|
|
|
|
|
+ * Changed: 2023-02-07
|
|
*
|
|
*
|
|
* */
|
|
* */
|
|
|
|
|
|
@@ -19,9 +19,14 @@ ls::std::event::EventManager::~EventManager() = default;
|
|
|
|
|
|
void ls::std::event::EventManager::subscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
|
|
void ls::std::event::EventManager::subscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
|
|
{
|
|
{
|
|
- if (_id.empty() || _listener == nullptr)
|
|
|
|
|
|
+ if (_id.empty())
|
|
|
|
+ {
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_id is empty"};
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (_listener == nullptr)
|
|
{
|
|
{
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_listener is null"};
|
|
}
|
|
}
|
|
|
|
|
|
if (this->_hasEventHandler(_id))
|
|
if (this->_hasEventHandler(_id))
|
|
@@ -30,15 +35,20 @@ void ls::std::event::EventManager::subscribe(const ls::std::core::type::event_id
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- throw ls::std::core::EventNotSubscribedException{};
|
|
|
|
|
|
+ throw ls::std::core::EventNotSubscribedException{"id: " + _id};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void ls::std::event::EventManager::unsubscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
|
|
void ls::std::event::EventManager::unsubscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
|
|
{
|
|
{
|
|
- if (_id.empty() || _listener == nullptr)
|
|
|
|
|
|
+ if (_id.empty())
|
|
|
|
+ {
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_id is empty"};
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (_listener == nullptr)
|
|
{
|
|
{
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_listener is null"};
|
|
}
|
|
}
|
|
|
|
|
|
if (this->_hasEventHandler(_id))
|
|
if (this->_hasEventHandler(_id))
|
|
@@ -53,7 +63,7 @@ bool ls::std::event::EventManager::addEventHandler(const ::std::shared_ptr<ls::s
|
|
|
|
|
|
if (_eventHandler == nullptr)
|
|
if (_eventHandler == nullptr)
|
|
{
|
|
{
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_eventHandler is null"};
|
|
}
|
|
}
|
|
|
|
|
|
if (!this->_hasEventHandler(_eventHandler->getId()))
|
|
if (!this->_hasEventHandler(_eventHandler->getId()))
|
|
@@ -73,7 +83,7 @@ void ls::std::event::EventManager::fire(ls::std::event::Event _event)
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- throw ls::std::core::EventNotHandledException{};
|
|
|
|
|
|
+ throw ls::std::core::EventNotHandledException{"id: " + _event.getId()};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -81,7 +91,7 @@ bool ls::std::event::EventManager::hasEventHandler(const ls::std::core::type::ev
|
|
{
|
|
{
|
|
if (_id.empty())
|
|
if (_id.empty())
|
|
{
|
|
{
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_id is empty"};
|
|
}
|
|
}
|
|
|
|
|
|
return this->_hasEventHandler(_id);
|
|
return this->_hasEventHandler(_id);
|
|
@@ -91,7 +101,7 @@ bool ls::std::event::EventManager::removeEventHandler(const ::std::shared_ptr<ls
|
|
{
|
|
{
|
|
if (_eventHandler == nullptr)
|
|
if (_eventHandler == nullptr)
|
|
{
|
|
{
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_eventHandler is null"};
|
|
}
|
|
}
|
|
|
|
|
|
return this->_removeEventHandler(_eventHandler);
|
|
return this->_removeEventHandler(_eventHandler);
|