mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Added macros for fancy C++ casts.
This commit is contained in:
parent
45fedef1f0
commit
9ec2d30af9
@ -136,4 +136,22 @@ typedef PRUcs2 PRUnichar;
|
||||
#define NS_PLUGIN NS_IMPORT
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
// Casting macros for hiding C++ features from older compilers
|
||||
#if defined(HAS_C_PLUS_PLUS_CASTS)
|
||||
#define NS_STATIC_CAST(__type, __ptr) static_cast<__type>(__ptr)
|
||||
#define NS_CONST_CAST(__type, __ptr) const_cast<__type>(__ptr)
|
||||
#define NS_REINTERPRET_CAST(__type, __ptr) reinterpret_cast<__type>(__ptr)
|
||||
#else
|
||||
#define NS_STATIC_CAST(__type, __ptr) ((__type)(__ptr))
|
||||
#define NS_CONST_CAST(__type, __ptr) ((__type)(__ptr))
|
||||
#define NS_REINTERPRET_CAST(__type, __ptr) ((__type)(__ptr))
|
||||
#endif
|
||||
|
||||
#if defined(HAS_C_PLUS_PLUS_CASTS) && defined(HAS_RTTI)
|
||||
#define NS_DYNAMIC_CAST(__type, __ptr) dynamic_cast<__type>(__ptr)
|
||||
#else
|
||||
#define NS_DYNAMIC_CAST(__type, __ptr) ((__type)(__ptr))
|
||||
#endif
|
||||
|
||||
#endif /* nscore_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user