40 #include "npfunctions.h"
47 #define NPMETHODID(_nm_) m_method##_nm_
49 #define DECLARE_NPMETHODID(_nm_) static NPIdentifier NPMETHODID(_nm_);
51 #define DEFINE_NPMETHODID(_cls_,_nm_) NPIdentifier _cls_::NPMETHODID(_nm_) = 0;
53 #define INIT_NPMETHODID(_nm_) NPMETHODID(_nm_) = NPN_GetStringIdentifier(#_nm_);
55 #define TEST_NPMETHODID(str,_nm_) (str == NPMETHODID(_nm_))
58 #define NPPROPID(_nm_) m_property##_nm_
60 #define DECLARE_NPPROPID(_nm_) static NPIdentifier NPPROPID(_nm_);
62 #define DEFINE_NPPROPID(_cls_,_nm_) NPIdentifier _cls_::NPPROPID(_nm_) = 0;
64 #define INIT_NPPROPID(_nm_) NPPROPID(_nm_) = NPN_GetStringIdentifier(#_nm_);
66 #define TEST_NPPROPID(str,_nm_) (str == NPPROPID(_nm_))
82 virtual void Invalidate();
83 virtual bool HasMethod(NPIdentifier name);
84 virtual bool Invoke(NPIdentifier name,
const NPVariant *args,
86 virtual bool InvokeDefault(
const NPVariant *args, uint32_t argCount,
88 virtual bool HasProperty(NPIdentifier name);
89 virtual bool GetProperty(NPIdentifier name,
NPVariant *result);
90 virtual bool SetProperty(NPIdentifier name,
const NPVariant *value);
91 virtual bool RemoveProperty(NPIdentifier name);
92 virtual bool Enumerate(NPIdentifier **identifier, uint32_t *count);
93 virtual bool Construct(
const NPVariant *args, uint32_t argCount,
97 static void _Deallocate(
NPObject *npobj);
98 static void _Invalidate(
NPObject *npobj);
99 static bool _HasMethod(
NPObject *npobj, NPIdentifier name);
100 static bool _Invoke(
NPObject *npobj, NPIdentifier name,
101 const NPVariant *args, uint32_t argCount,
105 static bool _HasProperty(
NPObject * npobj, NPIdentifier name);
106 static bool _GetProperty(
NPObject *npobj, NPIdentifier name,
108 static bool _SetProperty(
NPObject *npobj, NPIdentifier name,
110 static bool _RemoveProperty(
NPObject *npobj, NPIdentifier name);
111 static bool _Enumerate(
NPObject *npobj, NPIdentifier **identifier,
120 #define DECLARE_NPOBJECT_CLASS_WITH_BASE(_class, ctor) \
121 static NPClass s##_class##_NPClass = { \
122 NP_CLASS_STRUCT_VERSION_CTOR, \
124 ScriptablePluginObjectBase::_Deallocate, \
125 ScriptablePluginObjectBase::_Invalidate, \
126 ScriptablePluginObjectBase::_HasMethod, \
127 ScriptablePluginObjectBase::_Invoke, \
128 ScriptablePluginObjectBase::_InvokeDefault, \
129 ScriptablePluginObjectBase::_HasProperty, \
130 ScriptablePluginObjectBase::_GetProperty, \
131 ScriptablePluginObjectBase::_SetProperty, \
132 ScriptablePluginObjectBase::_RemoveProperty, \
133 ScriptablePluginObjectBase::_Enumerate, \
134 ScriptablePluginObjectBase::_Construct \
137 #define GET_NPOBJECT_CLASS(_class) &s##_class##_NPClass