ExternView(3U)

πŸ’– ExternView(3U) πŸ’–

okay bestie, welcome to the InterViews Reference Manual corner of the internet, this is the page for ExternView and its lil friend group PreorderView, InorderView, and PostorderView 🌸


✨ NAME ✨

ExternView, PreorderView, InorderView, PostorderView β€” the base class for external representation objects, plus subclasses for the common traversals πŸ¦‹


✨ SYNOPSIS ✨

#include <Unidraw/Components/externview.h>

✨ DESCRIPTION ✨

So ExternView is the abstract base class for external representation objects. Basically, external representation objects are the ones whose whole job is to carry domain-specific info outside the editor. No cap.

They're literally just component views that pull information out of their subject and externalize it as a stream of bytes πŸ’… and that's why the ExternView base class is derived from ComponentView. Periodt.

There are three predefined ExternView subclasses: PreorderView, InorderView, and PostorderView. These girlies manage subviews and support three common traversals of the external view hierarchy. Iconic honestly πŸ‘‘


✨ EXTERNVIEW PUBLIC OPERATIONS ✨

  • virtual boolean Emit(ostream&)
  • virtual boolean Definition(ostream&)

Emit and Definition make up the basic ExternView protocol. Emit kicks off 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 external view contains subviews, Emit invokes the children's Definition operations in the proper order to make sure the external representation is syntactically correct ✨ Both of these operations do nothing by default, and both return a boolean that tells you whether the stream of bytes was generated successfully 🫢

  • ExternView* GetView(Iterator)
  • void SetView(ExternView*, Iterator&)

These two also do nothing by default, bestie. Subclasses that contain children should redefine them like this:

  • GetView should return the ExternView that an iterator points to.
  • SetView should initialize the iterator to point to a particular ExternView in the list of children; and if the given ExternView is not a child, it should initialize the iterator to point to a nil instance πŸ™ˆ

✨ EXTERNVIEW PROTECTED OPERATIONS ✨

  • ExternView(Component* = nil)

The abstract base class constructor is protected to guard against instantiation β€” like, do not try to make one of these directly, she is abstract for a reason πŸ’€ It takes the subject as an optional argument.


✨ DERIVED CLASSES ✨

PreorderView, InorderView, and PostorderView redefine their Definition operations to perform preorder, inorder, and postorder traversals of their children, respectively. Each child's Definition operation gets called during the traversal.

⚠️ Note that every child must be an instance of the same ExternView subclass to ensure a consistent traversal order. Fr fr, don't mix them.

✨ SEE ALSO ✨

Component(3U), ComponentView(3U), Iterator(3U), ostream(3C++) πŸŽ€


and that's the whole page, bestie, you ate it πŸ’– this one came out of Unidraw, dated 19 January 1991 β€” a whole vintage queen, we stan a classic πŸ‘‘βœ¨πŸ¦‹