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


C++ TagEntryPtr::GetLine方法代码示例

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


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

示例1: DoPopulateTags

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);
        }
    }
}
开发者ID:gitter-badger,项目名称:codelite,代码行数:49,代码来源:open_resource_dialog.cpp

示例2: OnGetItemText

wxString OpenTypeVListCtrl::OnGetItemText(long item, long column) const
{
	if(item >= (long)m_tags.size()) {
		return wxEmptyString;
	}
	TagEntryPtr t = m_tags.at(item);
	
	switch(column) {
	case 0: // name
		return t->GetName();
	case 1: // scope
		return t->GetScope();
	case 2: // file
		return t->GetFile();
	case 3: // line
		{
			wxString l;
			l << t->GetLine();
			return l;
		}
	default:
		return wxEmptyString;
	}
	return wxEmptyString;
}
开发者ID:05storm26,项目名称:codelite,代码行数:25,代码来源:opentypevlistctrl.cpp

示例3: DoCtagsGotoDecl

bool CodeCompletionManager::DoCtagsGotoDecl(clEditor* editor)
{
    TagEntryPtr tag = editor->GetContext()->GetTagAtCaret(true, false);
    if(tag) {
        clEditor* 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
        if(!editor->FindAndSelect(tag->GetPattern(), tag->GetName())) {
            editor->SetCaretAt(editor->PosFromLine(tag->GetLine() - 1));
            editor->CenterLineIfNeeded(tag->GetLine() - 1);
        }
        return true;
    }
    return false;
}
开发者ID:jiapei100,项目名称:codelite,代码行数:17,代码来源:code_completion_manager.cpp

示例4: RenameLocalSymbol

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

示例5: 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

示例6: DoPopulateTags

void OpenResourceDialog::DoPopulateTags()
{
	if (m_tags.empty())
		return;

	bool gotExactMatch(false);

	wxArrayString tmpArr;
	wxString curSel = m_textCtrlResourceName->GetValue();
	wxString curSelNoStar;
	if (!curSel.Trim().Trim(false).IsEmpty()) {

		curSel = curSel.MakeLower().Trim().Trim(false);
		curSelNoStar = curSel.c_str();

		for (size_t i=0; i<m_tags.size(); i++) {
			TagEntryPtr tag = m_tags.at(i);
			wxString    name(tag->GetName());

			name.MakeLower();

			//append wildcard at the end
			if (!curSel.EndsWith(wxT("*"))) {
				curSel << wxT("*");
			}

			// FR# [2008133]
			if (m_checkBoxUsePartialMatching->IsChecked() && !curSel.StartsWith(wxT("*"))) {
				curSel.Prepend(wxT("*"));
			}

			if (wxMatchWild(curSel, name)) {
				
				// keep the fullpath
				int index(0);
				if(tag->GetKind() == wxT("function") || tag->GetKind() == wxT("prototype"))
					index = DoAppendLine(tag->GetName(), 
										 tag->GetSignature(), 
										 tag->GetScope(), 
										 tag->GetKind() == wxT("function"),
										 new OpenResourceDialogItemData(tag->GetFile(), tag->GetLine(), tag->GetPattern(), m_type, tag->GetName(), tag->GetScope()));
				else 
					index = DoAppendLine(tag->GetName(), 
										 tag->GetScope(), 
										 wxT(""), 
										 false,
										 new OpenResourceDialogItemData(tag->GetFile(), tag->GetLine(), tag->GetPattern(), m_type, tag->GetName(), tag->GetScope()));
										 
				if (curSelNoStar == name && !gotExactMatch) {
					gotExactMatch = true;
					DoSelectItem(index);
				}
			}
		}
	}

	if (m_listOptions->GetItemCount() == 150) {
		m_staticTextErrorMessage->SetLabel(wxT("Too many matches, please narrow down your search"));
	}

	if (!gotExactMatch && m_listOptions->GetItemCount()) {
		DoSelectItem(0);
	}
}
开发者ID:RVictor,项目名称:EmbeddedLite,代码行数:64,代码来源:open_resource_dialog.cpp

示例7: 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


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