LLVM 22.0.0git
llvm::lsp::JSONTransportInputOverFile Class Reference

Concrete implementation of the JSONTransportInput that reads from a file. More...

#include "llvm/Support/LSP/Transport.h"

Inheritance diagram for llvm::lsp::JSONTransportInputOverFile:
[legend]

Public Member Functions

 JSONTransportInputOverFile (std::FILE *In, JSONStreamStyle Style=JSONStreamStyle::Standard)
bool hasError () const final
bool isEndOfInput () const final
LogicalResult readDelimitedMessage (std::string &Json) final
 For lit tests we support a simplified syntax:
LogicalResult readStandardMessage (std::string &Json) final
Public Member Functions inherited from llvm::lsp::JSONTransportInput
 JSONTransportInput (JSONStreamStyle Style=JSONStreamStyle::Standard)
virtual ~JSONTransportInput ()=default
LogicalResult readMessage (std::string &Json)
 Read in a message from the input stream.

Detailed Description

Concrete implementation of the JSONTransportInput that reads from a file.

Definition at line 75 of file Transport.h.

Constructor & Destructor Documentation

◆ JSONTransportInputOverFile()

llvm::lsp::JSONTransportInputOverFile::JSONTransportInputOverFile ( std::FILE * In,
JSONStreamStyle Style = JSONStreamStyle::Standard )
inlineexplicit

Member Function Documentation

◆ hasError()

bool llvm::lsp::JSONTransportInputOverFile::hasError ( ) const
inlinefinalvirtual

Implements llvm::lsp::JSONTransportInput.

Definition at line 81 of file Transport.h.

References const.

Referenced by readStandardMessage().

◆ isEndOfInput()

bool llvm::lsp::JSONTransportInputOverFile::isEndOfInput ( ) const
inlinefinalvirtual

Implements llvm::lsp::JSONTransportInput.

Definition at line 82 of file Transport.h.

References const.

◆ readDelimitedMessage()

LogicalResult JSONTransportInputOverFile::readDelimitedMessage ( std::string & Json)
finalvirtual

For lit tests we support a simplified syntax:

  • messages are delimited by '// --—' on a line by itself
  • lines starting with // are ignored. This is a testing path, so favor simplicity over performance here. When returning failure: feof(), ferror(), or shutdownRequested() will be set.

Implements llvm::lsp::JSONTransportInput.

Definition at line 353 of file Transport.cpp.

References llvm::failure(), readLine(), llvm::StringRef::starts_with(), llvm::StringRef::str(), and llvm::succeeded().

◆ readStandardMessage()

LogicalResult JSONTransportInputOverFile::readStandardMessage ( std::string & Json)
finalvirtual

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