Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-17 Thread Wayne Sherman via fpc-devel
On Tue, Jan 17, 2023 at 7:08 AM Wayne Sherman wrote: > A REST class should know how to generate a complete and correct JSON > representation, so there must be a way to distinguish REST properties > from non-REST. Which properties have been modified is not sufficient. Rephrasing that last sentence

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-17 Thread Wayne Sherman via fpc-devel
On Tue, Jan 17, 2023 at 1:23 AM Michael Van Canneyt wrote: > Yes. The reason is the code generator: > > Ideally, every property simply has a unique index specifier. > > But when generating classes, the code generator has no way of knowing how > many properties exist in parent classes, so it must st

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-17 Thread Michael Van Canneyt via fpc-devel
On Mon, 16 Jan 2023, Wayne Sherman via fpc-devel wrote: On Mon, Jan 16, 2023 at 12:16 PM Wayne Sherman wrote: I need clarification about the auto generated class index specifiers. Do they always start at 0 in each descendant class, or are they unique across all descendant classes? TBaseObj

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-16 Thread Wayne Sherman via fpc-devel
On Mon, Jan 16, 2023 at 12:16 PM Wayne Sherman wrote: > I need clarification about the auto generated class index > specifiers. Do they always start at 0 in each descendant > class, or are they unique across all descendant classes? > > TBaseObject --> TChild --> TGrandChild > > TChild = class(TBas

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-16 Thread Wayne Sherman via fpc-devel
On Sun, Jan 15, 2023 at 9:28 PM Michael Van Canneyt wrote: > On Sun, 15 Jan 2023, Wayne Sherman wrote: > > On Sun, Jan 15, 2023 at 9:24 AM Michael Van Canneyt wrote: > >> On Sat, 14 Jan 2023, Wayne Sherman wrote: > >> > >>> I see a couple of problems TBaseObject.SaveToJSON > >>> > >>> 1) TBaseObjec

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-15 Thread Michael Van Canneyt via fpc-devel
On Sun, 15 Jan 2023, Wayne Sherman wrote: On Sun, Jan 15, 2023 at 9:24 AM Michael Van Canneyt wrote: On Sat, 14 Jan 2023, Wayne Sherman wrote: I see a couple of problems TBaseObject.SaveToJSON 1) TBaseObject.SaveToJSON cannot distinguish properties that are part of the REST protocol from

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-15 Thread Wayne Sherman via fpc-devel
On Sun, Jan 15, 2023 at 9:24 AM Michael Van Canneyt wrote: > On Sat, 14 Jan 2023, Wayne Sherman wrote: > > > I see a couple of problems TBaseObject.SaveToJSON > > > > 1) TBaseObject.SaveToJSON cannot distinguish properties that are part > > of the REST protocol from properties that are not part of

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-15 Thread Michael Van Canneyt via fpc-devel
On Sat, 14 Jan 2023, Wayne Sherman wrote: I see a couple of problems TBaseObject.SaveToJSON 1) TBaseObject.SaveToJSON cannot distinguish properties that are part of the REST protocol from properties that are not part of it. It only knows that properties which have been modified are part of

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Wayne Sherman via fpc-devel
I see a couple of problems TBaseObject.SaveToJSON 1) TBaseObject.SaveToJSON cannot distinguish properties that are part of the REST protocol from properties that are not part of it. It only knows that properties which have been modified are part of the rest protocol, but properties which have not

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Wayne Sherman via fpc-devel
Michael wrote: > >> Because there may be other published properties that are not part of the > >> REST protocol. You may for instance decide to add published properties to a > >> base class that describe where to save the object in a local database. Wayne wrote: > > Ok, that clears up that. If I

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Michael Van Canneyt via fpc-devel
On Sat, 14 Jan 2023, Wayne Sherman wrote: On Sat, Jan 14, 2023 at 12:36 PM Michael Van Canneyt wrote: On Sat, 14 Jan 2023, Wayne Sherman wrote: On Sat, Jan 14, 2023 at 10:34 AM Michael Van Canneyt wrote: On Sat, 14 Jan 2023, Wayne Sherman wrote: 2) Doesn't each object already have the par

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Wayne Sherman via fpc-devel
On Sat, Jan 14, 2023 at 12:36 PM Michael Van Canneyt wrote: > On Sat, 14 Jan 2023, Wayne Sherman wrote: > > On Sat, Jan 14, 2023 at 10:34 AM Michael Van Canneyt wrote: > >> On Sat, 14 Jan 2023, Wayne Sherman wrote: > >>> 2) Doesn't each object already have the parent properties included in > >>> it

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Wayne Sherman via fpc-devel
On Sat, Jan 14, 2023 at 10:34 AM Michael Van Canneyt wrote: > On Sat, 14 Jan 2023, Wayne Sherman wrote: > > 3) Why does MarkPropertyChanged offset the index and > > IsPropertyModified does not take the offset into account? > > They should be the same. I don't remember why I created the two methods

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Michael Van Canneyt via fpc-devel
On Sat, 14 Jan 2023, Wayne Sherman wrote: On Sat, Jan 14, 2023 at 10:34 AM Michael Van Canneyt wrote: On Sat, 14 Jan 2023, Wayne Sherman wrote: 2) Doesn't each object already have the parent properties included in its own properties by inheritance? Why this question ? An object does not k

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Wayne Sherman via fpc-devel
On Sat, Jan 14, 2023 at 10:34 AM Michael Van Canneyt wrote: > On Sat, 14 Jan 2023, Wayne Sherman wrote: > > 2) Doesn't each object already have the parent properties included in > > its own properties by inheritance? > > Why this question ? > An object does not know the property count of the parent

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Michael Van Canneyt via fpc-devel
On Sat, 14 Jan 2023, Wayne Sherman wrote: On Fri, Jan 13, 2023 at 11:48 PM Michael Van Canneyt wrote: Markpropertychanged is called in the setter of the properties generated by the code generator: Check all generated units. Thanks for your explanations, it is getting more clear how modifie

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-14 Thread Wayne Sherman via fpc-devel
On Fri, Jan 13, 2023 at 11:48 PM Michael Van Canneyt wrote: > Markpropertychanged is called in the setter of the properties generated by > the code generator: Check all generated units. Thanks for your explanations, it is getting more clear how modified property tracking is being used. More clari

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-13 Thread Michael Van Canneyt via fpc-devel
On Fri, 13 Jan 2023, Wayne Sherman via fpc-devel wrote: Is there a better way to track changed TBaseObject properties (and get rid of property index declarations)? Not to my knowledge. If there had been, I would have used it. The advantage of the index as opposed to using a custom assigned

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-13 Thread Michael Van Canneyt via fpc-devel
On Fri, 13 Jan 2023, Wayne Sherman via fpc-devel wrote: Some related misunderstandings: 1) When StopRecordPropertyChanges is called it destroys all the change records (stored in TBits) in which case SaveToJSON saves ALL the properties even if they were not loaded or modified previously. Th

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-13 Thread Michael Van Canneyt via fpc-devel
On Fri, 13 Jan 2023, Wayne Sherman via fpc-devel wrote: I am trying to check the googleapiconv "TGoogleRestDescription" object contents (which is descended from restbase TBaseObject) by using "SaveToJSON". But it always saves an empty object, even when the properties have values assigned to

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-13 Thread Wayne Sherman via fpc-devel
Is there a better way to track changed TBaseObject properties (and get rid of property index declarations)? Lazarus knows which properties on a form have been changed from their default value and only properties which do not match the default are saved in the lfm file. Can the same thing be used

Re: [fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-13 Thread Wayne Sherman via fpc-devel
Some related misunderstandings: 1) When StopRecordPropertyChanges is called it destroys all the change records (stored in TBits) in which case SaveToJSON saves ALL the properties even if they were not loaded or modified previously. 2) Nothing in restbase.pp or TBaseObject calls MarkPropertyChange

[fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

2023-01-13 Thread Wayne Sherman via fpc-devel
I am trying to check the googleapiconv "TGoogleRestDescription" object contents (which is descended from restbase TBaseObject) by using "SaveToJSON". But it always saves an empty object, even when the properties have values assigned to them (via LoadFromJSON). https://gitlab.com/freepascal.org/fp