1 /* $Header: d:/cvsroot/tads/tads3/vmres.h,v 1.2 1999/05/17 02:52:30 MJRoberts Exp $ */
2 
3 /*
4  *   Copyright (c) 1999, 2002 Michael J. Roberts.  All Rights Reserved.
5  *
6  *   Please see the accompanying license file, LICENSE.TXT, for information
7  *   on using and copying this software.
8  */
9 /*
10 Name
11   vmres.h - resource object implementation
12 Function
13   A resource is a named binary byte stream stored within the image
14   file.  To the VM, resources are opaque; the VM merely maintains the
15   resource name table, and provides access to the byte stream to the
16   user program.
17 Notes
18 
19 Modified
20   04/03/99 MJRoberts  - Creation
21 */
22 
23 #ifndef VMRES_H
24 #define VMRES_H
25 
26 #include <stdlib.h>
27 #include "t3std.h"
28 
29 class CVmResource
30 {
31     friend class CVmImageLoader;
32 
33 public:
34     CVmResource(long seek_pos, uint32 len, size_t name_len);
35     ~CVmResource();
36 
37     /* get the seek position */
get_seek_pos()38     long get_seek_pos() const { return seek_pos_; }
39 
40     /* get the length of the byte stream */
get_len()41     uint32 get_len() const { return len_; }
42 
43     /* get my name */
get_name()44     const char *get_name() const { return name_; }
45 
46     /* get/set next resource in list */
get_next()47     CVmResource *get_next() const { return nxt_; }
set_next(CVmResource * nxt)48     void set_next(CVmResource *nxt) { nxt_ = nxt; }
49 
50 private:
51     /* get my name buffer */
get_name_buf()52     char *get_name_buf() const { return name_; }
53 
54     /* seek position in image file of my binary data */
55     long seek_pos_;
56 
57     /* length in bytes of my binary data stream */
58     uint32 len_;
59 
60     /* name string */
61     char *name_;
62 
63     /* next resource in list */
64     CVmResource *nxt_;
65 };
66 
67 #endif /* VMRES_H */
68