[fpc-pascal] Any recommendations for a good in-memory storage type

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Sep 22 13:15:05 CEST 2010

On 22 September 2010 12:52, Marco van de Voort wrote:
> Different choices. The question is if you want some typing (if only runtime)
> and easy conversions, or e.g. have the data in a directly writable format.

Well, the data needs to be passed via Clipboard or Drag-n-Drop API's
of the underlying system (when used from application to application),
or can bypass those API's when dragging and dropping inside the same
application (where a more efficient data format could be used).

Currently I'm only busy with Xlib (but GDI will follow soon). There
are some conversion support, like I suggested. for example: a HTML
data string can be converted to a Plain Text string, by simply
striping all tags. Images, Sound etc will be passed as a byte array
(at least under Xlib).

TfpgMimeData has the following convenience functions/properties to
automatically search for the mime type and return the associated data,
or if an exact mime type doesn't exist, try and do a conversion of a
similar mime type (as in the case of HTML -> Plain Text). Or when
setting data, use the property to determine what mime type must be
associated with the data being stored.

eg:  TfpgMimeData
         property Urls           (text with URI formatting
         property Text           (text)
         property HTML        (text with tags)
         function Data(mimetype)     (byte array)

> I would first try a variant.

Just for getting the initial DND support to work under Xlib, I limited
myself to text types only, so choose variant as my storage type, but
now that I'm moving to the next phase (multiple data types), I am
considering other storage types because I don't know if variant is
suitable for binary data like sound, images etc.. I'm leaning towards
TMemoryStream now. Just spotting the new incoming messages, Felipe and
Michael seem to share my thoughts on that.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-pascal mailing list