ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/traits.h
(Generate patch)

Comparing deliantra/server/include/traits.h (file contents):
Revision 1.1 by root, Thu Aug 31 09:19:34 2006 UTC vs.
Revision 1.4 by root, Sat Sep 16 22:24:12 2006 UTC

1#ifndef TRAITS_H__ 1#ifndef TRAITS_H__
2#define TRAITS_H__ 2#define TRAITS_H__
3 3
4struct pl; 4struct player;
5struct object; 5struct object;
6struct mapstruct; 6struct maptile;
7struct archt; 7struct archetype;
8struct region; 8struct region;
9struct party; 9struct party;
10struct mapstruct; 10struct treasurelist;
11 11
12// could have used templates, but a more traditional C api 12// could have used templates, but a more traditional C api
13// uses more explicit typing which is ok for this purpose. 13// uses more explicit typing which is ok for this purpose.
14enum data_type 14enum data_type
15{ 15{
33template<typename T> 33template<typename T>
34struct cftype { }; 34struct cftype { };
35 35
36template<> 36template<>
37struct cftype<int> { 37struct cftype<int> {
38 enum { dt = DT_INT }; 38 static const data_type dt = DT_INT;
39}; 39};
40 40
41template<> 41template<>
42struct cftype<sint64> { 42struct cftype<sint64> {
43 enum { dt = DT_INT64 }; 43 static const data_type dt = DT_INT64;
44}; 44};
45 45
46template<> 46template<>
47struct cftype<double> { 47struct cftype<double> {
48 enum { dt = DT_DOUBLE }; 48 static const data_type dt = DT_DOUBLE;
49}; 49};
50 50
51template<> 51template<>
52struct cftype<const char *> { 52struct cftype<const char *> {
53 enum { dt = DT_STRING }; 53 static const data_type dt = DT_STRING;
54}; 54};
55 55
56template<> 56template<>
57struct cftype<object> { 57struct cftype<object> {
58 enum { dt = DT_OBJECT }; 58 static const data_type dt = DT_OBJECT;
59}; 59};
60 60
61template<> 61template<>
62struct cftype<struct pl> { 62struct cftype<player> {
63 enum { dt = DT_PLAYER }; 63 static const data_type dt = DT_PLAYER;
64}; 64};
65 65
66template<> 66template<>
67struct cftype<mapstruct> { 67struct cftype<maptile> {
68 enum { dt = DT_MAP }; 68 static const data_type dt = DT_MAP;
69}; 69};
70 70
71template<> 71template<>
72struct cftype<struct archt> { 72struct cftype<archetype> {
73 enum { dt = DT_ARCH }; 73 static const data_type dt = DT_ARCH;
74}; 74};
75 75
76template<> 76template<>
77struct cftype<party> { 77struct cftype<party> {
78 enum { dt = DT_PARTY }; 78 static const data_type dt = DT_PARTY;
79}; 79};
80 80
81template<> 81template<>
82struct cftype<region> { 82struct cftype<region> {
83 enum { dt = DT_REGION }; 83 static const data_type dt = DT_REGION;
84};
85
86template<>
87struct cftype<treasurelist> {
88 static const data_type dt = DT_REGION;
84}; 89};
85 90
86#endif 91#endif
87 92

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines