Opened 11 years ago

Closed 11 years ago

#6257 closed enhancement (fixed)

Implement basic archiving for BLayout and BLayoutItem classes.

Reported by: yourpalal Owned by: pulkomandy
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1/Development
Keywords: Cc:
Blocked By: #6256 Blocking: #5525
Platform: All


To beat ticket #5525, we must have a method for archiving a layout hierarchy alongside a BView hierarchy. To do this, both BLayout and BLayoutItem must inherit from BArchivable. In addition to this, I've added two new methods to BLayout: ArchiveLayoutData() and RestoreItemAndData(), the first is called during archiving to allow a BLayout to add any extra data for an item into its archive (the data stored in BLayoutItem::fLayoutData, for instance). BLayout::RestoreItemAndData() is called in BLayoutItem::AllUnarchived(), and implementations of this method will add the item in question to the layout, using the data that was stored in ArchiveLayoutData().

Attachments (2)

layoutArchiving.patch (6.4 KB ) - added by yourpalal 11 years ago.
Patch implementing archiving in these classes, on its own this patch does very little though :P
layoutArchiving.2.patch (9.3 KB ) - added by yourpalal 11 years ago.
Updated patch.

Download all attachments as: .zip

Change History (7)

by yourpalal, 11 years ago

Attachment: layoutArchiving.patch added

Patch implementing archiving in these classes, on its own this patch does very little though :P

comment:1 by yourpalal, 11 years ago

patch: 01

comment:2 by yourpalal, 11 years ago

Blocked By: 6256 added

comment:3 by pulkomandy, 11 years ago

Owner: changed from axeld to pulkomandy
Status: newassigned

As Ingo is reviewing the other patch, I'll have a look at this one.

  • Layout.cpp

line 17: what is this anonymous namespace for ? To hide things from the API users, you should use the BPrivate namespace. And I'm not sure it's useful here.

line 39: a while loop would be more readable here, I think.

Many places in the code: 2 blank lines between blocks. This include the anonymous namespace in layoutitem.cpp, and most of the methods you added. The comment stating the method name isn't really usefull, either.

Otherwise, the patch looks fine. I'm waiting for the blocking one to be commited first, obviously.

by yourpalal, 11 years ago

Attachment: layoutArchiving.2.patch added

Updated patch.

comment:4 by yourpalal, 11 years ago

I've attached an updated patch, where replaced the for loop at 39 with a while, and have also modified the archiving process. I had originally put those comments in because the rest of the file had them as well, but I always felt they were useless, so they're gone now. The anonymous namespace is to give those string constants hidden linkage, that way they can't collide with another variable with the same name somewhere in libbe. Its essentially the same as using the static keyword.

comment:5 by pulkomandy, 11 years ago

Resolution: fixed
Status: assignedclosed

Applied in hrev37433.

  • You must keep #include <Layout.h> as the first include of Layout.cpp to ensure the header is self-contained.
  • There were some occurences of not skipping two lines between logical blocks in the file.
Note: See TracTickets for help on using tickets.