

jairgza
Members-
Content Count
7 -
Joined
-
Last visited
Everything posted by jairgza
-
Hi From TForm1 object I need to know the GUID of ITestA from field MyField. But the field is an anonymous function that I try to use a a lazy loading logic type ITestA = interface ['{0BE93958-EAC8-429B-A498-221B93328551}'] end; TForm1 = class(TForm) private MyField:TFunc<ITestA>; end; Using RTTI can investigate TForm1 class and "MyField" is recognized as TRttiInterfaceType but the GUID property returns {00000000-0000-0000-0000-000000000000} TRttiInterfaceType(rf.FieldType).GUID.ToString is there any way to achieve this ? regards
-
How know interface GUID from generic anonymous function using RTTI
jairgza replied to jairgza's topic in Algorithms, Data Structures and Class Design
That's what I did, extract the string name of the interface and search in my interface list. Just experimenting with rtti and trying to do some kind of dependency injection, try to inject a generic function that actually return the object when is used (Lazy loading). Thanks for your comments -
How know interface GUID from generic anonymous function using RTTI
jairgza replied to jairgza's topic in Algorithms, Data Structures and Class Design
procedure TForm1.Button1Click(Sender: TObject); var ctx:TRttiContext; rf:TRttiField; begin //test ctx := TRttiContext.Create; rf := ctx.GetType(Self.ClassType).GetField('MyField'); if rf.FieldType is TRttiInterfaceType then begin Log('GUID: '+ TRttiInterfaceType(rf.FieldType).GUID.ToString ); Log('GUID: '+ rf.FieldType.Handle.TypeData.GUID.ToString ); end; end; Hi, this is the test code Delphi 10.2 win10 -
Hi all I have some new yaml files for settings that I need to read, all my apps use json parsers (TDocVariantData or JsonDataObjects) and I was looking an easy way to just convert yaml text to json text and continue using my already implemented and familiar json parsers. I found one yaml parsers but it does not convert to json. Any of you know some library or how to do this ? thanks
-
My bad, I think I didn't explain myself sorry, it's not a one time conversion, but every time the app runs needs to read a yaml file and translate into json so all the current (large) code can be used without modification. The yaml files are edited manually by users. cheers
-
Yes, as you say, its only one time read, I'm not going to generate any yaml from programs. I was looking for something already usable in delphi, but I think im going to use grijjy neslib to make my own converter 🙂
-
make a whole unit private inside a bpl project
jairgza posted a topic in Algorithms, Data Structures and Class Design
I need a bpl to share some units, classes, functions, etc, but there are some auxiliary units just for internal use within the package, I dont want those units to be exposed or available to be used on some host project. Is there a way to hide or make those units private ? Thanks