irccd  3.0.3
Functions
irccd::daemon::rule_util Namespace Reference

Rule utilities. More...

Functions

auto from_json (const nlohmann::json &json) -> rule
 
auto from_config (const ini::section &sc) -> rule
 
auto to_json (const rule &rule) -> nlohmann::json
 

Detailed Description

Rule utilities.

Function Documentation

◆ from_config()

auto irccd::daemon::rule_util::from_config ( const ini::section sc) -> rule

Load a rule from a INI section.

Parameters
scthe ini section
Returns
the rule
Exceptions
rule_erroron errors

◆ from_json()

auto irccd::daemon::rule_util::from_json ( const nlohmann::json &  json) -> rule

Load a rule from a JSON object.

For possible use in transport commands or Javascript API.

Precondition
json.is_object()
Parameters
jsonthe JSON object
Returns
the new rule
Exceptions
rule_erroron errors

◆ to_json()

auto irccd::daemon::rule_util::to_json ( const rule rule) -> nlohmann::json

Convert a rule into a JSON object.

Parameters
rulethe rule
Exceptions
theJSON representation
Returns
the JSON representation