FreeWRL/FreeX3D  3.0.0
BasePlugin.cpp
1 #include "BasePlugin.h"
2 
3 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4 /* ***** BEGIN LICENSE BLOCK *****
5  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
6  *
7  * The contents of this file are subject to the Netscape Public License
8  * Version 1.1 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/NPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is mozilla.org code.
18  *
19  * The Initial Developer of the Original Code is
20  * Netscape Communications Corporation.
21  * Portions created by the Initial Developer are Copyright (C) 1998
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Alternatively, the contents of this file may be used under the terms of
27  * either the GNU General Public License Version 2 or later (the "GPL"), or
28  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29  * in which case the provisions of the GPL or the LGPL are applicable instead
30  * of those above. If you wish to allow use of your version of this file only
31  * under the terms of either the GPL or the LGPL, and not to allow others to
32  * use your version of this file under the terms of the NPL, indicate your
33  * decision by deleting the provisions above and replace them with the notice
34  * and other provisions required by the GPL or the LGPL. If you do not delete
35  * the provisions above, a recipient may use your version of this file under
36  * the terms of any one of the NPL, the GPL or the LGPL.
37  *
38  * ***** END LICENSE BLOCK ***** */
39 
40 bool
41 BasePlugin::HasMethod(NPIdentifier name)
42 {
43  /*return ( name == sFoo_id ||
44  name == sShowText_id ||
45  name == sClearWindow_id );*/
46  return false;
47 }
48 
50 bool
51 BasePlugin::HasProperty(NPIdentifier name)
52 {
53  /*return (name == sBar_id ||
54  name == sPluginType_id);*/
55  return false;
56 }
57 
59 bool
60 BasePlugin::GetProperty(NPIdentifier name, NPVariant *result)
61 {
62 
63  VOID_TO_NPVARIANT(*result);
64 
65  //VIENE FATTA LA VERIFICA SULLA DERIVAZIONE DELLA CLASSE DA NPOBJECT PER IL SUPPORTO SCRIPT
66  if (name == sPluginType_id) {
67  NPObject *myobj =
68  NPN_CreateObject(mNpp, GET_NPOBJECT_CLASS(BasePlugin));
69  if (!myobj) {
70  return false;
71  }
72 
73  OBJECT_TO_NPVARIANT(myobj, *result);
74 
75  return true;
76  }
77  //
78 
79  /*if (name == sBar_id) {
80  static int a = 17;
81 
82  INT32_TO_NPVARIANT(a, *result);
83 
84  a += 5;
85 
86  return true;
87  }*/
88 
89  return true;
90 }
91 
94 bool
95 BasePlugin::Invoke(NPIdentifier name, const NPVariant *args,
96  uint32_t argCount, NPVariant *result)
97 {
98  return false;
99 }
100 
102 bool
103 BasePlugin::InvokeDefault(const NPVariant *args, uint32_t argCount,
104  NPVariant *result)
105 {
106  return false;
107 }
virtual bool HasProperty(NPIdentifier name)
Returns true if the NPIdentifier passed is managed as a scriptable property.
Definition: BasePlugin.cpp:51
virtual bool Invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
returns true if the invoked method is managed and executes the appropriate code filling the NPVariant...
Definition: BasePlugin.cpp:95
virtual bool GetProperty(NPIdentifier name, NPVariant *result)
Returns true if the scriptable property is managed and fills the NPVariant pointer with the value...
Definition: BasePlugin.cpp:60
virtual bool InvokeDefault(const NPVariant *args, uint32_t argCount, NPVariant *result)
Manages the invocation of the default '()' method.
Definition: BasePlugin.cpp:103