JSON RPC
JSON-RPC 2.0 library for C++
details.h File Reference

Contains implementation details for the JSON RPC library. More...

#include <functional>
#include <tuple>
#include <type_traits>
#include <utility>
#include <nlohmann/json.hpp>
#include "exception.h"
+ Include dependency graph for details.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wwa::json_rpc::details::function_traits< T >
 Primary template for function traits. More...
 
struct  wwa::json_rpc::details::function_traits< R(*)(Args...) noexcept >
 Specialization for noexcept function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(*)(Args...)>
 Specialization for function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) const >
 Specialization for const member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) const noexcept >
 Specialization for const noexcept member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) const volatile >
 Specialization for const volatile member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) const volatile noexcept >
 Specialization for const volatile noexcept member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) noexcept >
 Specialization for noexcept member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) volatile >
 Specialization for volatile member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...) volatile noexcept >
 Specialization for volatile noexcept member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< R(C::*)(Args...)>
 Specialization for member function pointers. More...
 
struct  wwa::json_rpc::details::function_traits< std::function< R(Args...)> >
 Specialization for std::function. More...
 
struct  wwa::json_rpc::details::offset_sequence< N, std::index_sequence< Ints... > >
 Specialization for creating an offset sequence. More...
 

Namespaces

namespace  wwa
 
namespace  wwa::json_rpc
 Library namespace.
 
namespace  wwa::json_rpc::details
 Contains the implementation details of the JSON RPC library.
 

Typedefs

template<std::size_t N, typename Seq >
using wwa::json_rpc::details::offset_sequence_t = typename offset_sequence<N, Seq>::type
 Alias template for creating an offset sequence.
 
template<std::size_t I, typename A >
using wwa::json_rpc::details::tuple_element = std::decay_t<std::tuple_element_t<I, A>>
 Type alias for a tuple element with decay applied.
 

Functions

template<typename Extra , typename Args , std::size_t... Indices>
constexpr auto wwa::json_rpc::details::convert_args (const nlohmann::json &params, std::index_sequence< Indices... >)
 Converts JSON parameters to a tuple of arguments based on the specified types.
 
template<typename F , typename Tuple >
nlohmann::json wwa::json_rpc::details::invoke_function (F &&f, Tuple &&tuple)
 Invokes a function with the provided arguments handling void return type.
 
template<typename Extra >
constexpr auto wwa::json_rpc::details::make_extra_tuple (const nlohmann::json &extra)
 Creates a tuple from the provided JSON object based on the type of Extra.
 
template<typename C >
requires (std::is_class_v<std::remove_pointer_t<C>> || std::is_null_pointer_v<C>)
constexpr auto wwa::json_rpc::details::make_inst_tuple (C inst)
 Creates a tuple containing the instance if it is a class pointer, or an empty tuple if it is a null pointer.
 

Detailed Description

Contains implementation details for the JSON RPC library.

This file includes type traits for extracting function return types and argument types, as well as utilities for creating offset sequences and handling handler parameters. These details are used internally by the JSON RPC library to facilitate various operations.

It includes:

  • Type traits for function return types and argument types.
  • Utilities for creating offset sequences.
  • Helper functions for handling handler parameters.

Definition in file details.h.