[fpc-pascal] Any recommendations for a good in-memory storage type
Matt Emson
memson.lists at googlemail.com
Wed Sep 22 16:01:43 CEST 2010
Graeme Geldenhuys wrote:
> So which one would be more fitting for any mime types, or is there
> another option I didn't think of? Here is a simple usage example of
> the TfpgMimeData class - to help put this in perspective:
>
This seems a lot like the BMessage class used with in the BeAPI. There
is an API called MUSCLE, which originates from a project created by
Jeremey Freisner for BeOS, but is now very "cross platform". It uses a
Message class to implement the format you mention below. It is designed
to be used for comms, so it has the concept of "flattening" data to a
binary format and then "unflattening" the data at the destination.
What does all this have to do with your class? I wrote an implementation
for Delphi a good 5 years ago. It might be worth looking at? It was in
the original MUSCLE distro, but if not, I can find you a copy.
https://public.msli.com/lcs/muscle/
Messages are not the "fastest" way of storing data, but the idea of an
extensible generic data storage mechanism is extremely powerful,
especially for distributed comms. MUSCLE implements a whole lot more and
really is worth looking at if you want to create C/S over a WAN. The
MUSCLE server becomes a middle man dispatcher on to which the clients
publish resources and subscribe to events. The "server" becomes another
node. Really love it, would love it more if it wasn't written in C++.
M
>
> var
> m: TfpgMimeData;
> d: TfpgDrag;
> a: TfpgDropAction;
> begin
> m := TfpgMimeData.Create;
> m.SetData('text/plain', 'My name is Earl');
> m.SetData('text/html', 'My name is <b>Earl</b>'); // text/plain
> can actually be created from this automatically
> m.SetData('image/png', MyPNGImage);
>
> d := TfpgDrag.Create(self);
> d.MimeData := m;
> d.StartDrag([daCopy]);
>
> // d manages the lifespan of m
> // d will be freed automatically when drag action is complete or cancelled
> end;
>
>
>
More information about the fpc-pascal
mailing list