本文整理汇总了C++中ProjectsArray::Index方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectsArray::Index方法的具体用法?C++ ProjectsArray::Index怎么用?C++ ProjectsArray::Index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectsArray
的用法示例。
在下文中一共展示了ProjectsArray::Index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddProjectDependency
bool ProjectManager::AddProjectDependency(cbProject* base, cbProject* dependsOn)
{
if (!base || !dependsOn)
return false;
// avoid circular dependencies
if ( CausesCircularDependency(base, dependsOn) )
return false;
ProjectsArray* arr = nullptr;
DepsMap::iterator it = m_ProjectDeps.find(base);
if (it == m_ProjectDeps.end())
{
// create a ProjectsArray* to hold the dependencies for base
arr = new ProjectsArray;
m_ProjectDeps[base] = arr;
}
else
arr = it->second;
// add dependency only if not already there
if (arr && arr->Index(dependsOn) == wxNOT_FOUND)
{
arr->Add(dependsOn);
if (m_pWorkspace)
m_pWorkspace->SetModified(true);
Manager::Get()->GetLogManager()->DebugLog(F(_T("%s now depends on %s (%lu deps)"), base->GetTitle().wx_str(), dependsOn->GetTitle().wx_str(), static_cast<unsigned long>(arr->GetCount())));
}
return true;
}
示例2: RemoveProjectFromAllDependencies
void ProjectManager::RemoveProjectFromAllDependencies(cbProject* base)
{
if (!base)
return;
DepsMap::iterator it = m_ProjectDeps.begin();
while (it != m_ProjectDeps.end())
{
if (it->first == base)
{
++it;
continue;
}
ProjectsArray* arr = it->second;
// only check projects that do have a dependencies array
if (!arr)
{
++it;
continue;
}
int index = arr->Index(base);
if (index != wxNOT_FOUND)
arr->RemoveAt(index);
if (m_pWorkspace)
m_pWorkspace->SetModified(true);
// if it was the last dependency, delete the array
if (!arr->GetCount())
{
DepsMap::iterator it2 = it++;
m_ProjectDeps.erase(it2);
delete arr;
}
else
++it;
}
Manager::Get()->GetLogManager()->DebugLog(F(_T("Removed %s from all deps"), base->GetTitle().wx_str()));
}