LLVM 22.0.0git
llvm::lsp::Position Struct Reference

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

Public Member Functions

 Position (int line=0, int character=0)
 Position (llvm::SourceMgr &mgr, SMLoc loc)
 Construct a position from the given source location.
SMLoc getAsSMLoc (llvm::SourceMgr &mgr) const
 Convert this position into a source location in the main file of the given source manager.

Public Attributes

int line = 0
 Line position in a document (zero-based).
int character = 0
 Character offset on a line in a document (zero-based).

Friends

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

Detailed Description

Definition at line 288 of file Protocol.h.

Constructor & Destructor Documentation

◆ Position() [1/2]

llvm::lsp::Position::Position ( int line = 0,
int character = 0 )
inline

Definition at line 289 of file Protocol.h.

References character, and line.

Referenced by operator!=, operator<, operator<=, and operator==.

◆ Position() [2/2]

llvm::lsp::Position::Position ( llvm::SourceMgr & mgr,
SMLoc loc )
inline

Construct a position from the given source location.

Definition at line 293 of file Protocol.h.

References character, llvm::SourceMgr::getLineAndColumn(), and line.

Member Function Documentation

◆ getAsSMLoc()

SMLoc llvm::lsp::Position::getAsSMLoc ( llvm::SourceMgr & mgr) const
inline

Convert this position into a source location in the main file of the given source manager.

Definition at line 323 of file Protocol.h.

References character, llvm::SourceMgr::FindLocForLineAndColumn(), llvm::SourceMgr::getMainFileID(), and line.

◆ operator!=

bool operator!= ( const Position & lhs,
const Position & rhs )
friend

Definition at line 309 of file Protocol.h.

References Position().

◆ operator<

bool operator< ( const Position & lhs,
const Position & rhs )
friend

Definition at line 312 of file Protocol.h.

References character, line, and Position().

◆ operator<=

bool operator<= ( const Position & lhs,
const Position & rhs )
friend

Definition at line 316 of file Protocol.h.

References character, line, and Position().

◆ operator==

bool operator== ( const Position & lhs,
const Position & rhs )
friend

Definition at line 305 of file Protocol.h.

References character, line, and Position().

Member Data Documentation

◆ character

int llvm::lsp::Position::character = 0

Character offset on a line in a document (zero-based).

Definition at line 303 of file Protocol.h.

Referenced by getAsSMLoc(), operator<, operator<=, operator==, Position(), and Position().

◆ line

int llvm::lsp::Position::line = 0

Line position in a document (zero-based).

Definition at line 300 of file Protocol.h.

Referenced by getAsSMLoc(), operator<, operator<=, operator==, Position(), and Position().


The documentation for this struct was generated from the following file: