clang-tools  7.0.0
Public Types | Public Member Functions | List of all members
clang::clangd::JSONRPCDispatcher Class Reference

Main JSONRPC entry point. More...

#include <JSONRPCDispatcher.h>

Public Types

using Handler = std::function< void(const llvm::json::Value &)>
 

Public Member Functions

 JSONRPCDispatcher (Handler UnknownHandler)
 Create a new JSONRPCDispatcher. More...
 
void registerHandler (StringRef Method, Handler H)
 Registers a Handler for the specified Method. More...
 
bool call (const llvm::json::Value &Message, JSONOutput &Out) const
 Parses a JSONRPC message and calls the Handler for it. More...
 

Detailed Description

Main JSONRPC entry point.

This parses the JSONRPC "header" and calls the registered Handler for the method received.

Definition at line 73 of file JSONRPCDispatcher.h.

Member Typedef Documentation

◆ Handler

using clang::clangd::JSONRPCDispatcher::Handler = std::function<void(const llvm::json::Value &)>

Definition at line 76 of file JSONRPCDispatcher.h.

Constructor & Destructor Documentation

◆ JSONRPCDispatcher()

clang::clangd::JSONRPCDispatcher::JSONRPCDispatcher ( Handler  UnknownHandler)
inline

Create a new JSONRPCDispatcher.

UnknownHandler is called when an unknown method is received.

Definition at line 80 of file JSONRPCDispatcher.h.

References clang::clangd::call(), clang::tidy::modernize::Message, and clang::clangd::Method.

Member Function Documentation

◆ call()

bool JSONRPCDispatcher::call ( const llvm::json::Value &  Message,
JSONOutput Out 
) const

Parses a JSONRPC message and calls the Handler for it.

Definition at line 172 of file JSONRPCDispatcher.cpp.

◆ registerHandler()

void JSONRPCDispatcher::registerHandler ( StringRef  Method,
Handler  H 
)

Registers a Handler for the specified Method.

Definition at line 150 of file JSONRPCDispatcher.cpp.


The documentation for this class was generated from the following files: