nixd
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lspserver::InboundPort Class Reference

#include <Connection.h>

Public Member Functions

bool readStandardMessage (std::string &JSONString)
 
bool readDelimitedMessage (std::string &JSONString)
 
void close ()
 Notify the inbound port to close the connection.
 
 InboundPort (int In=STDIN_FILENO, JSONStreamStyle StreamStyle=JSONStreamStyle::Standard)
 
bool readMessage (std::string &JSONString)
 
bool dispatch (llvm::json::Value Message, MessageHandler &Handler)
 
void loop (MessageHandler &Handler)
 

Public Attributes

int In
 
JSONStreamStyle StreamStyle = JSONStreamStyle::Standard
 

Detailed Description

Definition at line 34 of file Connection.h.

Constructor & Destructor Documentation

◆ InboundPort()

lspserver::InboundPort::InboundPort ( int In = STDIN_FILENO,
JSONStreamStyle StreamStyle = JSONStreamStyle::Standard )
inline

Definition at line 50 of file Connection.h.

Member Function Documentation

◆ close()

void lspserver::InboundPort::close ( )
inline

Notify the inbound port to close the connection.

Definition at line 48 of file Connection.h.

◆ dispatch()

bool lspserver::InboundPort::dispatch ( llvm::json::Value Message,
MessageHandler & Handler )

Dispatch messages to on{Notify,Call,Reply} ( Handlers) Return values should be forwarded from Handlers i.e. returns true to keep processing messages, or false to shut down.

Definition at line 104 of file Connection.cpp.

References lspserver::decodeError(), lspserver::elog(), lspserver::fromJSON(), lspserver::Method, and lspserver::Object.

Referenced by loop().

◆ loop()

void lspserver::InboundPort::loop ( MessageHandler & Handler)

◆ readDelimitedMessage()

bool lspserver::InboundPort::readDelimitedMessage ( std::string & JSONString)

Definition at line 216 of file Connection.cpp.

References lspserver::fromJSON(), In, and lspserver::readLine().

Referenced by readMessage().

◆ readMessage()

bool lspserver::InboundPort::readMessage ( std::string & JSONString)

Read messages specified in LSP standard, and collect standard json string into JSONString. A Language Server Protocol message starts with a set of HTTP headers, delimited by \r
, and terminated by an empty line (\r
).

Definition at line 242 of file Connection.cpp.

References lspserver::Delimited, lspserver::fromJSON(), readDelimitedMessage(), readStandardMessage(), lspserver::Standard, and StreamStyle.

Referenced by loop().

◆ readStandardMessage()

bool lspserver::InboundPort::readStandardMessage ( std::string & JSONString)

Definition at line 181 of file Connection.cpp.

References lspserver::elog(), lspserver::fromJSON(), In, lspserver::Read, and lspserver::readLine().

Referenced by readMessage().

Member Data Documentation

◆ In

int lspserver::InboundPort::In

Definition at line 39 of file Connection.h.

Referenced by readDelimitedMessage(), and readStandardMessage().

◆ StreamStyle

JSONStreamStyle lspserver::InboundPort::StreamStyle = JSONStreamStyle::Standard

Definition at line 41 of file Connection.h.

Referenced by readMessage().


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