1 /* 2 * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _ARCHIVABLE_H 6 #define _ARCHIVABLE_H 7 8 9 #include <BeBuild.h> 10 #include <image.h> 11 #include <SupportDefs.h> 12 13 14 class BMessage; 15 16 17 class BArchivable { 18 public: 19 BArchivable(BMessage* from); 20 BArchivable(); 21 virtual ~BArchivable(); 22 23 virtual status_t Archive(BMessage* into, bool deep = true) const; 24 static BArchivable* Instantiate(BMessage* archive); 25 26 // Private or reserved 27 virtual status_t Perform(perform_code d, void* arg); 28 29 private: 30 virtual void _ReservedArchivable1(); 31 virtual void _ReservedArchivable2(); 32 virtual void _ReservedArchivable3(); 33 34 uint32 _reserved[2]; 35 }; 36 37 38 // global functions 39 40 typedef BArchivable* (*instantiation_func)(BMessage*); 41 42 BArchivable* instantiate_object(BMessage *from, image_id *id); 43 BArchivable* instantiate_object(BMessage *from); 44 bool validate_instantiation(BMessage* from, const char* className); 45 46 instantiation_func find_instantiation_func(const char* className, 47 const char* signature); 48 instantiation_func find_instantiation_func(const char* className); 49 instantiation_func find_instantiation_func(BMessage* archive); 50 51 #endif // _ARCHIVABLE_H 52