npruntime.h File Reference

NP_BEGIN_MACRO

NP_END_MACRO

Typedef NPObject

typedef struct NPObjectNPObject

Typedef NPClass

typedef struct NPClassNPClass

Typedef NPUTF8

typedef charNPUTF8

Typedef NPString

typedef struct _NPStringNPString

Enum NPVariantType

Typedef NPVariant

typedef struct _NPVariantNPVariant

NPN_ReleaseVariantValue ( NPVariant * )

voidNPN_ReleaseVariantValue(NPVariant *variant)

NPN_ReleaseVariantValue() releases the value in the given variant

This must always be called on result variants and such in this API, i.e. any NPVariant whose value comes from a call that passes back an NPVariant must be released using this function. Access to the value in an NPVariant that has been released will result in undefined behavior

Parameters
variantThe variant whose value is to be released

NPVARIANT_IS_VOID

NPVARIANT_IS_NULL

NPVARIANT_IS_BOOLEAN

NPVARIANT_IS_INT32

NPVARIANT_IS_DOUBLE

NPVARIANT_IS_STRING

NPVARIANT_IS_OBJECT

NPVARIANT_TO_BOOLEAN

NPVARIANT_TO_INT32

NPVARIANT_TO_DOUBLE

NPVARIANT_TO_STRING

NPVARIANT_TO_OBJECT

VOID_TO_NPVARIANT

NULL_TO_NPVARIANT

BOOLEAN_TO_NPVARIANT

INT32_TO_NPVARIANT

DOUBLE_TO_NPVARIANT

STRINGZ_TO_NPVARIANT

STRINGN_TO_NPVARIANT

OBJECT_TO_NPVARIANT

Typedef NPIdentifier

typedef void *NPIdentifier

NPN_GetStringIdentifier ( const NPUTF8 * )

NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)

Returns an opaque identifier for the string that is passed in.

Parameters
nameThe string for which an opaque identifier should be returned
Return Value
An NPIdentifier identifying the string

NPN_GetStringIdentifiers ( const NPUTF8 **, int32_t, NPIdentifier * )

voidNPN_GetStringIdentifiers(const NPUTF8 **names,
int32_tnameCount,
NPIdentifier *identifiers
)

NPN_GetIntIdentifier ( int32_t )

NPIdentifier NPN_GetIntIdentifier(int32_tintid)

Returns an opaque identifier for the integer that is passed in.

Parameters
intidThe integer for which an opaque identifier should be returned
Return Value
An NPIdentifier identifying the integer

NPN_IdentifierIsString ( NPIdentifier )

boolNPN_IdentifierIsString(NPIdentifieridentifier)

Determines whether or not an identifier is a string.

Parameters
identifierThe identifier whose type is to be examined
Return Value
true if the identifier is a string identifier, or false otherwise

NPN_UTF8FromIdentifier ( NPIdentifier )

NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifieridentifier)

Returns the UTF-8 string corresponding to the given string identifier.

Parameters
identifierThe string identifier whose corresponding string should be returned
Return Value
A UTF-8 string as a sequence of NPUTF8 bytes, or NULL if the specified identifier isn't a string identifier.

NPN_IntFromIdentifier ( NPIdentifier )

int32_t NPN_IntFromIdentifier(NPIdentifieridentifier)

Returns the integer value corresponding to the given integer identifier.

Parameters
identifierThe integer identifier whose corresponding integer value should be returned
Return Value
An integer corresponding to the specified identifier

Typedef NPAllocateFunctionPtr

typedef NPObject *(*NPAllocateFunctionPtr

Typedef NPDeallocateFunctionPtr

typedef void(*NPDeallocateFunctionPtr

Typedef NPInvalidateFunctionPtr

typedef void(*NPInvalidateFunctionPtr

Typedef NPHasMethodFunctionPtr

typedef bool(*NPHasMethodFunctionPtr

Typedef NPInvokeFunctionPtr

typedef bool(*NPInvokeFunctionPtr

Typedef NPInvokeDefaultFunctionPtr

typedef bool(*NPInvokeDefaultFunctionPtr

Typedef NPHasPropertyFunctionPtr

typedef bool(*NPHasPropertyFunctionPtr

Typedef NPGetPropertyFunctionPtr

typedef bool(*NPGetPropertyFunctionPtr

Typedef NPSetPropertyFunctionPtr

typedef bool(*NPSetPropertyFunctionPtr

Typedef NPRemovePropertyFunctionPtr

typedef bool(*NPRemovePropertyFunctionPtr

Typedef NPEnumerationFunctionPtr

typedef bool(*NPEnumerationFunctionPtr

Typedef NPConstructFunctionPtr

typedef bool(*NPConstructFunctionPtr

NP_CLASS_STRUCT_VERSION

NP_CLASS_STRUCT_VERSION_ENUM

NP_CLASS_STRUCT_VERSION_CTOR

NP_CLASS_STRUCT_VERSION_HAS_ENUM

NP_CLASS_STRUCT_VERSION_HAS_CTOR

NPN_CreateObject ( NPP, NPClass * )

NPObject *NPN_CreateObject(NPPnpp,
NPClass *aClass
)

Allocates a new NPObject.

Parameters
nppThe NPP indicating which plugin wants to instantiate the object
aClassThe class to instantiate an object of.
Return Value
The newly-allocated NPObject

NPN_RetainObject ( NPObject * )

NPObject *NPN_RetainObject(NPObject *npobj)

Increments the reference count of the given NPObject.

Parameters
npobjThe NPObject to retain
Return Value
A pointer back to the same object.

NPN_ReleaseObject ( NPObject * )

voidNPN_ReleaseObject(NPObject *npobj)

Decrements the reference count of the given NPObject. If the reference count reaches 0, the NPObject is deallocated by calling its deallocate function if one is provided; if one is not provided, free() is used.

Parameters
npobjThe NPObject whose reference count should be decremented

NPN_Invoke ( NPP, NPObject *, NPIdentifier, const NPVariant *, uint32_t, NPVariant * )

boolNPN_Invoke(NPPnpp,
NPObject *npobj,
NPIdentifiermethodName,
const NPVariant *args,
uint32_targCount,
NPVariant *result
)

Invokes a method on the given NPObject.

Parameters
nppThe NPP indicating which plugin wants to call the method on the object
npobjThe object on which to invoke a method
methodNameA string identifier indicating the name of the name of the method to invoke
argsAn array of arguments to pass to the method
argCountThe number of arguments in the args array
resultA pointer to an NPVariant to receive the result returned by the method When the caller no longer needs the result, it must call NPN_ReleaseVariantValue() to release it.
Return Value
true if the method was successfully invoked, otherwise false. If the method was invoked successfully, any return value is stored in the NPVariant specified by result

NPN_InvokeDefault ( NPP, NPObject *, const NPVariant *, uint32_t, NPVariant * )

boolNPN_InvokeDefault(NPPnpp,
NPObject *npobj,
const NPVariant *args,
uint32_targCount,
NPVariant *result
)

Invokes the default method, if one exists, on the given NPObject

Parameters
nppThe NPP indicating which plugin wants to call the method on the object
npobjThe object on which to invoke the default method
argsAn array of arguments to pass to the method
argCountThe number of arguments in the args array
resultA pointer to an NPVariant to receive the result returned by the method When the caller no longer needs the result, it must call NPN_ReleaseVariantValue() to release it.
Return Value
true if the method was successfully invoked, otherwise false. If the method was invoked successfully, any return value is stored in the NPVariant specified by result

NPN_Evaluate ( NPP, NPObject *, NPString *, NPVariant * )

boolNPN_Evaluate(NPPnpp,
NPObject *npobj,
NPString *script,
NPVariant *result
)

Invokes a method on the given NPObject.

Parameters
nppThe NPP indicating which plugin instance's window to evaluate the script in.
npobjThe object on which to evaluate the script
scriptThe script to evaluate
resultOn return, contains the value returned by the script The caller must call NPN_ReleaseVariantValue() to release the returned value when it's no longer needed
Return Value
true if the script was evaluated successfully, otherwise false

NPN_GetProperty ( NPP, NPObject *, NPIdentifier, NPVariant * )

boolNPN_GetProperty(NPPnpp,
NPObject *npobj,
NPIdentifierpropertyName,
NPVariant *result
)

Gets the value of a property on the specified NPObject.

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjThe object from which a value is to be retrieved.
propertyNameA string identifier indicating the name of the property whose value is to be retrieved
resultOn return, contains the value of the specified property The caller must call NPN_ReleaseVariantValue() to release the returned value when it's no longer needed
Return Value
true if the script was evaluated successfully, otherwise false

NPN_SetProperty ( NPP, NPObject *, NPIdentifier, const NPVariant * )

boolNPN_SetProperty(NPPnpp,
NPObject *npobj,
NPIdentifierpropertyName,
const NPVariant *value
)

Sets the value of a property on the specified NPObject.

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjThe object on which a value is to be set.
propertyNameA string identifier indicating the name of the property whose value is to be retrieved
valueThe value to store in the specified property
Return Value
true if the value was set successfully, otherwise false

NPN_RemoveProperty ( NPP, NPObject *, NPIdentifier )

boolNPN_RemoveProperty(NPPnpp,
NPObject *npobj,
NPIdentifierpropertyName
)

Removes a property from the specified NPObject

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjThe object on which a property is to be deleted
propertyNameA string identifier indicating the name of the property to remove
Return Value
true if the property was removed successfully, otherwise false

NPN_HasProperty ( NPP, NPObject *, NPIdentifier )

boolNPN_HasProperty(NPPnpp,
NPObject *npobj,
NPIdentifierpropertyName
)

Determines whether or not the specified NPObject has a particular property

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjThe object on which to look for the property
propertyNameA string identifier indicating the name of the property to look for
Return Value
true if the property exists on the specified object, otherwise false

NPN_HasMethod ( NPP, NPObject *, NPIdentifier )

boolNPN_HasMethod(NPPnpp,
NPObject *npobj,
NPIdentifiermethodName
)

Determines whether or not the specified NPObject has a particular method

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjThe object on which to look for the method
methodNameA string identifier indicating the name of the method to look for
Return Value
true if the method exists on the specified object, otherwise false.

NPN_Enumerate ( NPP, NPObject *, NPIdentifier **, uint32_t * )

boolNPN_Enumerate(NPPnpp,
NPObject *npobj,
NPIdentifier **identifier,
uint32_t *count
)

List all of identifiers in a NPObject

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjThe object on which to look for the indeifiers
identifierarray of identifiers returned
Return Value
true if the method succeeded, otherwise false.

NPN_Construct ( NPP, NPObject *, const NPVariant *, uint32_t, NPVariant * )

boolNPN_Construct(NPPnpp,
NPObject *npobj,
const NPVariant *args,
uint32_targCount,
NPVariant *result
)

Create a NPObject

Parameters
nppThe NPP indicating which plugin instance's is making the request
npobjan input NPObject
argsAn array of arguments to pass to the method
argCountnumber of arguments
resultnew created NPObject
Return Value
true if the method succeeded, otherwise false.

_NPN_SetException ( NPObject *, const NPUTF8 * )

void_NPN_SetException(NPObject *npobj,
const NPUTF8 *message
)