ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
datum.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MEDIASTATION_DATUM_H
23 #define MEDIASTATION_DATUM_H
24 
25 #include "common/str.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "common/stream.h"
29 
30 #include "mediastation/datafile.h"
31 
32 namespace MediaStation {
33 
34 enum DatumType {
35  // This type isn't a type we see in data files; it is just a
36  // default initialization value.
37  kDatumTypeInvalid = 0x0000,
38 
39  kDatumTypeUint8 = 0x0002,
40  // TODO: Understand why there are different (u)int16 type codes.
41  kDatumTypeUint16_1 = 0x0003,
42  kDatumTypeUint16_2 = 0x0013,
43  kDatumTypeInt16_1 = 0x0006,
44  kDatumTypeInt16_2 = 0x0010,
45  // TODO: Understand why there are two different uint32 type codes.
46  kDatumTypeUint32_1 = 0x0004,
47  kDatumTypeUint32_2 = 0x0007,
48  // TODO: Understand why there are two different float64 type codes.
49  kDatumTypeFloat64_1 = 0x0011,
50  kDatumTypeFloat64_2 = 0x0009,
51  kDatumTypeString = 0x0012,
52  kDatumTypeFilename = 0x000a,
53  kDatumTypePoint1 = 0x000f,
54  kDatumTypePoint2 = 0x000e,
55  kDatumTypeBoundingBox = 0x000d,
56  kDatumTypePolygon = 0x001d,
57  // These are other types.
58  kDatumTypePalette = 0x05aa,
59  kDatumTypeReference = 0x001b
60 };
61 
62 // It is the caller's responsibility to delete any heap items
63 // that are created as part of a datum. The datum is really
64 // just a container.
65 class Datum {
66 public:
67  DatumType t;
68  union {
69  int i;
70  double f;
71  uint32 chunkRef;
72  Common::String *string;
74  Common::Point *point;
75  Common::Rect *bbox;
76  unsigned char *palette;
77  } u;
78 
79  Datum();
81  Datum(Common::SeekableReadStream &chunk, DatumType expectedType);
82 
83 private:
84  void readWithType(Common::SeekableReadStream &chunk);
85 };
86 
87 } // End of namespace MediaStation
88 
89 #endif
Definition: str.h:59
Definition: asset.h:33
Definition: array.h:52
Definition: rect.h:144
Definition: stream.h:745
Definition: datum.h:65
Definition: rect.h:45