clang-tools  14.0.0git
Classes | Public Member Functions | List of all members
clang::clangd::DraftStore Class Reference

A thread-safe container for files opened in a workspace, addressed by filenames. More...

#include <DraftStore.h>

Classes

struct  Draft
 

Public Member Functions

llvm::Optional< DraftgetDraft (PathRef File) const
 
std::vector< PathgetActiveFiles () const
 
std::string addDraft (PathRef File, llvm::StringRef Version, StringRef Contents)
 Replace contents of the draft for File with Contents. More...
 
void removeDraft (PathRef File)
 Remove the draft from the store. More...
 
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > asVFS () const
 

Detailed Description

A thread-safe container for files opened in a workspace, addressed by filenames.

The contents are owned by the DraftStore. Each time a draft is updated, it is assigned a version. This can be specified by the caller or incremented from the previous version.

Definition at line 28 of file DraftStore.h.

Member Function Documentation

◆ addDraft()

std::string clang::clangd::DraftStore::addDraft ( PathRef  File,
llvm::StringRef  Version,
StringRef  Contents 
)

Replace contents of the draft for File with Contents.

If version is empty, one will be automatically assigned. Returns the version.

Definition at line 76 of file DraftStore.cpp.

◆ asVFS()

llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > clang::clangd::DraftStore::asVFS ( ) const

Definition at line 118 of file DraftStore.cpp.

References clang::clangd::DraftStore::Draft::Contents.

◆ getActiveFiles()

std::vector< Path > clang::clangd::DraftStore::getActiveFiles ( ) const
Returns
List of names of the drafts in this store.

Definition at line 30 of file DraftStore.cpp.

◆ getDraft()

llvm::Optional< DraftStore::Draft > clang::clangd::DraftStore::getDraft ( PathRef  File) const
Returns
Contents of the stored document. For untracked files, a llvm::None is returned.

Definition at line 20 of file DraftStore.cpp.

Referenced by clang::clangd::ClangdServer::getDraft().

◆ removeDraft()

void clang::clangd::DraftStore::removeDraft ( PathRef  File)

Remove the draft from the store.

Definition at line 87 of file DraftStore.cpp.

Referenced by clang::clangd::ClangdServer::removeDocument().


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