1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2001-2002, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: Archivable.h 23 // Author: Erik Jaesler (erik@cgsoftware.com) 24 // Description: BArchivable mix-in class defines the archiving 25 // protocol. Also some global archiving functions. 26 //------------------------------------------------------------------------------ 27 28 #ifndef _ARCHIVABLE_H 29 #define _ARCHIVABLE_H 30 31 // Standard Includes ----------------------------------------------------------- 32 33 // System Includes ------------------------------------------------------------- 34 #include <BeBuild.h> 35 #include <image.h> 36 #include <SupportDefs.h> 37 38 // Project Includes ------------------------------------------------------------ 39 40 // Local Includes -------------------------------------------------------------- 41 42 // Local Defines --------------------------------------------------------------- 43 44 // Globals --------------------------------------------------------------------- 45 46 class BMessage; 47 48 // BArchivable class ----------------------------------------------------------- 49 class BArchivable { 50 public: 51 BArchivable(); 52 virtual ~BArchivable(); 53 54 BArchivable(BMessage* from); 55 virtual status_t Archive(BMessage* into, bool deep = true) const; 56 static BArchivable *Instantiate(BMessage* from); 57 58 // Private or reserved --------------------------------------------------------- 59 virtual status_t Perform(perform_code d, void* arg); 60 61 private: 62 63 virtual void _ReservedArchivable1(); 64 virtual void _ReservedArchivable2(); 65 virtual void _ReservedArchivable3(); 66 67 uint32 _reserved[2]; 68 }; 69 70 71 // Global Functions ------------------------------------------------------------ 72 73 typedef BArchivable* (*instantiation_func) (BMessage *); 74 75 _IMPEXP_BE BArchivable* instantiate_object(BMessage *from, image_id *id); 76 _IMPEXP_BE BArchivable* instantiate_object(BMessage *from); 77 _IMPEXP_BE bool validate_instantiation(BMessage* from, 78 const char* class_name); 79 80 _IMPEXP_BE instantiation_func find_instantiation_func(const char* class_name, 81 const char* sig); 82 _IMPEXP_BE instantiation_func find_instantiation_func(const char* class_name); 83 _IMPEXP_BE instantiation_func find_instantiation_func(BMessage* archive_data); 84 85 86 //------------------------------------------------------------------------------ 87 88 89 #endif // _ARCHIVABLE_H 90 91 /* 92 * $Log $ 93 * 94 * $Id $ 95 * 96 */ 97 98