当前位置: 首页>>代码示例>>C++>>正文


C++ TagEntryPtr类代码示例

本文整理汇总了C++中TagEntryPtr的典型用法代码示例。如果您正苦于以下问题:C++ TagEntryPtr类的具体用法?C++ TagEntryPtr怎么用?C++ TagEntryPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TagEntryPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:292388900,项目名称:codelite,代码行数:13,代码来源:wxCodeCompletionBox.cpp

示例2: DoCtagsGotoDecl

bool CodeCompletionManager::DoCtagsGotoDecl(LEditor* editor)
{
    TagEntryPtr tag = editor->GetContext()->GetTagAtCaret(true, false);
    if (tag) {
        LEditor *editor = clMainFrame::Get()->GetMainBook()->OpenFile(tag->GetFile(), wxEmptyString, tag->GetLine()-1);
        if(!editor) {
            return false;
        }
        editor->FindAndSelect(tag->GetPattern(), tag->GetName());
        return true;
    }
    return false;
}
开发者ID:ecmadrid,项目名称:codelite,代码行数:13,代码来源:code_completion_manager.cpp

示例3: Clear

void RefactoringEngine::RenameLocalSymbol(const wxString& symname, const wxFileName& fn, int line, int pos)
{
    // Clear previous results
    Clear();

    // Load the file and get a state map + the text from the scanner
    CppWordScanner scanner(fn.GetFullPath());

    // get the current file states
    TextStatesPtr states = scanner.states();
    if( !states ) {
        return;
    }


    // get the local by scanning from the current function's
    TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(fn, line + 1);
    if( !tag ) {
        return;
    }

    // Get the line number of the function
    int funcLine = tag->GetLine() - 1;

    // Convert the line number to offset
    int from = states->LineToPos     (funcLine);
    int to   = states->FunctionEndPos(from);

    if(to == wxNOT_FOUND)
        return;

    // search for matches in the given range
    CppTokensMap l;
    scanner.Match(symname, l, from, to);

    CppToken::List_t tokens;
    l.findTokens(symname, tokens);
    if (tokens.empty())
        return;

    // Loop over the matches
    // Incase we did manage to resolve the word, it means that it is NOT a local variable (DoResolveWord only wors for globals NOT for locals)
    RefactorSource target;
    std::list<CppToken>::iterator iter = tokens.begin();
    for (; iter != tokens.end(); iter++) {
        wxFileName f( iter->getFilename() );
        if (!DoResolveWord(states, wxFileName(iter->getFilename()), iter->getOffset(), line, symname, &target)) {
            m_candidates.push_back( *iter );
        }
    }
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:51,代码来源:refactorengine.cpp

示例4: DoCtagsGotoDecl

bool CodeCompletionManager::DoCtagsGotoDecl(LEditor* editor)
{
    TagEntryPtr tag = editor->GetContext()->GetTagAtCaret(true, false);
    if (tag) {
        LEditor *editor = clMainFrame::Get()->GetMainBook()->OpenFile(tag->GetFile(), wxEmptyString, tag->GetLine()-1);
        if(!editor) {
            return false;
        }
        // Use the async funtion here. Synchronously usually works but, if the file wasn't loaded, sometimes the EnsureVisible code is called too early and fails
        editor->FindAndSelectV(tag->GetPattern(), tag->GetName());
        return true;
    }
    return false;
}
开发者ID:linweixin,项目名称:codelite,代码行数:14,代码来源:code_completion_manager.cpp

示例5: TagToEntry

wxCodeCompletionBoxEntry::Ptr_t wxCodeCompletionBox::TagToEntry(TagEntryPtr tag)
{
    wxString text = tag->GetDisplayName().Trim().Trim(false);
    int imgIndex = GetImageId(tag);
    wxCodeCompletionBoxEntry::Ptr_t entry = wxCodeCompletionBoxEntry::New(text, imgIndex);
    return entry;
}
开发者ID:kluete,项目名称:codelite,代码行数:7,代码来源:wxCodeCompletionBox.cpp

示例6: AppendText

void FindResultsTab::OnSearchMatch(wxCommandEvent& e)
{
    SearchResultList* res = (SearchResultList*)e.GetClientData();
    if(!res) return;

    SearchResultList::iterator iter = res->begin();
    for(; iter != res->end(); ++iter) {
        if(m_matchInfo.empty() || m_matchInfo.rbegin()->second.GetFileName() != iter->GetFileName()) {
            if(!m_matchInfo.empty()) {
                AppendText("\n");
            }
            wxFileName fn(iter->GetFileName());
            fn.MakeRelativeTo();
            AppendText(fn.GetFullPath() + wxT("\n"));
        }

        int lineno = m_sci->GetLineCount() - 1;
        m_matchInfo.insert(std::make_pair(lineno, *iter));
        wxString text = iter->GetPattern();
        // int delta = -text.Length();
        // text.Trim(false);
        // delta += text.Length();
        // text.Trim();

        wxString linenum = wxString::Format(wxT(" %5u: "), iter->GetLineNumber());
        SearchData* d = GetSearchData();
        // Print the scope name
        if(d->GetDisplayScope()) {
            TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(iter->GetFileName(), iter->GetLineNumber());
            wxString scopeName(wxT("global"));
            if(tag) {
                scopeName = tag->GetPath();
            }

            linenum << wxT("[ ") << scopeName << wxT(" ] ");
            iter->SetScope(scopeName);
        }

        AppendText(linenum + text + wxT("\n"));
        int indicatorStartPos = m_sci->PositionFromLine(lineno) + iter->GetColumn() + linenum.Length();
        int indicatorLen = iter->GetLen();
        m_indicators.push_back(indicatorStartPos);
        m_sci->IndicatorFillRange(indicatorStartPos, indicatorLen);
    }
    wxDELETE(res);
}
开发者ID:kluete,项目名称:codelite,代码行数:46,代码来源:findresultstab.cpp

示例7: wxT

wxString WizardsPlugin::DoGetVirtualFuncImpl(const NewClassInfo &info)
{
    if (info.implAllVirtual == false && info.implAllPureVirtual == false)
        return wxEmptyString;

    //get list of all parent virtual functions
    std::vector< TagEntryPtr > tmp_tags;
    std::vector< TagEntryPtr > no_dup_tags;
    std::vector< TagEntryPtr > tags;
    for (std::vector< TagEntryPtr >::size_type i=0; i< info.parents.size(); i++) {
        ClassParentInfo pi = info.parents.at(i);

        // Load all prototypes / functions of the parent scope
        m_mgr->GetTagsManager()->TagsByScope(pi.name, wxT("prototype"), tmp_tags, false);
        m_mgr->GetTagsManager()->TagsByScope(pi.name, wxT("function"),  tmp_tags, false);
    }

    // and finally sort the results
    std::sort(tmp_tags.begin(), tmp_tags.end(), ascendingSortOp());
    GizmosRemoveDuplicates(tmp_tags, no_dup_tags);

    //filter out all non virtual functions
    for (std::vector< TagEntryPtr >::size_type i=0; i< no_dup_tags.size(); i++) {
        TagEntryPtr tt = no_dup_tags.at(i);
        bool collect(false);
        if (info.implAllVirtual) {
            collect = m_mgr->GetTagsManager()->IsVirtual(tt);
        } else if (info.implAllPureVirtual) {
            collect = m_mgr->GetTagsManager()->IsPureVirtual(tt);
        }

        if (collect) {
            tags.push_back(tt);
        }
    }

    wxString impl;
    for (std::vector< TagEntryPtr >::size_type i=0; i< tags.size(); i++) {
        TagEntryPtr tt = tags.at(i);
        // we are not interested in Ctor-Dtor
        if ( tt->IsConstructor() || tt->IsDestructor() )
            continue;
        impl << m_mgr->GetTagsManager()->FormatFunction(tt, FunctionFormat_Impl, info.name);
    }
    return impl;
}
开发者ID:HTshandou,项目名称:codelite,代码行数:46,代码来源:gizmos.cpp

示例8: wxMessageBox

void TestClassDlg::DoRefreshFunctions(bool repportError)
{
    std::vector<TagEntryPtr> matches;

    // search m_tags for suitable name
    for(size_t i = 0; i < m_tags.size(); i++) {
        TagEntryPtr tag = m_tags.at(i);
        if(tag->GetName() == m_textCtrlClassName->GetValue()) {
            matches.push_back(tag);
        }
    }

    if(matches.empty()) {
        if(repportError) {
            wxMessageBox(_("Could not find match for class '") + m_textCtrlClassName->GetValue() + wxT("'"),
                         _("CodeLite"),
                         wxICON_WARNING | wxOK);
        }
        return;
    }

    wxString theClass;
    if(matches.size() == 1) {
        // single match we are good
        theClass = matches.at(0)->GetPath();
    } else {
        // suggest the user a multiple choice
        wxArrayString choices;

        for(size_t i = 0; i < matches.size(); i++) {
            wxString option;
            TagEntryPtr t = matches.at(i);
            choices.Add(t->GetPath());
        }

        theClass = wxGetSingleChoice(_("Select class:"), _("Select class:"), choices, this);
    }

    if(theClass.empty()) { // user clicked 'Cancel'
        return;
    }

    // get list of methods for the given path
    matches.clear();
    m_manager->GetTagsManager()->TagsByScope(theClass, wxT("prototype"), matches, false, true);

    // populate the list control
    wxArrayString methods;
    for(size_t i = 0; i < matches.size(); i++) {
        TagEntryPtr t = matches.at(i);
        methods.Add(t->GetName() + t->GetSignature());
    }
    m_checkListMethods->Clear();
    m_checkListMethods->Append(methods);

    // check all items
    for(unsigned int idx = 0; idx < m_checkListMethods->GetCount(); idx++) {
        m_checkListMethods->Check(idx, true);
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:60,代码来源:testclassdlg.cpp

示例9: AddSymbol

void SymbolsDialog::AddSymbol(const TagEntryPtr &tag, bool sel)
{
	//-------------------------------------------------------
	// Populate the columns
	//-------------------------------------------------------

	wxString line;
	line << tag->GetLine();
	
	long index = AppendListCtrlRow(m_results);
	SetColumnText(m_results, index, 0, tag->GetFullDisplayName());
	SetColumnText(m_results, index, 1, tag->GetKind());
	SetColumnText(m_results, index, 2, tag->GetFile());
	SetColumnText(m_results, index, 3, line);
	SetColumnText(m_results, index, 4, tag->GetPattern());

    // list ctrl can reorder items, so use returned index to insert tag
    m_tags.insert(m_tags.begin()+index, tag);
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:19,代码来源:symbols_dialog.cpp

示例10: DoOpenEditorForEntry

void PHPCodeCompletion::OnFindSymbol(clCodeCompletionEvent& e)
{
    e.Skip();
    if(PHPWorkspace::Get()->IsOpen()) {
        if(!CanCodeComplete(e)) return;
        e.Skip(false);
        IEditor* editor = dynamic_cast<IEditor*>(e.GetEditor());
        if(editor) {
            wxString word = editor->GetWordAtCaret();
            if(word.IsEmpty()) return;
            PHPEntityBase::List_t symbols = m_lookupTable.FindSymbol(word);
            if(symbols.size() == 1) {
                PHPEntityBase::Ptr_t match = *symbols.begin();
                DoOpenEditorForEntry(match);

            } else {

                // Convert the matches to clSelectSymbolDialogEntry::List_t
                clSelectSymbolDialogEntry::List_t entries;
                std::for_each(symbols.begin(), symbols.end(), [&](PHPEntityBase::Ptr_t entry) {
                    TagEntryPtr tag = DoPHPEntityToTagEntry(entry);
                    wxBitmap bmp = wxCodeCompletionBox::GetBitmap(tag);

                    clSelectSymbolDialogEntry m;
                    m.bmp = bmp;
                    m.name = entry->GetFullName();
                    m.clientData = new PHPFindSymbol_ClientData(entry);
                    m.help = tag->GetKind();
                    entries.push_back(m);
                });

                // Show selection dialog
                clSelectSymbolDialog dlg(EventNotifier::Get()->TopFrame(), entries);
                if(dlg.ShowModal() != wxID_OK) return;
                PHPFindSymbol_ClientData* cd = dynamic_cast<PHPFindSymbol_ClientData*>(dlg.GetSelection());
                if(cd) {
                    DoOpenEditorForEntry(cd->m_ptr);
                }
            }
        }
    }
}
开发者ID:anatooly,项目名称:codelite,代码行数:42,代码来源:php_code_completion.cpp

示例11: UpdateScope

void NavBar::UpdateScope(TagEntryPtr tag)
{
    size_t sel = m_func->GetSelection();
    if(tag && sel < m_tags.size() && *m_tags[sel] == *tag) return;

    wxWindowUpdateLocker locker(this);

    m_tags.clear();
    m_scope->Clear();
    m_func->Clear();

    if(tag) {
        m_tags.push_back(tag);
        m_scope->AppendString(tag->GetScope());
        m_func->AppendString(tag->GetDisplayName());
        m_scope->SetSelection(0);
        m_func->SetSelection(0);

        DoPopulateTags(DoGetCurFileName());
    }
}
开发者ID:05storm26,项目名称:codelite,代码行数:21,代码来源:navbar.cpp

示例12: CHECK_PTR_RET

void SmartCompletion::OnCodeCompletionSelectionMade(clCodeCompletionEvent& event)
{
    event.Skip();
    if(!m_config.IsEnabled()) return;

    CHECK_PTR_RET(event.GetEntry());

    // Collect info about this match
    TagEntryPtr tag = event.GetEntry()->GetTag();
    if(tag) {
        WeightTable_t& T = *m_pCCWeight;
        // we have an associated tag
        wxString k = tag->GetScope() + "::" + tag->GetName();
        if(T.count(k) == 0) {
            T[k] = 1;
        } else {
            T[k]++;
        }
        m_config.GetUsageDb().StoreCCUsage(k, T[k]);
    }
}
开发者ID:eranif,项目名称:codelite,代码行数:21,代码来源:smartcompletion.cpp

示例13: DoGetTagImg

wxBitmap OpenResourceDialog::DoGetTagImg(TagEntryPtr tag)
{
    wxString kind = tag->GetKind();
    wxString access = tag->GetAccess();
    wxBitmap bmp = m_tagImgMap[wxT("text")];
    if(kind == wxT("class")) bmp = m_tagImgMap[wxT("class")];

    if(kind == wxT("struct")) bmp = m_tagImgMap[wxT("struct")];

    if(kind == wxT("namespace")) bmp = m_tagImgMap[wxT("namespace")];

    if(kind == wxT("variable")) bmp = m_tagImgMap[wxT("member_public")];

    if(kind == wxT("typedef")) bmp = m_tagImgMap[wxT("typedef")];

    if(kind == wxT("member") && access.Contains(wxT("private"))) bmp = m_tagImgMap[wxT("member_private")];

    if(kind == wxT("member") && access.Contains(wxT("public"))) bmp = m_tagImgMap[wxT("member_public")];

    if(kind == wxT("member") && access.Contains(wxT("protected"))) bmp = m_tagImgMap[wxT("member_protected")];

    if(kind == wxT("member")) bmp = m_tagImgMap[wxT("member_public")];

    if((kind == wxT("function") || kind == wxT("prototype")) && access.Contains(wxT("private")))
        bmp = m_tagImgMap[wxT("function_private")];

    if((kind == wxT("function") || kind == wxT("prototype")) && (access.Contains(wxT("public")) || access.IsEmpty()))
        bmp = m_tagImgMap[wxT("function_public")];

    if((kind == wxT("function") || kind == wxT("prototype")) && access.Contains(wxT("protected")))
        bmp = m_tagImgMap[wxT("function_protected")];

    if(kind == wxT("macro")) bmp = m_tagImgMap[wxT("typedef")];

    if(kind == wxT("enum")) bmp = m_tagImgMap[wxT("enum")];

    if(kind == wxT("enumerator")) bmp = m_tagImgMap[wxT("enumerator")];

    return bmp;
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:40,代码来源:open_resource_dialog.cpp

示例14: GetImageId

int wxCodeCompletionBox::GetImageId(TagEntryPtr entry)
{
    wxString kind = entry->GetKind();
    wxString access = entry->GetAccess();
    if(kind == wxT("class")) return 0;
    if(kind == wxT("struct")) return 1;
    if(kind == wxT("namespace")) return 2;
    if(kind == wxT("variable")) return 3;
    if(kind == wxT("typedef")) return 4;
    if(kind == wxT("member") && access.Contains(wxT("private"))) return 5;
    if(kind == wxT("member") && access.Contains(wxT("public"))) return 6;
    if(kind == wxT("member") && access.Contains(wxT("protected"))) return 7;
    // member with no access? (maybe part of namespace??)
    if(kind == wxT("member")) return 6;
    if((kind == wxT("function") || kind == wxT("prototype")) && access.Contains(wxT("private"))) return 8;
    if((kind == wxT("function") || kind == wxT("prototype")) && (access.Contains(wxT("public")) || access.IsEmpty()))
        return 9;
    if((kind == wxT("function") || kind == wxT("prototype")) && access.Contains(wxT("protected"))) return 10;
    if(kind == wxT("macro")) return 11;
    if(kind == wxT("enum")) return 12;
    if(kind == wxT("enumerator")) return 13;
    if(kind == wxT("cpp_keyword")) return 17;
    return wxNOT_FOUND;
}
开发者ID:kluete,项目名称:codelite,代码行数:24,代码来源:wxCodeCompletionBox.cpp

示例15: DoMakeCommentForTag

wxString ImplementParentVirtualFunctionsDialog::DoMakeCommentForTag(TagEntryPtr tag) const
{
    // Add doxygen comment
    CppCommentCreator commentCreator(tag, m_doxyPrefix);
    DoxygenComment dc;
    dc.comment = commentCreator.CreateComment();
    dc.name    = tag->GetName();
    m_contextCpp->DoMakeDoxyCommentString( dc );

    // Format the comment
    wxString textComment = dc.comment;
    textComment.Replace("\r", "\n");
    wxArrayString lines = wxStringTokenize(textComment, "\n", wxTOKEN_STRTOK);
    textComment.Clear();

    for (size_t i=0; i<lines.GetCount(); ++i)
        textComment << lines.Item(i) << wxT("\n");
    return textComment;
}
开发者ID:05storm26,项目名称:codelite,代码行数:19,代码来源:implement_parent_virtual_functions.cpp


注:本文中的TagEntryPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。