PureMVC::View Class Reference

A Multiton IView implementation. More...

#include <pmvcpp.h>

Inheritance diagram for PureMVC::View:
Inheritance graph
[legend]
Collaboration diagram for PureMVC::View:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 View ()
 Constructor.
void registerObserver (int notificationName, IObserverRestricted *observer)
 Register an IObserverRestricted to be notified of INotifications with a given name.
void notifyObservers (INotification *notification)
 Notify the IObservers for a particular INotification.
void removeObserver (int notificationName, intptr_t contextAddress)
 Remove the observer for a given notifyContext from an observer list for a given Notification name.
void registerMediator (IMediator *mediator)
 Register an IMediator instance with the View.
IMediatorretrieveMediator (std::string mediatorName)
 Retrieve an IMediator from the View.
IMediatorremoveMediator (std::string mediatorName)
 Remove an IMediator from the View.
bool hasMediator (std::string mediatorName)
 Check if a Mediator is registered or not.
virtual void setMultitonKey (std::string key)
 Set multiton key.
virtual std::string getMultitonKey ()
 Get multiton key.

Static Public Member Functions

static IViewgetInstance (std::string key)
 View Singleton Factory method.
static void removeView (std::string key)
 Remove an IView instance.

Protected Attributes

std::map< std::string,
IMediator * > 
mediatorMap
std::map< int, std::vector
< IObserverRestricted * > > 
observerMap

Detailed Description

A Multiton IView implementation.

In PureMVC, the View class assumes these responsibilities:

See also:
Mediator
Observer
Notification

Constructor & Destructor Documentation

View::View (  ) 

Constructor.

This IView implementation is a Multiton, so you should not call the constructor directly, but instead call the static Multiton Factory method View.getInstance( multitonKey ). Unlike the AS3 version of PMVC, if you are going to subclass View, you should stick your initialization code in your subclass constructor. Keep in mind though, that the MultitonKey for this instance does not get set until after the constructor is called from getInstance.


Member Function Documentation

IView * View::getInstance ( std::string  key  )  [static]

View Singleton Factory method.

Returns:
the Singleton instance of View
std::string MultitonKeyHeir::getMultitonKey (  )  [virtual, inherited]

Get multiton key.

Returns the multiton key.

Returns:
The string key name

Implements PureMVC::IMultitonKeyHeir.

bool View::hasMediator ( std::string  mediatorName  )  [virtual]

Check if a Mediator is registered or not.

Parameters:
mediatorName 
Returns:
whether a Mediator is registered with the given mediatorName.

Implements PureMVC::IView.

void View::notifyObservers ( INotification notification  )  [virtual]

Notify the IObservers for a particular INotification.

All previously attached IObservers for this INotification's list are notified and are passed a reference to the INotification in the order in which they were registered.

Parameters:
notification the INotification to notify IObservers of.

Implements PureMVC::IView.

void View::registerMediator ( IMediator mediator  )  [virtual]

Register an IMediator instance with the View.

Registers the IMediator so that it can be retrieved by name, and further interrogates the IMediator for its INotification interests.

If the IMediator returns any INotification names to be notified about, an Observer is created encapsulating the IMediator instance's handleNotification method and registering it as an Observer for all INotifications the IMediator is interested in.

Parameters:
mediatorName the name to associate with this IMediator instance
mediator a reference to the IMediator instance

Implements PureMVC::IView.

void View::registerObserver ( int  notificationName,
IObserverRestricted observer 
) [virtual]

Register an IObserverRestricted to be notified of INotifications with a given name.

Parameters:
notificationName the name of the INotifications to notify this IObserver of
observer the IObserverRestricted to register

Implements PureMVC::IView.

IMediator * View::removeMediator ( std::string  mediatorName  )  [virtual]

Remove an IMediator from the View.

Parameters:
mediatorName name of the IMediator instance to be removed.
Returns:
the IMediator that was removed from the View Remove an IMediator from the View.
Parameters:
mediatorName name of the IMediator instance to be removed.
Returns:
the IMediator that was removed from the View

Implements PureMVC::IView.

void View::removeObserver ( int  notificationName,
intptr_t  contextAddress 
) [virtual]

Remove the observer for a given notifyContext from an observer list for a given Notification name.

Parameters:
notificationName which observer list to remove from
contextAddress remove the observer with this memory address as its notifyContext's address

Implements PureMVC::IView.

void View::removeView ( std::string  key  )  [static]

Remove an IView instance.

Parameters:
multitonKey of IView instance to remove
IMediator * View::retrieveMediator ( std::string  mediatorName  )  [virtual]

Retrieve an IMediator from the View.

Parameters:
mediatorName the name of the IMediator instance to retrieve.
Returns:
the IMediator instance previously registered with the given mediatorName.

Implements PureMVC::IView.

void MultitonKeyHeir::setMultitonKey ( std::string  key  )  [virtual, inherited]

Set multiton key.

Sets the multiton key.

Parameters:
key The name of the key

Implements PureMVC::IMultitonKeyHeir.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables

Generated on Wed Feb 17 17:11:35 2010 for PureMVC++ by  doxygen 1.6.1