本文整理汇总了C++中phpentitybase::Ptr_t::SetChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr_t::SetChildren方法的具体用法?C++ Ptr_t::SetChildren怎么用?C++ Ptr_t::SetChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpentitybase::Ptr_t
的用法示例。
在下文中一共展示了Ptr_t::SetChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoGetPHPEntryUnderTheAtPos
PHPEntityBase::Ptr_t PHPCodeCompletion::DoGetPHPEntryUnderTheAtPos(IEditor* editor, int pos, bool forFunctionCalltip)
{
if(!PHPWorkspace::Get()->IsOpen()) return PHPEntityBase::Ptr_t(NULL);
pos = editor->GetCtrl()->WordEndPosition(pos, true);
// Get the expression under the caret
wxString unsavedBuffer = editor->GetTextRange(0, pos);
wxString filter;
PHPEntityBase::Ptr_t resolved;
// Parse the source file
PHPSourceFile source(unsavedBuffer);
source.SetFilename(editor->GetFileName());
source.SetParseFunctionBody(false);
source.Parse();
PHPEntityBase::Ptr_t currentScope = source.CurrentScope();
if(currentScope && currentScope->Is(kEntityTypeClass)) {
// we are trying to resolve a 'word' under the caret within the class
// body but _not_ within a function body (i.e. it can only be
// a definition of some kind)
// try to construct an expression that will work
int wordStart = editor->GetCtrl()->WordStartPosition(pos, true);
wxString theWord = editor->GetTextRange(wordStart, pos);
wxString theWordNoDollar = theWord;
if(theWord.StartsWith("$")) {
theWordNoDollar = theWord.Mid(1);
}
PHPExpression expr2(unsavedBuffer, "<?php $this->" + theWordNoDollar, forFunctionCalltip);
resolved = expr2.Resolve(m_lookupTable, editor->GetFileName().GetFullPath());
filter = expr2.GetFilter();
if(!resolved) {
// Maybe its a static member/function/const, try using static keyword
PHPExpression expr3(unsavedBuffer, "<?php static::" + theWord, forFunctionCalltip);
resolved = expr2.Resolve(m_lookupTable, editor->GetFileName().GetFullPath());
filter = expr2.GetFilter();
}
}
if(!resolved) {
PHPExpression expr(unsavedBuffer, "", forFunctionCalltip);
resolved = expr.Resolve(m_lookupTable, editor->GetFileName().GetFullPath());
filter = expr.GetFilter();
}
if(resolved && !filter.IsEmpty()) {
resolved = m_lookupTable.FindMemberOf(resolved->GetDbId(), filter);
if(!resolved) {
// Fallback to functions and constants
PHPEntityBase::List_t children =
m_lookupTable.FindGlobalFunctionAndConsts(PHPLookupTable::kLookupFlags_ExactMatch, filter);
if(children.size() == 1) {
resolved = *children.begin();
}
}
if(resolved && resolved->Is(kEntityTypeFunction)) {
// for a function, we need to load its children (function arguments)
resolved->SetChildren(m_lookupTable.LoadFunctionArguments(resolved->GetDbId()));
} else if(resolved && resolved->Is(kEntityTypeFunctionAlias)) {
// for a function alias, we need to load the actual functions' children (function arguments)
PHPEntityBase::Ptr_t realFunc = resolved->Cast<PHPEntityFunctionAlias>()->GetFunc();
realFunc->SetChildren(m_lookupTable.LoadFunctionArguments(realFunc->GetDbId()));
}
}
return resolved;
}