irccd  3.0.3
plugin_api.hpp
1 /*
2  * plugin_api.hpp -- Irccd.Plugin API
3  *
4  * Copyright (c) 2013-2019 David Demelier <markand@malikania.fr>
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef IRCCD_JS_PLUGIN_API_HPP
20 #define IRCCD_JS_PLUGIN_API_HPP
21 
27 #include "api.hpp"
28 #include "plugin.hpp"
29 
30 namespace irccd::js {
31 
36 class plugin_api : public api {
37 public:
41  auto get_name() const noexcept -> std::string_view override;
42 
46  void load(daemon::bot& bot, js::plugin& plugin) override;
47 };
48 
49 namespace duk {
50 
54 template <>
62  static auto self(duk_context* ctx) -> plugin&;
63 };
64 
68 template <>
69 struct type_traits<daemon::plugin_error> {
76  static void raise(duk_context* ctx, const daemon::plugin_error& error);
77 };
78 
79 } // !duk
80 
81 } // !irccd::js
82 
83 #endif // !IRCCD_JS_PLUGIN_API_HPP
irccd::js::plugin_api
Irccd.Plugin Javascript API.
Definition: plugin_api.hpp:36
irccd::js
Javascript namespace.
Definition: api.hpp:42
irccd::js::plugin
Javascript plugins for irccd.
Definition: plugin.hpp:44
irccd::js::api
Javascript API module.
Definition: api.hpp:51
irccd::js::plugin_api::load
void load(daemon::bot &bot, js::plugin &plugin) override
irccd::js::plugin_api::get_name
auto get_name() const noexcept -> std::string_view override
irccd::js::duk::error
Base ECMAScript error class.
Definition: duk.hpp:329
std
Definition: bot.hpp:253
irccd::daemon::plugin_error
Plugin error.
Definition: plugin.hpp:388
irccd::js::duk::type_traits
Operations on different types.
Definition: duk.hpp:254