LLDB mainline
Public Member Functions | List of all members
lldb_private::Highlighter Class Referenceabstract

Annotates source code with color attributes. More...

#include <Highlighter.h>

Inheritance diagram for lldb_private::Highlighter:
Inheritance graph
[legend]

Public Member Functions

 Highlighter ()=default
 
virtual ~Highlighter ()=default
 
 Highlighter (const Highlighter &)=delete
 
const Highlighteroperator= (const Highlighter &)=delete
 
virtual llvm::StringRef GetName () const =0
 Returns a human readable name for the selected highlighter.
 
virtual void Highlight (const HighlightStyle &options, llvm::StringRef line, std::optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const =0
 Highlights the given line.
 
std::string Highlight (const HighlightStyle &options, llvm::StringRef line, std::optional< size_t > cursor_pos, llvm::StringRef previous_lines="") const
 Utility method for calling Highlight without a stream.
 

Detailed Description

Annotates source code with color attributes.

Definition at line 91 of file Highlighter.h.

Constructor & Destructor Documentation

◆ Highlighter() [1/2]

lldb_private::Highlighter::Highlighter ( )
default

◆ ~Highlighter()

virtual lldb_private::Highlighter::~Highlighter ( )
virtualdefault

◆ Highlighter() [2/2]

lldb_private::Highlighter::Highlighter ( const Highlighter )
delete

Member Function Documentation

◆ GetName()

virtual llvm::StringRef lldb_private::Highlighter::GetName ( ) const
pure virtual

Returns a human readable name for the selected highlighter.

Implemented in lldb_private::DefaultHighlighter, and lldb_private::ClangHighlighter.

◆ Highlight() [1/2]

virtual void lldb_private::Highlighter::Highlight ( const HighlightStyle options,
llvm::StringRef  line,
std::optional< size_t >  cursor_pos,
llvm::StringRef  previous_lines,
Stream s 
) const
pure virtual

Highlights the given line.

Parameters
optionsThe highlight options.
lineThe user supplied line that needs to be highlighted.
cursor_posThe cursor position of the user in this line, starting at 0 (which means the cursor is on the first character in 'line').
previous_linesAny previous lines the user has written which we should only use for getting the context of the Highlighting right.
sThe stream to which the highlighted version of the user string should be written.

Implemented in lldb_private::DefaultHighlighter, and lldb_private::ClangHighlighter.

◆ Highlight() [2/2]

std::string Highlighter::Highlight ( const HighlightStyle options,
llvm::StringRef  line,
std::optional< size_t >  cursor_pos,
llvm::StringRef  previous_lines = "" 
) const

Utility method for calling Highlight without a stream.

Definition at line 74 of file Highlighter.cpp.

References lldb_private::StreamString::Flush(), and lldb_private::StreamString::GetString().

◆ operator=()

const Highlighter & lldb_private::Highlighter::operator= ( const Highlighter )
delete

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