MLIR  19.0.0git
Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::lsp::URIForFile Class Reference

URI in "file" scheme for a file. More...

#include "mlir/Tools/lsp-server-support/Protocol.h"

Public Member Functions

 URIForFile ()=default
 
StringRef file () const
 Returns the absolute path to the file. More...
 
StringRef uri () const
 Returns the original uri of the file. More...
 
StringRef scheme () const
 Return the scheme of the uri. More...
 
 operator bool () const
 

Static Public Member Functions

static llvm::Expected< URIForFilefromURI (StringRef uri)
 Try to build a URIForFile from the given URI string. More...
 
static llvm::Expected< URIForFilefromFile (StringRef absoluteFilepath, StringRef scheme="file")
 Try to build a URIForFile from the given absolute file path and optional scheme. More...
 
static void registerSupportedScheme (StringRef scheme)
 Register a supported URI scheme. More...
 

Friends

bool operator== (const URIForFile &lhs, const URIForFile &rhs)
 
bool operator!= (const URIForFile &lhs, const URIForFile &rhs)
 
bool operator< (const URIForFile &lhs, const URIForFile &rhs)
 

Detailed Description

URI in "file" scheme for a file.

Definition at line 100 of file Protocol.h.

Constructor & Destructor Documentation

◆ URIForFile()

mlir::lsp::URIForFile::URIForFile ( )
default

Referenced by fromURI().

Member Function Documentation

◆ file()

StringRef mlir::lsp::URIForFile::file ( ) const
inline

◆ fromFile()

llvm::Expected< URIForFile > URIForFile::fromFile ( StringRef  absoluteFilepath,
StringRef  scheme = "file" 
)
static

Try to build a URIForFile from the given absolute file path and optional scheme.

Definition at line 233 of file Protocol.cpp.

References fromURI(), scheme(), uri(), and uriFromAbsolutePath().

Referenced by mlir::lsp::gatherIncludeFiles(), getLocationFromLoc(), getURIFromLoc(), and llvm::yaml::MappingTraits< YamlFileInfo >::mapping().

◆ fromURI()

llvm::Expected< URIForFile > URIForFile::fromURI ( StringRef  uri)
static

Try to build a URIForFile from the given URI string.

Definition at line 226 of file Protocol.cpp.

References parseFilePathFromURI(), uri(), and URIForFile().

Referenced by fromFile(), and mlir::lsp::fromJSON().

◆ operator bool()

mlir::lsp::URIForFile::operator bool ( ) const
inlineexplicit

Definition at line 121 of file Protocol.h.

◆ registerSupportedScheme()

void URIForFile::registerSupportedScheme ( StringRef  scheme)
static

Register a supported URI scheme.

The protocol supports file by default, so this is only necessary for any additional schemes that a server wants to support.

Definition at line 244 of file Protocol.cpp.

References getSupportedSchemes(), and scheme().

Referenced by mlir::MlirLspServerMain().

◆ scheme()

StringRef URIForFile::scheme ( ) const

Return the scheme of the uri.

Definition at line 242 of file Protocol.cpp.

References uri().

Referenced by collectLocationsFromLoc(), fromFile(), getLspDiagnoticFromDiag(), and registerSupportedScheme().

◆ uri()

StringRef mlir::lsp::URIForFile::uri ( ) const
inline

Returns the original uri of the file.

Definition at line 116 of file Protocol.h.

Referenced by fromFile(), fromURI(), mlir::lsp::operator<<(), scheme(), and mlir::lsp::toJSON().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const URIForFile lhs,
const URIForFile rhs 
)
friend

Definition at line 126 of file Protocol.h.

◆ operator<

bool operator< ( const URIForFile lhs,
const URIForFile rhs 
)
friend

Definition at line 129 of file Protocol.h.

◆ operator==

bool operator== ( const URIForFile lhs,
const URIForFile rhs 
)
friend

Definition at line 123 of file Protocol.h.


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