Subject - object with views
SYNOPSIS
#include <InterViews/subject.h>
DESCRIPTION
A subject is an object that has one or more views that it
wishes to notify when it changes. The SubjectIteractor
class can be used if it is necessary to iterate through
the views of a subject explicitly.
Because subjects are shared, Subject is a subclass of
Resource. To allow for the possibility of multiple inher-
itance, in which case only a single copy of resource
information should be maintained, Resource is a virtual
base class.
PUBLIC OPERATIONS
enum UpdateHint {
attaching, detaching, setting, changing
}
This type enumerates possible hints when a subject
is notifying a view that it has changed. The
attaching hint indicates that a view has attached
to the subject. The detaching hint means that the
subject is being deleted and the view should con-
sider itself detached. The setting hint means that
the subject's value has been set, though possibly
to the same value as it already has. The changing
hint means that the value is set to something dif-
ferent than it was previously.
virtual void attach(View*)
Add a view to the subject's list.
virtual void detach(View*)
Remove a view from the subject's list.
virtual void notify(UpdateHint = changing)
Notify all the views of a subject that it has been
updated.
virtual boolean viewed_by(View*)
Return whether a given view is on the subject's
list of views.
virtual void Attach(Interactor*)
This function is equivalent to attach and is pro-
vided solely for backward compatibility. It will
be removed in a future version.
virtual void Detach(Interactor*)
will be removed in a future version.
virtual void Notify()
This function is equivalent to notify(changing) and
is provided solely for backward compatibility. It
will be removed in a future version.
boolean IsView(Interactor*)
This function is equivalent to viewed_by and is
provided solely for backward compatibility. It
will be removed in a future version.
SUBJECTITERATOR OPERATIONS
A subject iterator can be used to iterate through the
views in a subject.
SubjectIterator(Subject*)
Create a subject iterator for the given subject.
The iterator is only valid as long as the subject
exists.
virtual void init()
Reset the iteration to start at the beginning of
the list. This operation is called by the con-
structor.
virtual boolean more()
Return whether there are more views in the list.
virtual View* cur()
Return the current view.
virtual void remove()
Remove the current view from the list.
virtual void next()
Move the iteration to the next view in the list.
SEE ALSO
View(3I)
Man(1) output converted with
man2html