PureMVC PureMVC
|
00001 // Mediator.hpp 00002 // PureMVC_C++ 00003 // 00004 // PureMVC Port to C++ by Tang Khai Phuong <phuong.tang@puremvc.org> 00005 // PureMVC - Copyright(c) 2006-2011 Futurescale, Inc., Some rights reserved. 00006 // Your reuse is governed by the Creative Commons Attribution 3.0 License 00007 // 00008 00009 #if !defined(__PUREMVC_PATTERNS_MEDIATOR_MEDIATOR_HPP__) 00010 #define __PUREMVC_PATTERNS_MEDIATOR_MEDIATOR_HPP__ 00011 00012 // STL include 00013 #include <string> 00014 // PureMVC include 00015 #if !defined(__PUREMVC_HPP__) 00016 #define __PUREMVC_INCLUDE__ 00017 #include "../PureMVC.hpp" 00018 #endif /* __PUREMVC_HPP__ */ 00019 00020 #include "../../Interfaces/ICommand.hpp" 00021 #include "../Observer/Notifier.hpp" 00022 00023 namespace PureMVC 00024 { 00025 namespace Patterns 00026 { 00027 using Interfaces::IMediator; 00028 using Interfaces::INotifier; 00029 00035 class PUREMVC_API Mediator 00036 : public virtual IMediator 00037 , public virtual INotifier 00038 , public Notifier 00039 { 00040 public: 00044 explicit Mediator(Mediator const& arg); 00045 00046 public: 00050 Mediator(std::string const& mediator_name = Mediator::NAME, void const* view_component = NULL); 00051 00055 virtual std::string const& getMediatorName(void) const; 00056 00062 virtual void setViewComponent(void const* view_component); 00063 00074 virtual void const* getViewComponent(void) const; 00075 00082 virtual Mediator::NotificationNames listNotificationInterests(void) const; 00083 00092 virtual void handleNotification(INotification const& notification); 00093 00097 virtual void onRegister(void); 00098 00102 virtual void onRemove(void); 00103 00107 Mediator& operator=(Mediator const& arg); 00108 00112 virtual ~Mediator(void); 00113 00122 protected: 00123 // the mediator name 00124 std::string _mediator_name; 00125 // The view component 00126 void const* _view_component; 00127 public: 00128 static char const* const NAME; 00129 }; 00130 } 00131 } 00132 00133 #endif /* __PUREMVC_PATTERNS_MEDIATOR_MEDIATOR_HPP__ */