2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
7 #include "ArchivingUtils.h"
13 ArchivingUtils::ArchiveChild(BArchivable
* object
, BMessage
& parentArchive
,
14 const char* fieldName
)
20 status_t error
= object
->Archive(&archive
, true);
24 return parentArchive
.AddMessage(fieldName
, &archive
);
28 /*static*/ BArchivable
*
29 ArchivingUtils::UnarchiveChild(const BMessage
& parentArchive
,
30 const char* fieldName
, int32 index
)
33 if (parentArchive
.FindMessage(fieldName
, index
, &archive
) != B_OK
)
36 return instantiate_object(&archive
);