clang 8.0.0

Classes | Public Types | Public Member Functions | Friends | List of all members
clang::CodeCompletionString Class Reference

A "string" used to describe how code completion can be performed for an entity. More...

`#include "clang/Sema/CodeCompleteConsumer.h"`

## Classes
struct | Chunk
| One piece of the code completion string. More...

## Public Types
enum | ChunkKind { CK_TypedText, CK_Text, CK_Optional, CK_Placeholder, CK_Informative, CK_ResultType, CK_CurrentParameter, CK_LeftParen, CK_RightParen, CK_LeftBracket, CK_RightBracket, CK_LeftBrace, CK_RightBrace, CK_LeftAngle, CK_RightAngle, CK_Comma, CK_Colon, CK_SemiColon, CK_Equal, CK_HorizontalSpace, CK_VerticalSpace }
| The different kinds of "chunks" that can occur within a code completion string. More...
using | iterator = const Chunk *

## Public Member Functions
| CodeCompletionString (const CodeCompletionString &)=delete
CodeCompletionString & | operator= (const CodeCompletionString &)=delete
iterator | begin () const
iterator | end () const
bool | empty () const
unsigned | size () const
const Chunk & | operator[] (unsigned I) const
const char * | getTypedText () const
| Returns the text in the TypedText chunk. More...
unsigned | getPriority () const
| Retrieve the priority of this code completion result. More...
unsigned | getAvailability () const
| Retrieve the availability of this code completion result. More...
unsigned | getAnnotationCount () const
| Retrieve the number of annotations for this code completion result. More...
const char * | getAnnotation (unsigned AnnotationNr) const
| Retrieve the annotation string specified by `AnnotationNr`. More...
StringRef | getParentContextName () const
| Retrieve the name of the parent context. More...
const char * | getBriefComment () const
std::string | getAsString () const
| Retrieve a string representation of the code completion string, which is mainly useful for debugging. More...

## Friends
class | CodeCompletionBuilder
class | CodeCompletionResult

## Detailed Description

A "string" used to describe how code completion can be performed for an entity.

A code completion string typically shows how a particular entity can be used. For example, the code completion string for a function would show the syntax to call it, including the parentheses, placeholders for the arguments, etc.

Definition at line 430 of file CodeCompleteConsumer.h.

## Member Typedef Documentation

## ◆ iterator

using clang::CodeCompletionString::iterator = const Chunk *

Definition at line 585 of file CodeCompleteConsumer.h.

## Member Enumeration Documentation

## ◆ ChunkKind

enum clang::CodeCompletionString::ChunkKind

The different kinds of "chunks" that can occur within a code completion string.

Enumerator
CK_TypedText | The piece of text that the user is expected to type to match the code-completion string, typically a keyword or the name of a declarator or macro.
CK_Text | A piece of text that should be placed in the buffer, e.g., parentheses or a comma in a function call.
CK_Optional | A code completion string that is entirely optional. For example, an optional code completion string that describes the default arguments in a function call.
CK_Placeholder | A string that acts as a placeholder for, e.g., a function call argument.
CK_Informative | A piece of text that describes something about the result but should not be inserted into the buffer.
CK_ResultType | A piece of text that describes the type of an entity or, for functions and methods, the return type.
CK_CurrentParameter | A piece of text that describes the parameter that corresponds to the code-completion location within a function call, message send, macro invocation, etc.
CK_LeftParen | A left parenthesis ('(').
CK_RightParen | A right parenthesis (')').
CK_LeftBracket | A left bracket ('[').
CK_RightBracket | A right bracket (']').
CK_LeftBrace | A left brace ('{').
CK_RightBrace | A right brace ('}').
CK_LeftAngle | A left angle bracket ('<').
CK_RightAngle | A right angle bracket ('>').
CK_Comma | A comma separator (',').
CK_Colon | A colon (':').
CK_SemiColon | A semicolon (';').
CK_Equal | An '=' sign.
CK_HorizontalSpace | Horizontal whitespace (' ').
CK_VerticalSpace | Vertical whitespace ('\n' or '\r\n', depending on the platform).

Definition at line 434 of file CodeCompleteConsumer.h.

## Constructor & Destructor Documentation

## ◆ CodeCompletionString()

clang::CodeCompletionString::CodeCompletionString | ( | const CodeCompletionString & |  | ) |
| delete

## Member Function Documentation

## ◆ begin()

iterator clang::CodeCompletionString::begin | ( |  | ) | const
| inline

Definition at line 587 of file CodeCompleteConsumer.h.

## ◆ empty()

bool clang::CodeCompletionString::empty | ( |  | ) | const
| inline

Definition at line 589 of file CodeCompleteConsumer.h.

## ◆ end()

iterator clang::CodeCompletionString::end | ( |  | ) | const
| inline

Definition at line 588 of file CodeCompleteConsumer.h.

Referenced by getAnnotation().

## ◆ getAnnotation()

const char * CodeCompletionString::getAnnotation | ( | unsigned | AnnotationNr | ) | const

Retrieve the annotation string specified by `AnnotationNr`.

Definition at line 304 of file CodeCompleteConsumer.cpp.

References end().

## ◆ getAnnotationCount()

unsigned CodeCompletionString::getAnnotationCount | ( |  | ) | const

Retrieve the number of annotations for this code completion result.

Definition at line 300 of file CodeCompleteConsumer.cpp.

## ◆ getAsString()

std::string CodeCompletionString::getAsString | ( |  | ) | const

Retrieve a string representation of the code completion string, which is mainly useful for debugging.

Definition at line 311 of file CodeCompleteConsumer.cpp.

References clang::C, CK_CurrentParameter, CK_Informative, CK_Optional, CK_Placeholder, CK_ResultType, getAsString(), clang::CodeCompletionString::Chunk::Kind, clang::CodeCompletionString::Chunk::Optional, clang::Result, and clang::CodeCompletionString::Chunk::Text.

Referenced by getAsString().

## ◆ getAvailability()

unsigned clang::CodeCompletionString::getAvailability | ( |  | ) | const
| inline

Retrieve the availability of this code completion result.

Definition at line 604 of file CodeCompleteConsumer.h.

Referenced by getDeclAvailability().

## ◆ getBriefComment()

const char* clang::CodeCompletionString::getBriefComment | ( |  | ) | const
| inline

Definition at line 617 of file CodeCompleteConsumer.h.

References clang::getAsString().

## ◆ getParentContextName()

StringRef clang::CodeCompletionString::getParentContextName | ( |  | ) | const
| inline

Retrieve the name of the parent context.

Definition at line 613 of file CodeCompleteConsumer.h.

## ◆ getPriority()

unsigned clang::CodeCompletionString::getPriority | ( |  | ) | const
| inline

Retrieve the priority of this code completion result.

Definition at line 601 of file CodeCompleteConsumer.h.

## ◆ getTypedText()

const char * CodeCompletionString::getTypedText | ( |  | ) | const

Returns the text in the TypedText chunk.

Definition at line 338 of file CodeCompleteConsumer.cpp.

References clang::C, CK_TypedText, clang::CodeCompletionString::Chunk::Kind, and clang::CodeCompletionString::Chunk::Text.

Referenced by clang::PrintingCodeCompleteConsumer::isResultFilteredOut().

## ◆ operator=()

CodeCompletionString& clang::CodeCompletionString::operator= | ( | const CodeCompletionString & |  | ) |
| delete

## ◆ operator[]()

const Chunk& clang::CodeCompletionString::operator[] | ( | unsigned | I | ) | const
| inline

Definition at line 592 of file CodeCompleteConsumer.h.

## ◆ size()

unsigned clang::CodeCompletionString::size | ( |  | ) | const
| inline

Definition at line 590 of file CodeCompleteConsumer.h.

## Friends And Related Function Documentation

## ◆ CodeCompletionBuilder

friend class CodeCompletionBuilder
| friend

Definition at line 552 of file CodeCompleteConsumer.h.

## ◆ CodeCompletionResult

friend class CodeCompletionResult
| friend

Definition at line 553 of file CodeCompleteConsumer.h.

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

- include/clang/Sema/CodeCompleteConsumer.h
- lib/Sema/CodeCompleteConsumer.cpp