ccls/libclangmm/CompletionString.cc

29 lines
1.0 KiB
C++
Raw Normal View History

2017-02-16 09:35:30 +00:00
#include "CompletionString.h"
#include "Utility.h"
clang::CompletionString::
CompletionString(const CXCompletionString &cx_completion_sting) : cx_completion_sting(cx_completion_sting) {}
bool clang::CompletionString::available() {
return clang_getCompletionAvailability(cx_completion_sting) == CXAvailability_Available;
}
unsigned clang::CompletionString::get_num_chunks() {
return clang_getNumCompletionChunks(cx_completion_sting);
}
std::vector<clang::CompletionChunk> clang::CompletionString::get_chunks() {
std::vector<CompletionChunk> res;
for (unsigned i = 0; i < get_num_chunks(); i++) {
2017-02-17 09:57:44 +00:00
res.emplace_back(ToString(clang_getCompletionChunkText(cx_completion_sting, i)), static_cast<CompletionChunkKind> (clang_getCompletionChunkKind(cx_completion_sting, i)));
2017-02-16 09:35:30 +00:00
}
return res;
}
std::string clang::CompletionString::get_brief_comments() {
2017-02-17 09:57:44 +00:00
return ToString(clang_getCompletionBriefComment(cx_completion_sting));
2017-02-16 09:35:30 +00:00
}
clang::CompletionChunk::CompletionChunk(std::string chunk, CompletionChunkKind kind) :
chunk(chunk), kind(kind) { }