2007-01-26 19:36:29 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _ARCHIVABLE_H
|
|
|
|
#define _ARCHIVABLE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <image.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BMessage;
|
|
|
|
|
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
class BArchivable {
|
|
|
|
public:
|
|
|
|
BArchivable(BMessage* from);
|
|
|
|
BArchivable();
|
|
|
|
virtual ~BArchivable();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
// Private or reserved
|
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
private:
|
|
|
|
virtual void _ReservedArchivable1();
|
|
|
|
virtual void _ReservedArchivable2();
|
|
|
|
virtual void _ReservedArchivable3();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
uint32 _reserved[2];
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
// global functions
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
typedef BArchivable* (*instantiation_func)(BMessage*);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
BArchivable* instantiate_object(BMessage *from, image_id *id);
|
|
|
|
BArchivable* instantiate_object(BMessage *from);
|
|
|
|
bool validate_instantiation(BMessage* from, const char* className);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-26 19:36:29 +03:00
|
|
|
instantiation_func find_instantiation_func(const char* className,
|
|
|
|
const char* signature);
|
|
|
|
instantiation_func find_instantiation_func(const char* className);
|
|
|
|
instantiation_func find_instantiation_func(BMessage* archive);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#endif // _ARCHIVABLE_H
|