chore: Update message passing method in NotificationCenter

This commit is contained in:
scawful
2024-08-16 17:07:13 -04:00
parent e1fda49d91
commit 1cc1fce3d0
2 changed files with 6 additions and 2 deletions

View File

@@ -10,6 +10,8 @@
#include <unordered_map>
#include <vector>
#include "absl/status/status.h"
namespace yaze {
namespace app {
namespace core {
@@ -26,7 +28,7 @@ struct Message {
class IMessageListener {
public:
virtual ~IMessageListener() = default;
virtual void OnMessageReceived(const Message& message) = 0;
virtual absl::Status OnMessageReceived(const Message& message) = 0;
};
class IMessageProtocol {
@@ -108,6 +110,8 @@ class Reflectable {
virtual std::any GetPropertyValue(const std::string& property_name) const = 0;
virtual void SetPropertyValue(const std::string& property_name,
const std::any& value) = 0;
virtual std::any InvokeMethod(const std::string& method_name,
const std::vector<std::any>& args) = 0;
};
class ObjectFactory {

View File

@@ -35,7 +35,7 @@ class NotificationCenter {
void PostNotification(const Notification& notification) {
const auto& observerList = observers[notification.type];
for (auto observer : observerList) {
observer->onMessageReceived(notification);
observer->OnMessageReceived(notification);
}
}