| 1279 | // This doesn't seem to link well on MSVC6 |
| 1280 | template<class A, class B> |
| 1281 | B* refCast(A* a) |
| 1282 | { |
| 1283 | // If the handle already is a null handle, then just return the null handle |
| 1284 | if( !a ) return 0; |
| 1285 | |
| 1286 | // Now try to dynamically cast the pointer to the wanted type |
| 1287 | B* b = dynamic_cast<B*>(a); |
| 1288 | if( b != 0 ) |
| 1289 | { |
| 1290 | // Since the cast was made, we need to increase the ref counter for the returned handle |
| 1291 | b->AddRef(); |
| 1292 | } |
| 1293 | return b; |
| 1294 | } |
| 1295 | #endif |
| 1296 | |
| 1297 | MovieClip *MovieClipFactory() |