|BArchiver (BMessage *archive)|
|Constructs a BArchiver object that manages |
|Destroys a BArchiver object. If the BArchiver object has not had its Finish() method called, this will be done now. More...|
|status_t||AddArchivable (const char *name, BArchivable *archivable, bool deep=true)|
|Adds a reference to |
|BMessage *||ArchiveMessage () const|
|Returns the BMessage* used to construct this BArchiver. This is the archive that AddArchivable() modifies. More...|
|status_t||Finish (status_t err=B_OK)|
|Report any archiving errors and possibly complete the archiving session. More...|
|status_t||GetTokenForArchivable (BArchivable *archivable, int32 &_token)|
|Equivalent to calling the expanded GetTokenForArchivable( BArchivable*, bool, int32&), with the deep parameter equal to |
|status_t||GetTokenForArchivable (BArchivable *archivable, bool deep, int32 &_token)|
|Get a token representing a BArchivable object for this archiving session. More...|
|bool||IsArchived (BArchivable *archivable)|
|Returns whether |
A class that simplifies the archiving of complicated BArchivable hierarchies.
The BArchiver class is a small class that is used for archiving of complicated BArchivable hierarchies. Such a hierarchy may include multiple BArchivable objects, each of which might be referenced by many BArchivable objects. With the BArchiver class, you can be certain that each BArchivable object is archived only once with very little work. When used in conjuction with the BArchivable::AllArchived() and BArchivable::AllUnarchived() methods, it is simple to rebuild your system of references upon unarchival so that they are equivalent to those that were present in your original hierarchy.
The objects you archive can be retrieved using a BUnarchiver object.
Constructs a BArchiver object that manages
Adds a reference to
archivable to the archive used to construct this BArchiver. May call
archivable's Archive() method.
|name||Where this reference will be stored in the archive.|
|archivable||The BArchivable* object that to reference.|
|deep||Passed to |
Adds a reference to
archivable to your archive. If
archivable has not yet been archived, then its Archive() method is called. BArchiver can only track BArchivable objects that have been archived through this method or the GetTokenForArchivable() methods.
|const BMessage * BArchiver::ArchiveMessage||(||)||const|
Report any archiving errors and possibly complete the archiving session.
This method may finish an archiving session (triggering the call of all archived objects' AllArchived() methods) if the following conditions are true:
If you call this method with an error code not equal to B_OK, then this archiving session has failed, archived objects will not have their AllArchived() methods called, and any subsequent calls to this method on any BArchiver objects in this session will return your error code.
Equivalent to calling the expanded GetTokenForArchivable( BArchivable*, bool, int32&), with the deep parameter equal to
Get a token representing a BArchivable object for this archiving session.
|archivable||The BArchivable object for which you wish to get a token.|
|deep||Controls how |
|[out]||_token||The token representing |
Retrieves or creates a token to represent
archivable in this archiving session. If
archivable has not yet been archived, it will be now. If
archivable gets archived, the
deep parameter will be passed to its Archive() method.
|bool BArchiver::IsArchived||(||BArchivable *||archivable||)|
archivable has already been archived in this session.