本文整理汇总了C++中TagEntryPtr::GetScope方法的典型用法代码示例。如果您正苦于以下问题:C++ TagEntryPtr::GetScope方法的具体用法?C++ TagEntryPtr::GetScope怎么用?C++ TagEntryPtr::GetScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagEntryPtr
的用法示例。
在下文中一共展示了TagEntryPtr::GetScope方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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;
}
示例3: OnCodeCompletionSelectionMade
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]);
}
}
示例4: 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());
}
}
示例5: 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);
}
}
示例6: DoResolveWord
bool RefactoringEngine::DoResolveWord(TextStatesPtr states, const wxFileName& fn, int pos, int line, const wxString &word, RefactorSource *rs)
{
std::vector<TagEntryPtr> tags;
// try to process the current expression
wxString expr = GetExpression(pos, states);
// sanity
if(states->text.length() < (size_t)pos + 1)
return false;
// get the scope
// Optimize the text for large files
wxString text(states->text.substr(0, pos + 1));
// we simply collect declarations & implementations
//try implemetation first
bool found(false);
TagsManagerST::Get()->FindImplDecl(fn, line, expr, word, text, tags, true, true);
if (tags.empty() == false) {
// try to see if we got a function and not class/struct
for (size_t i=0; i<tags.size(); i++) {
TagEntryPtr tag = tags.at(i);
// find first non class/struct tag
if (tag->GetKind() != wxT("class") && tag->GetKind() != wxT("struct")) {
// if there is no match, add it anyways
if (!found) {
rs->isClass = (tag->GetKind() == wxT("class") ||tag->GetKind() == wxT("struct"));
rs->name = tag->GetName();
rs->scope = tag->GetScope();
found = true;
} else if (rs->scope == wxT("<global>") && rs->isClass == false) {
// give predecense to <global> variables
rs->isClass = (tag->GetKind() == wxT("class") ||tag->GetKind() == wxT("struct"));
rs->name = tag->GetName();
rs->scope = tag->GetScope();
found = true;
}
found = true;
}
}
// if no match was found, keep the first result but keep searching
if ( !found ) {
TagEntryPtr tag = tags.at(0);
rs->scope = tag->GetScope();
rs->name = tag->GetName();
rs->isClass = tag->IsClass() || tag->IsStruct();
found = true;
} else {
return true;
}
}
// Ok, the "implementation" search did not yield definite results, try declaration
tags.clear();
TagsManagerST::Get()->FindImplDecl(fn, line, expr, word, text, tags, false, true);
if (tags.empty() == false) {
// try to see if we got a function and not class/struct
for (size_t i=0; i<tags.size(); i++) {
TagEntryPtr tag = tags.at(i);
// find first non class/struct tag
if (tag->GetKind() != wxT("class") && tag->GetKind() != wxT("struct")) {
rs->name = tag->GetName();
rs->scope = tag->GetScope();
return true;
}
}
// if no match was found, keep the first result but keep searching
if ( !found ) {
TagEntryPtr tag = tags.at(0);
rs->scope = tag->GetScope();
rs->name = tag->GetName();
rs->isClass = tag->IsClass() || tag->IsStruct();
}
return true;
}
// if we got so far, CC failed to parse the expression
return false;
}