1//------------------------------------------------------------------------------
2//	Copyright (c) 2001-2002, Haiku
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
46class BMessage;
47
48// BArchivable class -----------------------------------------------------------
49class BArchivable {
50public:
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
61private:
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
73typedef BArchivable* (*instantiation_func) (BMessage *);
74
75bool				validate_instantiation(BMessage* from,
76												   const char* class_name);
77
78
79//------------------------------------------------------------------------------
80
81
82#endif	// _ARCHIVABLE_H
83