mirror of https://gitlab.com/cppit/libclangmm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
42 lines
1.5 KiB
|
8 years ago
|
#include "code_complete_results.h"
|
||
|
|
#include "completion_string.h"
|
||
|
|
#include "utility.h"
|
||
|
11 years ago
|
|
||
|
9 years ago
|
clangmm::CodeCompleteResults::CodeCompleteResults(CXTranslationUnit &cx_tu,
|
||
|
10 years ago
|
const std::string &buffer,
|
||
|
|
unsigned line_num, unsigned column) {
|
||
|
|
CXUnsavedFile files[1];
|
||
|
10 years ago
|
auto file_path=to_string(clang_getTranslationUnitSpelling(cx_tu));
|
||
|
10 years ago
|
files[0].Filename = file_path.c_str();
|
||
|
|
files[0].Contents = buffer.c_str();
|
||
|
|
files[0].Length = buffer.size();
|
||
|
|
|
||
|
|
cx_results = clang_codeCompleteAt(cx_tu,
|
||
|
|
file_path.c_str(),
|
||
|
|
line_num,
|
||
|
|
column,
|
||
|
|
files,
|
||
|
|
1,
|
||
|
|
clang_defaultCodeCompleteOptions()|CXCodeComplete_IncludeBriefComments);
|
||
|
|
if(cx_results!=NULL)
|
||
|
|
clang_sortCodeCompletionResults(cx_results->Results, cx_results->NumResults);
|
||
|
|
}
|
||
|
|
|
||
|
9 years ago
|
clangmm::CodeCompleteResults::~CodeCompleteResults() {
|
||
|
10 years ago
|
clang_disposeCodeCompleteResults(cx_results);
|
||
|
11 years ago
|
}
|
||
|
|
|
||
|
9 years ago
|
unsigned clangmm::CodeCompleteResults::size() const {
|
||
|
10 years ago
|
if(cx_results==NULL)
|
||
|
|
return 0;
|
||
|
11 years ago
|
return cx_results->NumResults;
|
||
|
11 years ago
|
}
|
||
|
|
|
||
|
9 years ago
|
clangmm::CompletionString clangmm::CodeCompleteResults::get(unsigned i) const {
|
||
|
11 years ago
|
return CompletionString(cx_results->Results[i].CompletionString);
|
||
|
11 years ago
|
}
|
||
|
10 years ago
|
|
||
|
9 years ago
|
std::string clangmm::CodeCompleteResults::get_usr() const {
|
||
|
10 years ago
|
return to_string(clang_codeCompleteGetContainerUSR(cx_results));
|
||
|
10 years ago
|
}
|