Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
jsonipc.hh File Reference
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <stdarg.h>
#include <cxxabi.h>
#include <algorithm>
#include <functional>
#include <typeindex>
#include <memory>
#include <vector>
#include <unordered_map>
#include <variant>
#include <map>
#include <set>

Go to the source code of this file.

Classes

struct  Jsonipc::JsonipcSharedBase
 Common base type for polymorphic classes managed by std::shared_ptr<>. More...
 
struct  Jsonipc::IsSharedPtr< typename >
 Template class to identify std::shared_ptr<> classes. More...
 
struct  Jsonipc::IsSharedPtr< std::shared_ptr< T > >
 
struct  Jsonipc::DerivesSharedPtr< T, typename >
 DerivesSharedPtr<T> - Check if T derives from std::shared_ptr<>. More...
 
struct  Jsonipc::DerivesSharedPtr< T, std::void_t< typename T::element_type > >
 
struct  Jsonipc::Has_shared_from_this< class, class >
 Has_shared_from_this<T> - Check if t.shared_from_this() yields a std::shared_ptr<>. More...
 
struct  Jsonipc::Has_shared_from_this< T, std::void_t< decltype(std::declval< T & >().shared_from_this()) > >
 
struct  Jsonipc::Has___typename__< class, class >
 Has___typename__<T> - Check if T provides a __typename__() method. More...
 
struct  Jsonipc::Has___typename__< T, std::void_t< decltype(std::declval< const T & >().__typename__()) > >
 
struct  Jsonipc::Has_setget< class, class >
 Has_setget<T> - Check if type T provides methods set() and get() More...
 
struct  Jsonipc::Has_setget< T, std::void_t< decltype(std::declval< T & >().set(std::declval< T & >().get())) > >
 
struct  Jsonipc::bad_invocation
 Jsonipc exception that is relayed to caller when thrown during invocations. More...
 
class  Jsonipc::Scope
 Keep track of temporary instances during IpcDispatcher::dispatch_message(). More...
 
struct  Jsonipc::Convert< T, REQUIRESv< std::is_integral< T >::value > >
 
struct  Jsonipc::Convert< bool >
 
struct  Jsonipc::Convert< T, REQUIRESv< std::is_floating_point< T >::value > >
 
struct  Jsonipc::Convert< const char * >
 
struct  Jsonipc::Convert< std::string >
 
struct  Jsonipc::DerivesVector< T, typename >
 DerivesVector<T> - Check if T derives from std::vector<>. More...
 
struct  Jsonipc::DerivesVector< T, std::void_t< typename T::value_type, typename T::allocator_type > >
 
struct  Jsonipc::DerivesPair< T, typename >
 DerivesPair<T> - Check if T derives from std::pair<>. More...
 
struct  Jsonipc::DerivesPair< T, std::void_t< typename T::first_type, typename T::second_type > >
 
struct  Jsonipc::Convert< T, REQUIRESv< DerivesVector< T >::value > >
 
struct  Jsonipc::Convert< T, REQUIRESv< DerivesPair< T >::value > >
 
struct  Jsonipc::Convert< T & >
 
struct  Jsonipc::Convert< T const & >
 
struct  Jsonipc::CallbackInfo
 Context for calling C++ functions from Json. More...
 
struct  Jsonipc::FunctionTraits< R(Args...)>
 
struct  Jsonipc::FunctionTraits< R(C::*)(Args...)>
 
struct  Jsonipc::FunctionTraits< R(C::*)(Args...) const >
 
struct  Jsonipc::FunctionTraits< F & >
 
struct  Jsonipc::FunctionTraits< const F >
 
struct  Jsonipc::FunctionTraits< R(C::*)>
 
struct  Jsonipc::CallTraits< F >
 Template class providing conversion helpers for JsonValue to indexed C++ function argument. More...
 
struct  Jsonipc::CallTraits< F >::TupleElement< INDEX, bool >
 
struct  Jsonipc::CallTraits< F >::TupleElement< INDEX, false >
 
class  Jsonipc::InstanceMap
 
class  Jsonipc::InstanceMap::Wrapper
 
class  Jsonipc::InstanceMap::InstanceWrapper< T >
 
struct  Jsonipc::DefaultConstant
 Wrapper for function argument default value constants. More...
 
struct  Jsonipc::typescript_name< T >
 
struct  Jsonipc::typescript_name< T & >
 
struct  Jsonipc::typescript_name< const T & >
 
struct  Jsonipc::typescript_name< std::shared_ptr< T > >
 
struct  Jsonipc::typescript_name< T * >
 
struct  Jsonipc::typescript_name< std::pair< T1, T2 > >
 
struct  Jsonipc::typescript_name< std::vector< T > >
 
struct  Jsonipc::typescript_name< std::map< std::string, T > >
 
struct  Jsonipc::typescript_name< std::unordered_map< std::string, T > >
 
class  Jsonipc::BindingPrinter
 
class  Jsonipc::TypeInfo
 
struct  Jsonipc::Enum< T >
 
struct  Jsonipc::Convert< T, REQUIRESv< std::is_enum< T >::value > >
 
struct  Jsonipc::Serializable< T >
 Jsonipc wrapper type for objects that support field-wise serialization to/from JSON. More...
 
struct  Jsonipc::Class< T >
 
struct  Jsonipc::IsWrappableClass< T, REQUIRESv< std::is_class< T >::value &&!IsSharedPtr< T >::value &&!DerivesPair< T >::value &&!DerivesVector< T >::value > >
 
struct  Jsonipc::IsWrappableClass< std::string >
 
struct  Jsonipc::IsWrappableClass< T, REQUIRESv< DerivesVector< T >::value > >
 
struct  Jsonipc::IsWrappableClass< T, REQUIRESv< DerivesPair< T >::value > >
 
struct  Jsonipc::Convert< std::shared_ptr< T >, REQUIRESv< IsWrappableClass< T >::value > >
 Convert wrapped Class shared pointer. More...
 
struct  Jsonipc::Convert< T *, REQUIRESv< IsWrappableClass< T >::value > >
 Convert wrapped Class pointer. More...
 
struct  Jsonipc::Convert< T, REQUIRESv< IsWrappableClass< T >::value > >
 Convert wrapped Class. More...
 
struct  Jsonipc::IpcDispatcher
 
struct  Jsonipc::typescript_name< void >
 
struct  Jsonipc::typescript_name< bool >
 
struct  Jsonipc::typescript_name< ::int8_t >
 
struct  Jsonipc::typescript_name< ::uint8_t >
 
struct  Jsonipc::typescript_name< ::int32_t >
 
struct  Jsonipc::typescript_name< ::uint32_t >
 
struct  Jsonipc::typescript_name< ::int64_t >
 
struct  Jsonipc::typescript_name< ::uint64_t >
 
struct  Jsonipc::typescript_name< float >
 
struct  Jsonipc::typescript_name< double >
 
struct  Jsonipc::typescript_name< const char * >
 
struct  Jsonipc::typescript_name< ::std::string >
 

Macros

#define JSONIPC_ISLIKELY(expr)
 
#define JSONIPC_UNLIKELY(expr)
 
#define JSONIPC_WARNING(fmt, ...)
 
#define JSONIPC_ASSERT_RETURN(expr, ...)
 
#define JSONIPC_MAP_TO_TYPESCRIPT(CXXTYPE, TSTYPE)
 

Typedefs

using Jsonipc::SharedBase = JsonipcSharedBase
 
using Jsonipc::JsonValue = rapidjson::GenericValue< rapidjson::UTF8< char >, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > >
 
using Jsonipc::JsonAllocator = rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator >
 
using Jsonipc::StringBufferWriter = rapidjson::Writer< rapidjson::StringBuffer, rapidjson::UTF8<>, rapidjson::UTF8<>, rapidjson::CrtAllocator, rapidjson::kWriteNanAndInfNullFlag >
 
template<bool value>
using Jsonipc::REQUIRES = typename ::std::enable_if< value, bool >::type
 REQUIRES<value> - Simplified version of std::enable_if<cond,bool>::type to use SFINAE in function templates.
 
template<bool value>
using Jsonipc::REQUIRESv = typename ::std::enable_if< value, void >::type
 REQUIRESv<value> - Simplified version of std::enable_if<cond,void>::type to use SFINAE in struct templates.
 
using Jsonipc::ScopeLocals = std::vector< std::shared_ptr< void > >
 
using Jsonipc::ScopeLocalsP = std::shared_ptr< ScopeLocals >
 
using Jsonipc::Closure = std::function< void(CallbackInfo &)>
 
using Jsonipc::DefaultConstantVariant = std::variant< std::monostate, std::nullptr_t, uint64_t, int64_t, double, std::string >
 
using Jsonipc::DefaultsList = std::initializer_list< DefaultConstant >
 

Functions

template<>
JsonValue Jsonipc::to_json< const char * > (const char *const &value, JsonAllocator &allocator)
 Convert C++ value to JsonValue.
 
std::string Jsonipc::normalize_typename (const std::string &string)
 Yield the Javascript identifier name by substituting ':+' with '.'.
 
std::string Jsonipc::short_name (const std::string &full_name)
 
template<typename... Args>
std::string Jsonipc::typescript_arg_list ()
 
template<typename... Args>
std::string Jsonipc::typescript_arg_names_list ()
 
template<typename C , typename R , typename... Args>
std::string Jsonipc::typescript_call_impl (const std::string &method_name)
 
template<typename T , typename Ret , typename... Args>
std::string Jsonipc::typescript_call (const std::string &method_name, Ret(T::*func)(Args...))
 

Variables

BindingPrinterJsonipc::g_binding_printer
 

Class Documentation

◆ Jsonipc::CallTraits::TupleElement

struct Jsonipc::CallTraits::TupleElement
template<typename F>
template<size_t INDEX, bool>
struct Jsonipc::CallTraits< F >::TupleElement< INDEX, bool >

Definition at line 512 of file jsonipc.hh.

Class Members
typedef typename type Type

◆ Jsonipc::CallTraits::TupleElement< INDEX, false >

struct Jsonipc::CallTraits::TupleElement< INDEX, false >
template<typename F>
template<size_t INDEX>
struct Jsonipc::CallTraits< F >::TupleElement< INDEX, false >

Definition at line 513 of file jsonipc.hh.

Class Members
typedef void Type

Macro Definition Documentation

◆ JSONIPC_ASSERT_RETURN

#define JSONIPC_ASSERT_RETURN (   expr,
  ... 
)

Definition at line 24 of file jsonipc.hh.

◆ JSONIPC_ISLIKELY

#define JSONIPC_ISLIKELY (   expr)

Definition at line 21 of file jsonipc.hh.

◆ JSONIPC_MAP_TO_TYPESCRIPT

#define JSONIPC_MAP_TO_TYPESCRIPT (   CXXTYPE,
  TSTYPE 
)

Definition at line 885 of file jsonipc.hh.

◆ JSONIPC_UNLIKELY

#define JSONIPC_UNLIKELY (   expr)

Definition at line 22 of file jsonipc.hh.

◆ JSONIPC_WARNING

#define JSONIPC_WARNING (   fmt,
  ... 
)

Definition at line 23 of file jsonipc.hh.

Typedef Documentation

◆ Closure

using Jsonipc::Closure = typedef std::function<void (CallbackInfo&)>

Definition at line 447 of file jsonipc.hh.

◆ DefaultConstantVariant

Definition at line 796 of file jsonipc.hh.

◆ DefaultsList

using Jsonipc::DefaultsList = typedef std::initializer_list<DefaultConstant>

Definition at line 811 of file jsonipc.hh.

◆ JsonAllocator

using Jsonipc::JsonAllocator = typedef rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>

Definition at line 40 of file jsonipc.hh.

◆ JsonValue

using Jsonipc::JsonValue = typedef rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >

Definition at line 39 of file jsonipc.hh.

◆ REQUIRES

template<bool value>
using Jsonipc::REQUIRES = typedef typename ::std::enable_if<value, bool>::type

REQUIRES<value> - Simplified version of std::enable_if<cond,bool>::type to use SFINAE in function templates.

Definition at line 68 of file jsonipc.hh.

◆ REQUIRESv

template<bool value>
using Jsonipc::REQUIRESv = typedef typename ::std::enable_if<value, void>::type

REQUIRESv<value> - Simplified version of std::enable_if<cond,void>::type to use SFINAE in struct templates.

Definition at line 71 of file jsonipc.hh.

◆ ScopeLocals

Definition at line 159 of file jsonipc.hh.

◆ ScopeLocalsP

using Jsonipc::ScopeLocalsP = typedef std::shared_ptr<ScopeLocals>

Definition at line 160 of file jsonipc.hh.

◆ SharedBase

using Jsonipc::SharedBase = typedef JsonipcSharedBase

Definition at line 35 of file jsonipc.hh.

◆ StringBufferWriter

using Jsonipc::StringBufferWriter = typedef rapidjson::Writer<rapidjson::StringBuffer, rapidjson::UTF8<>, rapidjson::UTF8<>, rapidjson::CrtAllocator, rapidjson::kWriteNanAndInfNullFlag>

Definition at line 41 of file jsonipc.hh.

Function Documentation

◆ normalize_typename()

std::string Jsonipc::normalize_typename ( const std::string string)

Yield the Javascript identifier name by substituting ':+' with '.'.

Definition at line 816 of file jsonipc.hh.

References Jsonipc::normalize_typename(), and std::string::size().

Referenced by Jsonipc::normalize_typename().

◆ short_name()

std::string Jsonipc::short_name ( const std::string full_name)

Definition at line 854 of file jsonipc.hh.

◆ to_json< const char * >()

template<>
JsonValue Jsonipc::to_json< const char * > ( const char *const &  value,
JsonAllocator &  allocator 
)

Convert C++ value to JsonValue.

Definition at line 402 of file jsonipc.hh.

◆ typescript_arg_list()

template<typename... Args>
std::string Jsonipc::typescript_arg_list ( )

Definition at line 889 of file jsonipc.hh.

◆ typescript_arg_names_list()

template<typename... Args>
std::string Jsonipc::typescript_arg_names_list ( )

Definition at line 901 of file jsonipc.hh.

◆ typescript_call()

template<typename T , typename Ret , typename... Args>
std::string Jsonipc::typescript_call ( const std::string method_name,
Ret(T::*)(Args...)  func 
)

Definition at line 923 of file jsonipc.hh.

◆ typescript_call_impl()

template<typename C , typename R , typename... Args>
std::string Jsonipc::typescript_call_impl ( const std::string method_name)

Definition at line 912 of file jsonipc.hh.

Variable Documentation

◆ g_binding_printer

BindingPrinter* Jsonipc::g_binding_printer

Definition at line 1071 of file jsonipc.hh.