5
5
6
6
7
7
struct som_passport_t ;
8
+ struct som_asset_class_t ;
8
9
9
10
typedef UINT64 som_atom_t ;
10
11
11
- struct som_asset_t ;
12
+ typedef struct som_asset_t {
13
+ struct som_asset_class_t * isa;
14
+ } som_asset_t ;
12
15
13
- struct som_asset_class_t {
16
+ typedef struct som_asset_class_t {
14
17
long (*asset_add_ref)(som_asset_t * thing);
15
18
long (*asset_release)(som_asset_t * thing);
16
19
long (*asset_get_interface)(som_asset_t * thing, const char * name, void ** out);
17
- som_passport_t * (*asset_get_passport)(som_asset_t * thing);
18
- };
20
+ struct som_passport_t * (*asset_get_passport)(som_asset_t * thing);
21
+ } som_asset_class_t ;
19
22
20
- struct som_asset_t {
21
- som_asset_class_t * isa;
22
- };
23
23
24
24
inline som_asset_class_t * som_asset_get_class (const som_asset_t * pass)
25
25
{
26
- return pass ? pass->isa : nullptr ;
26
+ return pass ? pass->isa : 0 ;
27
27
}
28
28
29
29
som_atom_t SCAPI SciterAtomValue (const char * name);
@@ -49,7 +49,7 @@ namespace sciter {
49
49
template <class R > class hasset ;
50
50
51
51
// implementation of som_asset_t ISA
52
- // note: does not define asset_add_ref()/asset_release() as they shall be defined in specializations
52
+ // note: does not define asset_add_ref()/asset_release() as they shall be defined in specializations
53
53
template <class A >
54
54
class iasset : public som_asset_t
55
55
{
@@ -65,8 +65,8 @@ namespace sciter {
65
65
if (out) { this ->asset_add_ref (); *out = this ; }
66
66
return true ;
67
67
}
68
- virtual som_passport_t * asset_get_passport () const {
69
- return nullptr ;
68
+ virtual som_passport_t * asset_get_passport () const {
69
+ return nullptr ;
70
70
}
71
71
72
72
static som_asset_class_t * get_asset_class () {
@@ -87,7 +87,7 @@ namespace sciter {
87
87
static const char * interface_name () { return " asset.sciter.com" ; }
88
88
// template<class C> hasset<C> interface_of() { hasset<C> p; get_interface(C::interface_name(), p.target()); return p; }
89
89
};
90
-
90
+
91
91
inline long asset_add_ref (som_asset_t *ptr) {
92
92
assert (ptr);
93
93
assert (ptr->isa );
@@ -106,7 +106,7 @@ namespace sciter {
106
106
assert (ptr->isa ->asset_get_interface );
107
107
return ptr->isa ->asset_get_interface (ptr, name, out);
108
108
}
109
-
109
+
110
110
inline som_passport_t * asset_get_passport (som_asset_t *ptr) {
111
111
assert (ptr);
112
112
assert (ptr->isa );
@@ -118,7 +118,7 @@ namespace sciter {
118
118
assert (ptr);
119
119
return ptr->isa ;
120
120
}
121
-
121
+
122
122
// hasset - yet another shared_ptr
123
123
// R here is an entity derived from som_asset_t
124
124
template <class R > class hasset
@@ -164,9 +164,9 @@ namespace sciter {
164
164
void ** target () { release (); return (void **)&p; }
165
165
166
166
};
167
-
167
+
168
168
// reference counted asset, uses intrusive add_ref/release counter
169
- template <class C >
169
+ template <class C >
170
170
class asset : public iasset <asset<C>>
171
171
{
172
172
std::atomic<long > _ref_cntr;
@@ -215,4 +215,4 @@ namespace sciter {
215
215
216
216
#include " sciter-om-def.h"
217
217
218
- #endif
218
+ #endif
0 commit comments