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 <image.h> 10 #include <SupportDefs.h> 11 12 13 class BMessage; 14 15 16 class BArchivable { 17 public: 18 BArchivable(BMessage* from); 19 BArchivable(); 20 virtual ~BArchivable(); 21 22 virtual status_t Archive(BMessage* into, bool deep = true) const; 23 static BArchivable* Instantiate(BMessage* archive); 24 25 // Private or reserved 26 virtual status_t Perform(perform_code d, void* arg); 27 28 private: 29 virtual void _ReservedArchivable1(); 30 virtual void _ReservedArchivable2(); 31 virtual void _ReservedArchivable3(); 32 33 uint32 _reserved[2]; 34 }; 35 36 37 // global functions 38 39 typedef BArchivable* (*instantiation_func)(BMessage*); 40 41 BArchivable* instantiate_object(BMessage *from, image_id *id); 42 BArchivable* instantiate_object(BMessage *from); 43 bool validate_instantiation(BMessage* from, const char* className); 44 45 instantiation_func find_instantiation_func(const char* className, 46 const char* signature); 47 instantiation_func find_instantiation_func(const char* className); 48 instantiation_func find_instantiation_func(BMessage* archive); 49 50 #endif // _ARCHIVABLE_H 51