#include "prtypes.h"
#include "nsError.h"
Go to the source code of this file.
Defines | |
#define | NS_VISIBILITY_HIDDEN |
#define | NS_VISIBILITY_DEFAULT |
#define | NS_HIDDEN_(type) NS_VISIBILITY_HIDDEN type |
#define | NS_EXTERNAL_VIS_(type) NS_VISIBILITY_DEFAULT type |
#define | NS_HIDDEN NS_VISIBILITY_HIDDEN |
#define | NS_EXTERNAL_VIS NS_VISIBILITY_DEFAULT |
#define | IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN |
#define | NS_FASTCALL |
#define | NS_DEFCALL |
#define | NS_IMPORT NS_EXTERNAL_VIS |
#define | NS_IMPORT_(type) NS_EXTERNAL_VIS_(type) |
#define | NS_EXPORT NS_EXTERNAL_VIS |
#define | NS_EXPORT_(type) NS_EXTERNAL_VIS_(type) |
#define | NS_IMETHOD_(type) virtual IMETHOD_VISIBILITY type NS_DEFCALL |
#define | NS_IMETHODIMP_(type) type |
#define | NS_METHOD_(type) type |
#define | NS_CALLBACK_(_type, _name) _type (* _name) |
#define | NS_STDCALL |
#define | NS_EXPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type) |
#define | NS_IMPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type) |
#define | NS_STDCALL_FUNCPROTO(ret, name, class, func, args) ret (NS_STDCALL class::*name) args |
#define | NS_IMETHOD NS_IMETHOD_(nsresult) |
#define | NS_IMETHODIMP NS_IMETHODIMP_(nsresult) |
#define | NS_METHOD NS_METHOD_(nsresult) |
#define | NS_CALLBACK(_name) NS_CALLBACK_(nsresult, _name) |
#define | NS_COM NS_IMPORT |
#define | NS_COM_GLUE |
#define | NS_NO_VTABLE |
#define | nsnull 0 |
#define | explicit |
#define | typename |
#define | NS_SPECIALIZE_TEMPLATE |
#define | NS_STATIC_CAST(__type, __ptr) static_cast< __type >(__ptr) |
#define | NS_CONST_CAST(__type, __ptr) const_cast< __type >(__ptr) |
#define | NS_REINTERPRET_POINTER_CAST(__type, __ptr) reinterpret_cast< __type >(__ptr) |
#define | NS_REINTERPRET_NONPOINTER_CAST(__type, __obj) reinterpret_cast< __type >(__obj) |
#define | NS_REINTERPRET_CAST(__type, __expr) reinterpret_cast< __type >(__expr) |
#define | NS_PTR_TO_INT32(x) ((PRInt32) (PRWord) (x)) |
#define | NS_PTR_TO_UINT32(x) ((PRUint32) (PRWord) (x)) |
#define | NS_INT32_TO_PTR(x) ((void *) (PRWord) (x)) |
#define | NS_STRINGIFY_HELPER(x_) #x_ |
#define | NS_STRINGIFY(x_) NS_STRINGIFY_HELPER(x_) |
#define | NS_LIKELY(x) (x) |
#define | NS_UNLIKELY(x) (x) |
Typedefs | |
typedef PRUint32 | nsresult |
#define NS_CALLBACK | ( | _name | ) | NS_CALLBACK_(nsresult, _name) |
#define NS_COM NS_IMPORT |
#define NS_CONST_CAST | ( | __type, | |||
__ptr | ) | const_cast< __type >(__ptr) |
#define NS_EXPORT_STATIC_MEMBER_ | ( | type | ) | NS_EXTERNAL_VIS_(type) |
#define NS_EXTERNAL_VIS_ | ( | type | ) | NS_VISIBILITY_DEFAULT type |
#define NS_FASTCALL |
Mark a function as using a potentially non-standard function calling convention. This can be used on functions that are called very frequently, to reduce the overhead of the function call. It is still worth using the macro for C++ functions which take no parameters since it allows passing |this| in a register.
Examples: int NS_FASTCALL func1(char *foo); NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
#define NS_IMETHOD NS_IMETHOD_(nsresult) |
#define NS_IMETHOD_ | ( | type | ) | virtual IMETHOD_VISIBILITY type NS_DEFCALL |
#define NS_IMPORT_STATIC_MEMBER_ | ( | type | ) | NS_EXTERNAL_VIS_(type) |
#define NS_NO_VTABLE |
NS_NO_VTABLE is emitted by xpidl in interface declarations whenever xpidl can determine that the interface can't contain a constructor. This results in some space savings and possible runtime savings - see bug 49416. We undefine it first, as xpidl-generated headers define it for IDL uses that don't include this file.
#define NS_REINTERPRET_CAST | ( | __type, | |||
__expr | ) | reinterpret_cast< __type >(__expr) |
#define NS_REINTERPRET_NONPOINTER_CAST | ( | __type, | |||
__obj | ) | reinterpret_cast< __type >(__obj) |
#define NS_REINTERPRET_POINTER_CAST | ( | __type, | |||
__ptr | ) | reinterpret_cast< __type >(__ptr) |
#define NS_STATIC_CAST | ( | __type, | |||
__ptr | ) | static_cast< __type >(__ptr) |
Macro for creating typedefs for pointer-to-member types which are declared with stdcall. It is important to use this for any type which is declared as stdcall (i.e. NS_IMETHOD). For example, instead of writing:
typedef nsresult (nsIFoo::*someType)(nsISupports* arg);
you should write:
typedef NS_STDCALL_FUNCPROTO(nsresult, someType, nsIFoo, typeFunc, (nsISupports*));
where nsIFoo::typeFunc is any method declared as NS_IMETHOD typeFunc(nsISupports*);
XXX this can be simplified to always use the non-typeof implementation when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11893 is fixed.
#define NS_VISIBILITY_HIDDEN |
Incorporate the core NSPR data types which XPCOM uses. Macros defining the target platform... Using the visibility("hidden") attribute allows the compiler to use PC-relative addressing to call this function. If a function does not access any global data, and does not call any methods which are not either file-local or hidden, then on ELF systems we avoid loading the address of the PLT into a register at the start of the function, which reduces code size and frees up a register for general use.
As a general rule, this should be used for any non-exported symbol (including virtual method implementations). NS_IMETHOD uses this by default; if you need to have your NS_IMETHOD functions exported, you can wrap your class as follows:
undef IMETHOD_VISIBILITY define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
class Foo { ... };
undef IMETHOD_VISIBILITY define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
Don't forget to change the visibility back to hidden before the end of a header!
Other examples:
NS_HIDDEN_(int) someMethod(); SomeCtor() NS_HIDDEN;
#define nsnull 0 |
The preferred symbol for null.
Definition at line 277 of file nscore.h.
Referenced by nsUniversalDetector::HandleData(), nsEscCharSetProber::nsEscCharSetProber(), nsUniversalDetector::nsUniversalDetector(), nsUniversalDetector::Reset(), and nsEscCharSetProber::Reset().