Article View: comp.lang.pascal.delphi.components.writing
Article #11HELP!! Advanced Problem: FindClass,GetClass,RegisterClass(es).
From: Martin Harvey
Date: Thu, 06 Nov 1997 00:00
Date: Thu, 06 Nov 1997 00:00
48 lines
2854 bytes
2854 bytes
Hi all, Yet another subtle and insiuous problem here: I'm writing a communications protocol that requires polymorphic construction of objects which are being transferred from one machine to another. In some ways, it's very much like the delphi streaming system. For part of this protocol I need to convert type TClass into it's string representation *and vice versa*. The first part is easy, TObject has a class function called "ClassName". However, the second part is more tricky: In order to convert from a string representation to something of type TPersistentClass, I need to use either FindClass or GetClass. However, In order to use these, I suspect that I have to register my classes first using RegisterClass. So, here's the conundrum. RegisterClass says that it registers certain classes with the Delphi Streaming system. Does this mean that it alters the innards of the IDE in some way? Do I only ever have to call it once? Or is it something that you have to call every time you run your program? However it registers the classes, I need to be sure that this process will enable me to use these class functions correctly on machines with no Delphi IDE, so that I can transfer ClassName strings from one machine to another and transfer a data structure from one machine to another. I'm not using the entire Delphi streaming system, most of it is a streaming system of my own devising, I just need this particular set of functions. In addition to this, The protocol that I'm specifying states that (partially) incompatible versions of the protocol can be used, so that if the reciever doesn't recognise the classes of objects it's being sent, it simply goes up the inheritance heirarchy until it finds a class that it does recognise, and unmarshalls an object as that parent class. Can anyone out there (borland folks?) offer some help and advice? I would appreciate a reply cc to my email address, since the Cambridge University news server doesn't host the borland groups :-( Martin Harvey.
Technical Details
Message-ID:
<63t8b3$9r7$1@lyra.csx.cam.ac.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 112b07,9d23c9fdab4f5be5,start X-Google-Attributes: gid112b07,public X-Google-Thread: 1043cf,9d23c9fdab4f5be5,start X-Google-Attributes: gid1043cf,public X-Google-Thread: fe2ce,9d23c9fdab4f5be5,start X-Google-Attributes: gidfe2ce,public X-Google-Thread: 10545b,9d23c9fdab4f5be5,start X-Google-Attributes: gid10545b,public From: mch24@cam.ac.uk (Martin Harvey) Subject: HELP!! Advanced Problem: FindClass,GetClass,RegisterClass(es). Date: 1997/11/06 Message-ID: <63t8b3$9r7$1@lyra.csx.cam.ac.uk> X-Deja-AN: 287485895 Organization: Pembroke College, Cambridge Newsgroups: comp.lang.pascal.delphi.components.writing,borland.public.delphi.ide,borland.public.delphi.objectpascal,borland.public.delphi.vcl.components.writing