Next: Snip Classes
Up: File Format
Previous: File Format
The generalized notion of a snip allows new snip types to be defined
and immediately used in any buffer class. Also, when two applications
support the same kinds of snips, snip data can easily be cut and
pasted between them, and the same data files will be readable by each
program. This interoperability is due to a consistent encoding
mechanism that is built into the snip system.
Graceful and extensible encoding of snips requires that
two issues are addressed:
- In order to convert a snip from an encoded representation (e.g.,
as bytes in a file) to a memory object, a decoding function must be
provided for each type of snip. Furthermore, a list of such decoders
must be available to the high-level decoding process. This is done
inby associating a snip class object to every snip. A snip class
is an instance of the wx:snip-class% class.
- Some buffers may require additional information to be stored
about a snip; this information is orthogonal to the type-specific
information stored by the snip itself. For example, a pasteboard needs
to remember a snip's position, while an editor buffer does not need
this information. If data is being cut and pasted from one pasteboard
to another, then information about relative positions needs to be
maintained, but this information should not inhibit pasting into an
editor. Extra data is associated with a snip through buffer data objects, instances of the wx:buffer-data% class; decoding
requires that each buffer data object has a buffer data class,
an instance of the wx:buffer-data-class% class.
Snip classes, snip data, and snip data classes solve problems related
to encoding and decoding snips. In an application that has no need for
saving files or interoperable cut-and-paste, these issues can be
safely ignored.
Next: Snip Classes
Up: File Format
Previous: File Format
PLT