LLDB  mainline
Public Member Functions | Private Attributes | List of all members
lldb_private::ClangHighlighter Class Reference

#include <ClangHighlighter.h>

Inheritance diagram for lldb_private::ClangHighlighter:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::ClangHighlighter:
Collaboration graph
[legend]

Public Member Functions

 ClangHighlighter ()
 
llvm::StringRef GetName () const override
 Returns a human readable name for the selected highlighter. More...
 
void Highlight (const HighlightStyle &options, llvm::StringRef line, llvm::Optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const override
 Highlights the given line. More...
 
bool isKeyword (llvm::StringRef token) const
 Returns true if the given string represents a keywords in any Clang supported language. More...
 
- Public Member Functions inherited from lldb_private::Highlighter
 Highlighter ()=default
 
virtual ~Highlighter ()=default
 
 Highlighter (const Highlighter &)=delete
 
const Highlighteroperator= (const Highlighter &)=delete
 
std::string Highlight (const HighlightStyle &options, llvm::StringRef line, llvm::Optional< size_t > cursor_pos, llvm::StringRef previous_lines="") const
 Utility method for calling Highlight without a stream. More...
 

Private Attributes

llvm::StringSet keywords
 

Detailed Description

Definition at line 19 of file ClangHighlighter.h.

Constructor & Destructor Documentation

◆ ClangHighlighter()

ClangHighlighter::ClangHighlighter ( )

Definition at line 28 of file ClangHighlighter.cpp.

Member Function Documentation

◆ GetName()

llvm::StringRef lldb_private::ClangHighlighter::GetName ( ) const
inlineoverridevirtual

Returns a human readable name for the selected highlighter.

Implements lldb_private::Highlighter.

Definition at line 24 of file ClangHighlighter.h.

◆ Highlight()

void ClangHighlighter::Highlight ( const HighlightStyle options,
llvm::StringRef  line,
llvm::Optional< size_t >  cursor_pos,
llvm::StringRef  previous_lines,
Stream s 
) const
overridevirtual

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.

Implements lldb_private::Highlighter.

Definition at line 132 of file ClangHighlighter.cpp.

References lldb_private::HighlightStyle::ColorStyle::Apply(), determineClangStyle(), lldb_private::StreamString::GetString(), lldb_private::FileSystem::Instance(), lldb_private::HighlightStyle::selected, and string().

◆ isKeyword()

bool ClangHighlighter::isKeyword ( llvm::StringRef  token) const

Returns true if the given string represents a keywords in any Clang supported language.

Definition at line 24 of file ClangHighlighter.cpp.

References keywords.

Referenced by determineClangStyle().

Member Data Documentation

◆ keywords

llvm::StringSet lldb_private::ClangHighlighter::keywords
private

Definition at line 20 of file ClangHighlighter.h.

Referenced by isKeyword().


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