1#ifndef NW_G3D_RES_DEFS_H_
2#define NW_G3D_RES_DEFS_H_
4#include <nw/g3d/g3d_config.h>
8#define NW_G3D_RES_DIC(offset) ResDicType::ResCast(offset.to_ptr<ResDicType::DataType>())
10#define NW_G3D_RES_FIELD_DIC_LOOKUP_IDX_DECL(name)
11 int Get##name##Index(const char* str) const
15 int Get##name##Index(const ResName* str) const
19 const char* Get##name##Name(int elemIndex) const
26#define NW_G3D_RES_FIELD_DIC_LOOKUP_DECL(type, name)
27 int Get##name##Count() const { return ref().num##name; }
28 type* Get##name(const char* str)
31 return type::ResCast(static_cast<type##Data*>(ptr));
33 type* Get##name(const ResName* str)
36 return type::ResCast(static_cast<type##Data*>(ptr));
38 const type* Get##name(const char* str) const
41 return type::ResCast(static_cast<type##Data*>(ptr));
43 const type* Get##name(const ResName* str) const
46 return type::ResCast(static_cast<type##Data*>(ptr));
51#define NW_G3D_RES_FIELD_DIC_DECL(type, name)
53 type* Get##name(int elemIndex)
57 return type::ResCast(static_cast<type##Data*>(ptr));
59 const type* Get##name(int elemIndex) const
63 return type::ResCast(static_cast<type##Data*>(ptr));
67#define NW_G3D_RES_FIELD_STR_DIC_DECL(name)
69 int Get##name##Count() const { return ref().num##name; }
70 const char* Get##name(const char* str) const
72 return static_cast<const char*>(NW_G3D_RES_DIC(ref().ofs##name##Dic)->Find(str));
74 const char* Get##name(const ResName* str) const
76 return static_cast<const char*>(NW_G3D_RES_DIC(ref().ofs##name##Dic)->Find(str));
78 const char* Get##name(int elemIndex) const
81 return static_cast<const char*>(NW_G3D_RES_DIC(ref().ofs##name##Dic)->Get(elemIndex));
85#define NW_G3D_RES_FIELD_EMPTY_DIC_DECL(name)
87 int Get##name##Count() const { return ref().num##name; }
92#define NW_G3D_RES_FIELD_CLASS_ARRAY_DECL(type, name)
93 int Get##name##Count() const { return ref().num##name; }
94 type* Get##name(int elemIndex)
97 type##Data* pArray = ref().ofs##name##Array.to_ptr<type##Data>();
98 return type::ResCast(&pArray[elemIndex]);
100 const type* Get##name(int elemIndex) const
103 const type##Data* pArray = ref().ofs##name##Array.to_ptr<type##Data>();
104 return type::ResCast(const_cast<type##Data*>(&pArray[elemIndex]));
108#define NW_G3D_RES_FIELD_CLASS_NAMED_ARRAY_DECL(type, name)
110 type* Get##name(int elemIndex)
113 type##Data* pArray = ref().ofs##name##Array.to_ptr<type##Data>();
114 return type::ResCast(&pArray[elemIndex]);
116 const type* Get##name(int elemIndex) const
119 const type##Data* pArray = ref().ofs##name##Array.to_ptr<type##Data>();
120 return type::ResCast(const_cast<type##Data*>(&pArray[elemIndex]));
124#define NW_G3D_RES_FIELD_CLASS_DECL(type, name)
125 type* Get##name() { return type::ResCast(ref().ofs##name.to_ptr<type##Data>()); }
126 const type* Get##name() const { return type::ResCast(ref().ofs##name.to_ptr<type##Data>()); }
129#define NW_G3D_RES_FIELD_DEREFERENCE_DECL(type)
130 Res##type* Get() { return Res##type::ResCast(ref().ofsRefData.to_ptr<Res##type##Data>()); }
131 const Res##type* Get() const
133 return Res##type::ResCast(ref().ofsRefData.to_ptr<Res##type##Data>());
137#define NW_G3D_RES_FIELD_STRING_DECL(name)
138 const char* Get##name() const { return ref().ofs##name.to_ptr(); }
#define NW_G3D_RES_FIELD_DIC_LOOKUP_IDX_DECL(name)
Definition g3d_ResDefs.h:10
#define NW_G3D_RES_FIELD_DIC_LOOKUP_DECL(type, name)
Definition g3d_ResDefs.h:26
#define NW_G3D_RES_ASSERT_INDEX(name, idx)
Definition g3d_ResDefs.h:6
#define NW_G3D_RES_DIC(offset)
Definition g3d_ResDefs.h:8
#define NW_G3D_ASSERT_INDEX_BOUNDS(index, size)
Definition g3d_assert.h:23