DataView is an abstract subclass of NSView which acts as a representation-specific (that is, hex or ASCII) intermediary controller between MyDocument and a DataTextView. A document window contains an instance of each of the subclasses ASCIIDataView and a HexDataView. Each data view contains a corresponding DataTextView, either ASCIIDataTextView or HexDataTextView.
DataViews have the following responsibilities:
- Converting between the canonical byte representation of the data maintained by MyDocument to the actual string representation shown by the contained DataTextView.
- Converting between the canonical byte-level selection range maintained by MyDocument to the actual string selection.
- Converting from new string data entered in the corresponding DataTextView to bytes, to be passed back to MyDocument.
- Converting from pasteboard data to the to bytes, to be passed back to MyDocument.