vfs: check userland buffers before reading them.
[haiku.git] / headers / build / os / support / Archivable.h
blobaeaefd9efd1647cb7b0974e29fae992db4973991
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:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
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.
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 //------------------------------------------------------------------------------
28 #ifndef _ARCHIVABLE_H
29 #define _ARCHIVABLE_H
31 // Standard Includes -----------------------------------------------------------
33 // System Includes -------------------------------------------------------------
34 #include <BeBuild.h>
35 #include <image.h>
36 #include <SupportDefs.h>
38 // Project Includes ------------------------------------------------------------
40 // Local Includes --------------------------------------------------------------
42 // Local Defines ---------------------------------------------------------------
44 // Globals ---------------------------------------------------------------------
46 class BMessage;
48 // BArchivable class -----------------------------------------------------------
49 class BArchivable {
50 public:
51 BArchivable();
52 virtual ~BArchivable();
54 BArchivable(BMessage* from);
55 virtual status_t Archive(BMessage* into, bool deep = true) const;
56 static BArchivable *Instantiate(BMessage* from);
58 // Private or reserved ---------------------------------------------------------
59 virtual status_t Perform(perform_code d, void* arg);
61 private:
63 virtual void _ReservedArchivable1();
64 virtual void _ReservedArchivable2();
65 virtual void _ReservedArchivable3();
67 uint32 _reserved[2];
71 // Global Functions ------------------------------------------------------------
73 typedef BArchivable* (*instantiation_func) (BMessage *);
75 bool validate_instantiation(BMessage* from,
76 const char* class_name);
79 //------------------------------------------------------------------------------
82 #endif // _ARCHIVABLE_H