irccd  3.0.3
rule_util.hpp
1 /*
2  * rule_util.hpp -- rule utilities
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_DAEMON_RULE_UTIL_HPP
20 #define IRCCD_DAEMON_RULE_UTIL_HPP
21 
27 #include <irccd/sysconfig.hpp>
28 
29 #include <json.hpp>
30 
31 namespace irccd {
32 
33 namespace ini {
34 
35 class section;
36 
37 } // !ini
38 
39 namespace daemon {
40 
41 struct rule;
42 
46 namespace rule_util {
47 
58 auto from_json(const nlohmann::json& json) -> rule;
59 
67 auto from_config(const ini::section& sc) -> rule;
68 
76 auto to_json(const rule& rule) -> nlohmann::json;
77 
78 } // !rule_util
79 
80 } // !daemon
81 
82 } // !irccd
83 
84 #endif // !IRCCD_DAEMON_RULE_UTIL_HPP
Section that contains one or more options.
Definition: ini.hpp:295
auto from_json(const nlohmann::json &json) -> rule
auto to_json(const rule &rule) -> nlohmann::json
auto from_config(const ini::section &sc) -> rule
Parent namespace.
Definition: acceptor.hpp:43
Manage rule to activate or deactive events.
Definition: rule.hpp:39