|
|
|
@ -1,9 +1,10 @@ |
|
|
|
#include "CodeCompleteResults.h" |
|
|
|
#include "CodeCompleteResults.h" |
|
|
|
#include "CompletionString.h" |
|
|
|
#include "CompletionString.h" |
|
|
|
#include <exception> |
|
|
|
#include <exception> |
|
|
|
|
|
|
|
#include "Utility.h" |
|
|
|
|
|
|
|
|
|
|
|
clang::CodeCompleteResults:: |
|
|
|
clang::CodeCompleteResults::CodeCompleteResults(CXTranslationUnit &cx_tu,
|
|
|
|
CodeCompleteResults(CXTranslationUnit &cx_tu, const std::string &file_name, |
|
|
|
const std::string &file_name, |
|
|
|
const std::map<std::string, std::string> &buffers, |
|
|
|
const std::map<std::string, std::string> &buffers, |
|
|
|
unsigned line_num, unsigned column) { |
|
|
|
unsigned line_num, unsigned column) { |
|
|
|
std::vector<CXUnsavedFile> files; |
|
|
|
std::vector<CXUnsavedFile> files; |
|
|
|
@ -29,17 +30,19 @@ clang::CodeCompleteResults::~CodeCompleteResults() { |
|
|
|
clang_disposeCodeCompleteResults(cx_results); |
|
|
|
clang_disposeCodeCompleteResults(cx_results); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unsigned clang::CodeCompleteResults:: |
|
|
|
unsigned clang::CodeCompleteResults::size() const { |
|
|
|
size() { |
|
|
|
|
|
|
|
if(cx_results==NULL) |
|
|
|
if(cx_results==NULL) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
return cx_results->NumResults; |
|
|
|
return cx_results->NumResults; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
clang::CompletionString clang::CodeCompleteResults:: |
|
|
|
clang::CompletionString clang::CodeCompleteResults::get(unsigned i) const { |
|
|
|
get(unsigned i) { |
|
|
|
|
|
|
|
if (i >= size()) { |
|
|
|
if (i >= size()) { |
|
|
|
throw std::invalid_argument("clang::CodeCompleteResults::get(unsigned i): i>=size()"); |
|
|
|
throw std::invalid_argument("clang::CodeCompleteResults::get(unsigned i): i>=size()"); |
|
|
|
} |
|
|
|
} |
|
|
|
return CompletionString(cx_results->Results[i].CompletionString); |
|
|
|
return CompletionString(cx_results->Results[i].CompletionString); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string clang::CodeCompleteResults::get_usr() const { |
|
|
|
|
|
|
|
return clang::to_string(clang_codeCompleteGetContainerUSR(cx_results)); |
|
|
|
|
|
|
|
} |
|
|
|
|