Opened 14 years ago
Closed 14 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 |
Description
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)
Change History (7)
by , 14 years ago
Attachment: | layoutArchiving.patch added |
---|
comment:1 by , 14 years ago
patch: | 0 → 1 |
---|
comment:2 by , 14 years ago
Blocked By: | 6256 added |
---|
comment:3 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
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.
comment:4 by , 14 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 , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.
Patch implementing archiving in these classes, on its own this patch does very little though :P