Commit 24f4b73f authored by Ole Christian Eidheim's avatar Ole Christian Eidheim
Browse files

Added CodeCompleteResults move constructor, and fixed cx_completion_sting typo

parent b5fe402d
......@@ -12,6 +12,9 @@ namespace clangmm {
CodeCompleteResults(CXTranslationUnit &cx_tu, const std::string &buffer,
unsigned line_num, unsigned column);
public:
CodeCompleteResults(CodeCompleteResults &&rhs) : cx_results(rhs.cx_results) {
rhs.cx_results = nullptr;
}
~CodeCompleteResults();
CompletionString get(unsigned index) const;
unsigned size() const;
......
......@@ -5,24 +5,24 @@ clangmm::CompletionChunk::CompletionChunk(std::string text, CompletionChunkKind
: text(std::move(text)), kind(kind) {}
clangmm::CompletionString::CompletionString(const CXCompletionString &cx_completion_sting)
: cx_completion_sting(cx_completion_sting) {}
: cx_completion_string(cx_completion_sting) {}
bool clangmm::CompletionString::available() const {
return clang_getCompletionAvailability(cx_completion_sting) == CXAvailability_Available;
return clang_getCompletionAvailability(cx_completion_string) == CXAvailability_Available;
}
unsigned clangmm::CompletionString::get_num_chunks() const {
return clang_getNumCompletionChunks(cx_completion_sting);
return clang_getNumCompletionChunks(cx_completion_string);
}
std::vector<clangmm::CompletionChunk> clangmm::CompletionString::get_chunks() const {
std::vector<CompletionChunk> chunks;
for(unsigned i = 0; i < get_num_chunks(); ++i)
chunks.emplace_back(to_string(clang_getCompletionChunkText(cx_completion_sting, i)),
static_cast<CompletionChunkKind>(clang_getCompletionChunkKind(cx_completion_sting, i)));
chunks.emplace_back(to_string(clang_getCompletionChunkText(cx_completion_string, i)),
static_cast<CompletionChunkKind>(clang_getCompletionChunkKind(cx_completion_string, i)));
return chunks;
}
std::string clangmm::CompletionString::get_brief_comment() const {
return to_string(clang_getCompletionBriefComment(cx_completion_sting));
return to_string(clang_getCompletionBriefComment(cx_completion_string));
}
......@@ -34,7 +34,7 @@ namespace clangmm {
std::string get_brief_comment() const;
unsigned get_num_chunks() const;
CXCompletionString cx_completion_sting;
CXCompletionString cx_completion_string;
};
} // namespace clangmm
#endif // COMPLETIONSTRING_H_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment