本文整理汇总了C++中TagEntryPtrVector_t类的典型用法代码示例。如果您正苦于以下问题:C++ TagEntryPtrVector_t类的具体用法?C++ TagEntryPtrVector_t怎么用?C++ TagEntryPtrVector_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TagEntryPtrVector_t类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessCalltip
clCallTipPtr clTernServer::ProcessCalltip(const wxString& output)
{
// Function calltip response:
// ================================
// {
// "type": "fn(f: fn(elt: ?, i: number), context?: ?)",
// "name": "Array.prototype.forEach",
// "exprName": "forEach",
// "url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach",
// "doc": "Executes a provided function once per array element.",
// "origin": "ecma5"
// }
TagEntryPtrVector_t tags;
TagEntryPtr t(new TagEntry());
JSONRoot root(output);
wxString type = root.toElement().namedObject("type").toString();
int imgID;
wxString sig, retValue;
ProcessType(type, sig, retValue, imgID);
if(sig.IsEmpty()) {
return NULL;
}
t->SetSignature(sig);
t->SetReturnValue(retValue);
t->SetKind("function");
t->SetFlags(TagEntry::Tag_No_Signature_Format);
tags.push_back(t);
return new clCallTip(tags);
}
示例2: DoGetPHPEntryUnderTheAtPos
void PHPCodeCompletion::OnFunctionCallTip(clCodeCompletionEvent& e)
{
e.Skip();
if(PHPWorkspace::Get()->IsOpen()) {
if(!CanCodeComplete(e)) return;
IEditor* editor = dynamic_cast<IEditor*>(e.GetEditor());
if(editor) {
// we handle only .php files
if(IsPHPFile(editor)) {
// this is our to complete
e.Skip(false);
// get the position
PHPEntityBase::Ptr_t resolved = DoGetPHPEntryUnderTheAtPos(editor, editor->GetCurrentPosition(), true);
if(resolved) {
// In PHP there is no overloading, so there can be only one signature for a function
// so we simply place our match into TagEntryPtrVector_t structure and pass it to the editor
TagEntryPtrVector_t tags;
tags.push_back(DoPHPEntityToTagEntry(resolved));
clCallTipPtr callTip(new clCallTip(tags));
editor->ShowCalltip(callTip);
}
}
}
}
}
示例3: AddFunctionsImplBaseDlg
AddFunctionsImpDlg::AddFunctionsImpDlg(wxWindow* parent, const TagEntryPtrVector_t &tags, const wxString &targetFile)
: AddFunctionsImplBaseDlg(parent)
{
unsigned int colCount = m_dataviewModel->GetColCount();
m_dataviewModel = new MyAddFunctionsModel();
m_dataviewModel->SetColCount( colCount );
m_dataview->AssociateModel( m_dataviewModel.get() );
m_tags.insert(m_tags.end(), tags.begin(), tags.end());
for(size_t i=0; i<m_tags.size(); ++i) {
wxVector<wxVariant> cols;
cols.push_back(true);
cols.push_back( m_tags.at(i)->GetDisplayName() );
// keep the implementation as the client data
wxString body;
TagEntryPtr tag = m_tags.at(i);
tag->SetSignature( TagsManagerST::Get()->NormalizeFunctionSig( tag->GetSignature(), Normalize_Func_Name ) );
body << TagsManagerST::Get()->FormatFunction(tag, FunctionFormat_Impl);
body << wxT("\n");
m_dataviewModel->AppendItem( wxDataViewItem(0), cols, new wxStringClientData(body) );
}
m_filePicker->SetPath( targetFile );
WindowAttrManager::Load(this, "AddFunctionsImpDlg", NULL);
}
示例4: BuildTree
void svSymbolTree::BuildTree(const wxFileName& fn)
{
TagEntryPtrVector_t newTags;
ITagsStoragePtr db = TagsManagerST::Get()->GetDatabase();
if(!db) {
return;
}
db->SelectTagsByFile(fn.GetFullPath(), newTags);
if(TagsManagerST::Get()->AreTheSame(newTags, m_currentTags)) return;
std::sort(
newTags.begin(), newTags.end(), [&](TagEntryPtr t1, TagEntryPtr t2) { return t1->GetLine() > t2->GetLine(); });
wxWindowUpdateLocker locker(this);
SymbolTree::BuildTree(fn, &newTags);
// Request from the parsing thread list of include files
++m_uid;
ParseRequest* req = new ParseRequest(this);
req->setFile(fn.GetFullPath());
req->setType(ParseRequest::PR_PARSE_INCLUDE_STATEMENTS);
req->_uid = m_uid; // Identifies this request
ParseThreadST::Get()->Add(req);
wxTreeItemId root = GetRootItem();
if(root.IsOk() && ItemHasChildren(root)) {
wxTreeItemIdValue cookie;
wxTreeItemId child = GetFirstChild(root, cookie);
while(child.IsOk()) {
Expand(child);
child = GetNextChild(root, cookie);
}
}
}
示例5: TagsToEntries
wxCodeCompletionBoxEntry::Vec_t wxCodeCompletionBox::TagsToEntries(const TagEntryPtrVector_t& tags)
{
wxCodeCompletionBoxEntry::Vec_t entries;
for(size_t i = 0; i < tags.size(); ++i) {
TagEntryPtr tag = tags.at(i);
wxString text = tag->GetDisplayName().Trim().Trim(false);
int imgIndex = GetImageId(tag);
wxCodeCompletionBoxEntry::Ptr_t entry = wxCodeCompletionBoxEntry::New(text, imgIndex);
entry->m_tag = tag;
entries.push_back(entry);
}
return entries;
}
示例6: clGetManager
void LanguageServerCluster::OnSignatureHelp(LSPEvent& event)
{
IEditor* editor = clGetManager()->GetActiveEditor();
CHECK_PTR_RET(editor);
// Signature help results are ready, display them in the editor
const LSP::SignatureHelp& sighelp = event.GetSignatureHelp();
TagEntryPtrVector_t tags;
LSPSignatureHelpToTagEntries(tags, sighelp);
if(tags.empty()) { return; }
editor->ShowCalltip(new clCallTip(tags));
}
示例7: gotExactMatch
void OpenResourceDialog::DoPopulateTags()
{
bool gotExactMatch(false);
// Next, add the tags
TagEntryPtrVector_t tags;
if(m_userFilters.IsEmpty()) return;
m_manager->GetTagsManager()->GetTagsByPartialName(m_userFilters.Item(0), tags);
for(size_t i = 0; i < tags.size(); i++) {
TagEntryPtr tag = tags.at(i);
// Filter out non relevanting entries
if(!m_filters.IsEmpty() && m_filters.Index(tag->GetKind()) == wxNOT_FOUND) continue;
if(!MatchesFilter(tag->GetName())) continue;
wxString name(tag->GetName());
// keep the fullpath
wxDataViewItem item;
wxString fullname;
if(tag->GetKind() == wxT("function") || tag->GetKind() == wxT("prototype")) {
fullname = wxString::Format(
wxT("%s::%s%s"), tag->GetScope().c_str(), tag->GetName().c_str(), tag->GetSignature().c_str());
item = DoAppendLine(tag->GetName(),
fullname,
(tag->GetKind() == wxT("function")),
new OpenResourceDialogItemData(
tag->GetFile(), tag->GetLine(), tag->GetPattern(), tag->GetName(), tag->GetScope()),
DoGetTagImg(tag));
} else {
fullname = wxString::Format(wxT("%s::%s"), tag->GetScope().c_str(), tag->GetName().c_str());
item = DoAppendLine(tag->GetName(),
fullname,
false,
new OpenResourceDialogItemData(
tag->GetFile(), tag->GetLine(), tag->GetPattern(), tag->GetName(), tag->GetScope()),
DoGetTagImg(tag));
}
if((m_userFilters.GetCount() == 1) && (m_userFilters.Item(0).CmpNoCase(name) == 0) && !gotExactMatch) {
gotExactMatch = true;
DoSelectItem(item);
}
}
}
示例8: DoShowCompletionBox
void PHPCodeCompletion::DoShowCompletionBox(const PHPEntityBase::List_t& entries, PHPExpression::Ptr_t expr)
{
wxCodeCompletionBoxEntry::Vec_t ccEntries;
TagEntryPtrVector_t tags;
wxStringSet_t uniqueEntries;
// search for the old item
PHPEntityBase::List_t::const_iterator iter = entries.begin();
for(; iter != entries.end(); ++iter) {
PHPEntityBase::Ptr_t entry = *iter;
if(uniqueEntries.count(entry->GetFullName()) == 0) {
uniqueEntries.insert(entry->GetFullName());
} else {
// don't add duplicate entries
continue;
}
PHPEntityBase::Ptr_t ns = expr->GetSourceFile()->Namespace(); // the namespace at the source file
TagEntryPtr t = DoPHPEntityToTagEntry(entry);
tags.push_back(t);
}
std::sort(tags.begin(), tags.end(), _SAscendingSort());
for(size_t i = 0; i < tags.size(); ++i) {
wxCodeCompletionBoxEntry::Ptr_t ccEntry = wxCodeCompletionBox::TagToEntry(tags.at(i));
ccEntry->SetComment(tags.at(i)->GetComment());
ccEntries.push_back(ccEntry);
}
wxCodeCompletionBoxManager::Get().ShowCompletionBox(
m_manager->GetActiveEditor()->GetCtrl(), ccEntries, wxCodeCompletionBox::kRefreshOnKeyType, wxNOT_FOUND);
}
示例9: ShowCompletionBox
void wxCodeCompletionBoxManager::ShowCompletionBox(wxStyledTextCtrl* ctrl, const TagEntryPtrVector_t& tags,
size_t flags, int startPos, wxEvtHandler* eventObject)
{
DestroyCurrent();
CHECK_PTR_RET(ctrl);
CHECK_COND_RET(!tags.empty());
m_box = new wxCodeCompletionBox(wxTheApp->GetTopWindow(), eventObject);
m_box->SetFlags(flags);
m_box->SetStartPos(startPos);
m_stc = ctrl;
CallAfter(&wxCodeCompletionBoxManager::DoShowCCBoxTags, tags);
}
示例10: OnUserTypedXChars
void ContextBase::OnUserTypedXChars(const wxString& word)
{
// user typed more than 3 chars, display completion box with C++ keywords
if(IsCommentOrString(GetCtrl().GetCurrentPos())) {
return;
}
TagEntryPtrVector_t tags;
if(TagsManagerST::Get()->GetCtagsOptions().GetFlags() & CC_CPP_KEYWORD_ASISST) {
clCodeCompletionEvent ccEvt(wxEVT_CC_CODE_COMPLETE_LANG_KEYWORD);
ccEvt.SetEditor(&GetCtrl());
ccEvt.SetWord(word);
if(EventNotifier::Get()->ProcessEvent(ccEvt)) {
tags = ccEvt.GetTags();
}
if(!tags.empty()) {
GetCtrl().ShowCompletionBox(tags, // list of tags
word); // do not automatically insert word if there is only single choice
}
}
}
示例11: LSPSignatureHelpToTagEntries
void LanguageServerCluster::LSPSignatureHelpToTagEntries(TagEntryPtrVector_t& tags, const LSP::SignatureHelp& sighelp)
{
if(sighelp.GetSignatures().empty()) { return; }
const LSP::SignatureInformation::Vec_t& sigs = sighelp.GetSignatures();
for(const LSP::SignatureInformation& si : sigs) {
TagEntryPtr tag(new TagEntry());
wxString sig = si.GetLabel().BeforeFirst('-');
sig.Trim().Trim(false);
wxString returnValue = si.GetLabel().AfterFirst('-');
if(!returnValue.IsEmpty()) {
returnValue.Remove(0, 1); // remove ">"
returnValue.Trim().Trim(false);
}
tag->SetSignature(sig);
tag->SetReturnValue(returnValue);
tag->SetKind("function");
tag->SetFlags(TagEntry::Tag_No_Signature_Format);
tags.push_back(tag);
}
}
示例12: BuildTree
void SymbolTree::BuildTree(const wxFileName &fileName, TagEntryPtrVector_t* tags /*NULL*/)
{
TagEntryPtrVector_t newTags;
if ( !tags ) {
// Get the current database
ITagsStoragePtr db = TagsManagerST::Get()->GetDatabase();
if ( ! db ) {
Clear();
return;
}
// Load the new tags from the database
db->SelectTagsByFile(fileName.GetFullPath(), newTags);
// Compare the new tags with the old ones
if ( TagsManagerST::Get()->AreTheSame(newTags, m_currentTags) )
return;
m_currentTags.clear();
m_currentTags.insert(m_currentTags.end(), newTags.begin(), newTags.end());
} else {
m_currentTags.clear();
m_currentTags.insert(m_currentTags.end(), tags->begin(), tags->end());
}
wxWindowUpdateLocker locker(this);
Clear();
m_fileName = fileName;
// Convert them into tree
m_tree = TagsManagerST::Get()->Load(m_fileName, &m_currentTags);
if ( !m_tree ) {
return;
}
// Add invisible root node
wxTreeItemId root;
root = AddRoot(fileName.GetFullName(), 15, 15);
TreeWalker<wxString, TagEntry> walker(m_tree->GetRoot());
// add three items here:
// the globals node, the mcros and the prototype node
m_globalsNode = AppendItem(root, wxT("Global Functions and Variables"), 2, 2, new MyTreeItemData(wxT("Global Functions and Variables"), wxEmptyString));
m_prototypesNode = AppendItem(root, wxT("Functions Prototypes"), 2, 2, new MyTreeItemData(wxT("Functions Prototypes"), wxEmptyString));
m_macrosNode = AppendItem(root, wxT("Macros"), 2, 2, new MyTreeItemData(wxT("Macros"), wxEmptyString));
// Iterate over the tree and add items
m_sortItems.clear();
Freeze();
for (; !walker.End(); walker++) {
// Add the item to the tree
TagNode* node = walker.GetNode();
// Skip root node
if (node->IsRoot())
continue;
// Add the node
AddItem(node);
}
SortTree(m_sortItems);
if ( ItemHasChildren(m_globalsNode) == false ) {
Delete(m_globalsNode);
}
if ( ItemHasChildren(m_prototypesNode) == false ) {
Delete(m_prototypesNode);
}
if ( ItemHasChildren(m_macrosNode) == false ) {
Delete(m_macrosNode);
}
Thaw();
//select the root node by default
if (!(GetWindowStyleFlag() & wxTR_HIDE_ROOT)) {
//root is visible, select it
SelectItem(GetRootItem());
}
}