pluginscript_instance.h 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*************************************************************************/
  2. /* pluginscript_instance.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef PLUGINSCRIPT_INSTANCE_H
  31. #define PLUGINSCRIPT_INSTANCE_H
  32. // Godot imports
  33. #include "core/script_language.h"
  34. // PluginScript imports
  35. #include <pluginscript/godot_pluginscript.h>
  36. class PluginScript;
  37. class PluginScriptInstance : public ScriptInstance {
  38. friend class PluginScript;
  39. private:
  40. Ref<PluginScript> _script;
  41. Object *_owner;
  42. Variant _owner_variant;
  43. godot_pluginscript_instance_data *_data;
  44. const godot_pluginscript_instance_desc *_desc;
  45. public:
  46. _FORCE_INLINE_ Object *get_owner() { return _owner; }
  47. virtual bool set(const StringName &p_name, const Variant &p_value);
  48. virtual bool get(const StringName &p_name, Variant &r_ret) const;
  49. virtual void get_property_list(List<PropertyInfo> *p_properties) const;
  50. virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
  51. virtual void get_method_list(List<MethodInfo> *p_list) const;
  52. virtual bool has_method(const StringName &p_method) const;
  53. virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
  54. #if 0
  55. // Rely on default implementations provided by ScriptInstance for the moment.
  56. // Note that multilevel call could be removed in 3.0 release, so stay tunned
  57. // (see https://godotengine.org/qa/9244/can-override-the-_ready-and-_process-functions-child-classes)
  58. virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
  59. virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount);
  60. #endif
  61. virtual void notification(int p_notification);
  62. virtual Ref<Script> get_script() const;
  63. virtual ScriptLanguage *get_language();
  64. void set_path(const String &p_path);
  65. virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
  66. virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
  67. virtual void refcount_incremented();
  68. virtual bool refcount_decremented();
  69. PluginScriptInstance();
  70. bool init(PluginScript *p_script, Object *p_owner);
  71. virtual ~PluginScriptInstance();
  72. };
  73. #endif // PLUGINSCRIPT_INSTANCE_H