On Wed, 22 Sep 2010, Marco van de Voort wrote:
In our previous episode, Graeme Geldenhuys said:
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..
No. But it allows you to keep text as text, not as streamed value. I don't
know if assigning a string to a variant is copy-on-write though.
If you don't operate much on it, it doesn't matter. But the above sounds
like you do most of the work on text, not binary blobs.
I'm leaning towards
TMemoryStream now. Just spotting the new incoming messages, Felipe and
Michael seem to share my thoughts on that.
They didn't ask what you wanted to do exactly either :-)
variants support most base Delphi types, afaik including class , interface
and dyn array.
For the kind of data he is most likely to receive, a stream still seems best.
For most data formats, maybe a TStringSTream is better suited. You'll have
the text as data available at once, which is the most likely use anyway, and
has all semantics of a stream.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal