Jump to content

John Kouraklis

Members
  • Content Count

    332
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by John Kouraklis


  1. Ok, upgrade completed and things seem to be in place except the Connection Managers. 

     

    I can see the files in Documents. Anyone knows how to make the (new) IDE recognise them? Does it use the registry?

     

    Edit: It doesn't seem to recognise GetIt installed packages.....sadly


  2. @Mahdi Safsafi Very cool. Thanks for this

     

    A couple of questions: 

    1. Do you need to create/Free TRTTIContext? All the books/articles I've seen they just use the record

     

    2. The TypeInfo variable in DoSomething conflicts with TypeInfo from RTTI. It should use a different name, right?

     

    3. How do I get the value of the fields now? I tried this:

    for lFields in LType.GetFields do
    	Writeln(' '+lFields.Name + ': '+lFields.GetValue(TypeInfo(Rec)).AsString);

    but the instance in GetValue is not correct. 

     

    Thanks again


  3. Hi,

    I want to write a function and allow the user of the function to pass a record that I do not know in advance. Then, the idea is I iterate through the fields in the function.

     

    Something like this:

    function pass (aRec: record): boolean;

     

    But a 'record' can't be used like this.

     

    I've thought of two approaches but without being able to make them work:

     

    1. Use of pointers:

     

    function pass (aRP: Pointer): boolean;

    begin

    ....

    /// here I do not know how to (cast the pointer to any record and) iterate using RTTI

    /// I think this can not be done as the cast seems very arbitrary

    ...

    end;

     

    2. A kind of adapter record:

    type

      TAdapterRec<T> = record

        instance: T

       constructor Create (aRec: T);

     end;

     

    and then tried to declare the function:

    function pass (aRec: TAdapterRec<T>): boolean;

    but generics like these are not allowed.

     

    Anyone can help with this? I would like to avoid using classes.

     

    Thanks

     

     


  4. I uploaded a package for 10.2 

     

    Very welcome to test and see if all is good.

     

    Also, it would be great if someone could check/test/create packages for other versions as I don't have any other installed. Please see the open issue on github.

     

    Thanks👌

×