wxString WizardsPlugin::DoGetVirtualFuncDecl(const NewClassInfo &info, const wxString& separator) { 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); // Skip c-tors/d-tors if(tt->IsDestructor() || tt->IsConstructor()) continue; if (info.implAllVirtual && m_mgr->GetTagsManager()->IsVirtual(tt)) { tags.push_back(tt); } else if (info.implAllPureVirtual && m_mgr->GetTagsManager()->IsPureVirtual(tt)) { tags.push_back(tt); } } wxString decl; for (std::vector< TagEntryPtr >::size_type i=0; i< tags.size(); i++) { TagEntryPtr tt = tags.at(i); wxString ff = m_mgr->GetTagsManager()->FormatFunction(tt); if (info.isInline) { wxString braces; braces << wxT('\n') << separator << wxT("{\n") << separator << wxT("}"); ff.Replace (wxT(";"), braces); } decl << separator << ff; } return decl; }
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; }