incomplete understanding of kFBL_CASCADE (or FBL_DeletionControl)

Arthur Clemens aclemens at xs4all.nl
Sat Oct 25 13:58:27 CDT 2003


>
>
> class boRecordSection : public VDK_BaseObject
> {
> public:
>      VDK_ObjectPtr mfParentPtr; // pointer to boRecord
>
> public:
>
>      boRecordSection( boRecord* inRecord )
>     :
>          VDK_BaseObject( "Record section" )
>     ,
>          mfParentPtr( "Parent", inRecord, kFBL_CASCADE )
>     {
>     }
>
>
> The second parameter of ObjectPtr must be POINTER on BaseObject.
>
> I even wonder how you was able compile with FBL_REC_ID here!?


I was confused because AddRecord *does* set mfParentPtr = 
(FBL_REC_ID)inParentID, but looking at VDK_ObjectPtr.h, the = operator 
is overridden, so no confusion now. (Aside: the header file uses 
inPointedObject, where the documentation calls it inTargetObject - p. 
18 VSDKReference.pdf).

This works now (with a modified DatabaseDefinition constructor):

DatabaseDefinition() {
         mRecord = new boRecord();
         mRecordSection = new boRecordSection(mRecord);
     }
/* ... */
void AddRecord(FBL_REC_ID inParentID) {
         this->SetBlank(); // Clear memory buffer of the BaseObject
         mfParentPtr = inParentID;
         // ... some things like filling Grammar fields (Grammar will be 
a child of boRecordSection)
         VDK_BaseObject::AddRecord();
         Flush(); // from cache to disk
     }

thanks for the help.

Arthur


More information about the Valentina mailing list