tobjectlist

TobjectList between exe and DLL in Delphi

烈酒焚心 提交于 2019-12-18 09:34:49
问题 can somebody confirm me that it is not possible to exchange between an exe and a dLL written in Delphi a pointer that contains a TobjectList? Class definition shared between DLL and EXE TCMStack = CLASS(TObject) PRIVATE FEquipment: TCMEquipment; /// equipement with associated constraints FNbCoils: integer; /// coils used FListeCoils: TCoilsList; ///coil list associaed with a stack .... in executable code: ... /// Transfer business information to optimisation module /// fOptimisation is a

Can I pass in one function for TObjectList.IndexOf, and another function for TObjectList.Sort?

狂风中的少年 提交于 2019-12-11 08:24:30
问题 Summarization: TList.IndexOf (TList defined in the unit Classes.pas) iterates linearly through the contained items, and compares the reference. TList.IndexOf (TList defined in the unit Generics.Collections.pas) also iterates linearly through the contained items, but uses a comparer to compare whether the items are equal. Both TList.Sort and TList.Sort can use a comparer. ================================================= For an instance of the TForceList type defined in the following unit, I

Delphi: how to use TObjectList<T>?

家住魔仙堡 提交于 2019-12-06 11:14:05
问题 I need to understand how to use the generic Delphi 2009 TObjectList . My non- TObjectList attempt looked like TSomeClass = class(TObject) private FList1: Array of TList1; FList2: Array of TList2; public procedure FillArray(var List: Array of TList1; Source: TSource); Overload; procedure FillArray(var List: Array of TList2; Source: TSource); Overload; end; Here, TList1 and TList2 inherits the same constructor constructor TParent.Create(Key: string; Value: string); . However, due to different

Delphi Rtti: how to get objects from TObjectList<T>

谁都会走 提交于 2019-12-05 04:34:55
问题 I am working a custom class to xml converter and one of the requirements is the ability to stream TObjectList<T> fields. I am trying to invoke the ToArray() method to get hold of the TObjectlist's objects, but I get 'Invalid class typecast' because the types obviously don't match. take this class for example: type TSite = class Name : String; Address : String; end; TSites = class Sites : TObjecList<TSite>; end; I just need to get the Site Objects from the Sites TObjectList. Please keep in

Delphi Rtti: how to get objects from TObjectList<T>

坚强是说给别人听的谎言 提交于 2019-12-03 17:11:18
I am working a custom class to xml converter and one of the requirements is the ability to stream TObjectList<T> fields. I am trying to invoke the ToArray() method to get hold of the TObjectlist's objects, but I get 'Invalid class typecast' because the types obviously don't match. take this class for example: type TSite = class Name : String; Address : String; end; TSites = class Sites : TObjecList<TSite>; end; I just need to get the Site Objects from the Sites TObjectList. Please keep in mind that I am using RTTI, so I don't know the ObjectType in TObjectList, so Typecasting won't work . This

How to make an Excel-Like Sort By A, Then By B in a TObjectList<> using multiple comparers

梦想与她 提交于 2019-12-03 05:49:19
问题 I have just started to use generics, and I am currently having a problem doing sorting on multiple fields. Case: I have a PeopleList as a TObjectList<TPerson> and I want to be able to make an Excel-like sorting function, by selecting one sort-field at a time, but keeping the previous sorting as much as possible. EDIT: It must be possible to change the field sort sequence at runtime. (Ie. in one scenario, the user wants the sort order A,B,C - in another scenario he wants B,A,C - in yet another

How to make an Excel-Like Sort By A, Then By B in a TObjectList<> using multiple comparers

微笑、不失礼 提交于 2019-12-02 19:09:11
I have just started to use generics, and I am currently having a problem doing sorting on multiple fields. Case: I have a PeopleList as a TObjectList<TPerson> and I want to be able to make an Excel-like sorting function, by selecting one sort-field at a time, but keeping the previous sorting as much as possible. EDIT: It must be possible to change the field sort sequence at runtime. (Ie. in one scenario, the user wants the sort order A,B,C - in another scenario he wants B,A,C - in yet another A,C,D) Lets say we have an unsorted list of people : Lastname Age --------------------- Smith 26 Jones

TobjectList between exe and DLL in Delphi

旧时模样 提交于 2019-11-29 17:02:27
can somebody confirm me that it is not possible to exchange between an exe and a dLL written in Delphi a pointer that contains a TobjectList? Class definition shared between DLL and EXE TCMStack = CLASS(TObject) PRIVATE FEquipment: TCMEquipment; /// equipement with associated constraints FNbCoils: integer; /// coils used FListeCoils: TCoilsList; ///coil list associaed with a stack .... in executable code: ... /// Transfer business information to optimisation module /// fOptimisation is a instance of class fOptimisation.TransfererDonneesMetiersDansOptimisation(@TStack, LEVEL_OPTIM_1, false);

How can I get the sub-item type of a TObjectList<T> purely by RTTI information (i.e. without using any actual object instance) in Delphi?

只愿长相守 提交于 2019-11-29 08:58:10
I'm implementing generic code for streaming arbitrary Delphi objects using RTTI, and in order to get this to work (more specifically, in order to get the loading part to work), I need to somehow get the sub-item type of a TObjectList<T> field without making use of any actual object instance. The obvious reason for the requirement to not use any actual object instance is that in the case of loading an object from a stream (based solely on the knowledge of the class type of the object to be loaded), I won't have any instance at all available before the loading has completed - I will rather only

How can I get the sub-item type of a TObjectList<T> purely by RTTI information (i.e. without using any actual object instance) in Delphi?

淺唱寂寞╮ 提交于 2019-11-28 02:19:39
问题 I'm implementing generic code for streaming arbitrary Delphi objects using RTTI, and in order to get this to work (more specifically, in order to get the loading part to work), I need to somehow get the sub-item type of a TObjectList<T> field without making use of any actual object instance. The obvious reason for the requirement to not use any actual object instance is that in the case of loading an object from a stream (based solely on the knowledge of the class type of the object to be