本文整理汇总了C++中Worker::GetIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Worker::GetIndex方法的具体用法?C++ Worker::GetIndex怎么用?C++ Worker::GetIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worker
的用法示例。
在下文中一共展示了Worker::GetIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectWorkerByName
//
// Find a worker by its name (as stored in result file) and select it
// as though it had been dragged.
//
void CPageDisplay::SelectWorkerByName( int button, const char *wkr_name, const int wkr_id )
{
Manager *mgr;
Worker *wkr;
if ( !wkr_name )
{
ErrorMessage( "Invalid string in CPageDisplay::SelectWorkerByName()" );
return;
}
// Get a pointer to the button's currently assigned manager
mgr = barcharts[button].manager;
if ( mgr )
{
// The specified button already has a manager (probably was just assigned by
// the previous line in the config file, but even if not we'll use it anyway).
if ( strlen( wkr_name ) )
{
// The worker name is non-empty; get a pointer to the
// first worker with the specified name within the current manager
wkr = mgr->GetWorkerByName( wkr_name, wkr_id );
if ( wkr )
{
// A worker with the specified name was found; use it
SetResultSource( mgr->GetIndex(), wkr->GetIndex(), button );
}
else
{
// No worker with the specified name was found
if ( mgr->WorkerCount() == 1 )
{
// There is only one worker; use it (ignoring its name)
SetResultSource( mgr->GetIndex(), 0, button );
}
else
{
// More than one worker; default to all workers
SetResultSource( mgr->GetIndex(), IOERROR, button );
}
}
}
else
{
// The worker name is an empty string; use all workers
SetResultSource( mgr->GetIndex(), IOERROR, button );
}
}
// Else: the specified button does not have a manager, ignore the specified worker name
}