ExternView, PreorderView, InorderView, PostorderView -
base class for external representation objects and sub-
classes for common traversals
SYNOPSIS
#include <Unidraw/Components/externview.h>
DESCRIPTION
ExternView is the abstract base class for external repre-
sentation objects. Generally speaking, external represen-
tation objects convey domain-specific information outside
the editor. They are simply component views that extract
information from their subject and externalize it as a
stream of bytes; thus the ExternView base class is derived
from ComponentView.
There are three predefined ExternView subclasses: Pre-
orderView, InorderView, and PostorderView. These sub-
classes manage subviews and support three common traver-
sals of the external view hierarchy.
EXTERNVIEW PUBLIC OPERATIONS
virtual boolean Emit(ostream&)
virtual boolean Definition(ostream&)
Emit and Definition make up the basic ExternView
protocol. Emit initiates external representation
generation and calls Definition on each of its
children. Emit normally calls the external view's
own Definition operation first. Then if the exter-
nal view contains subviews, Emit invokes the chil-
dren's Definition operations in the proper order to
ensure a syntactically correct external representa-
tion. Both of these operation do nothing by
default, and both return a boolean that indicates
whether the stream of bytes was generated success-
fully.
ExternView* GetView(Iterator)
void SetView(ExternView*, Iterator&)
These operations do nothing by default. Subclasses
that contain children should redefine them as fol-
lows: GetView should return the ExternView to which
an iterator points. SetView should initialize the
iterator to point to a particular ExternView in the
list of children; it should initialize the iterator
to point to a nil instance if the given ExternView
is not a child.
EXTERNVIEW PROTECTED OPERATIONS
ExternView(Component* = nil)
The abstract base class constructor is protected to
guard against instantiation. It takes the subject
PreorderView, InorderView, and PostorderView redefine
their Definition operations to perform preorder, inorder,
and postorder traversals of their children, respectively.
Each child's Definition operation is called during the
traversal. Note that every child must be an instance of
the same ExternView subclass to ensure a consistent
traversal order.
SEE ALSO
Component(3U), ComponentView(3U), Iterator(3U),
ostream(3C++)
Man(1) output converted with
man2html