本文整理汇总了C++中CAtlMap::GetStartPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlMap::GetStartPosition方法的具体用法?C++ CAtlMap::GetStartPosition怎么用?C++ CAtlMap::GetStartPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlMap
的用法示例。
在下文中一共展示了CAtlMap::GetStartPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDataChange
void AsyncUpdateHandler::OnDataChange(COPCGroup & group, CAtlMap<COPCItem *, OPCItemData *> & changes)
{
log_NOTICE("OnDataChange called, group [", group.getName(),"] change count [", pantheios::integer(changes.GetCount()),"] have callback [",(callbackFn != NULL?"Y":"N"),"]");
for(POSITION pos = changes.GetStartPosition(); pos != NULL; )
{
CAtlMap<COPCItem *, OPCItemData *>::CPair* pPair = changes.GetNext(pos);
ItemValueStruct itemValueStruct(pPair->m_value);
const ItemValue& itemValue = itemValueStruct.getItemValue();
log_NOTICE("\t item [",pPair->m_key->getName(),"] value [", itemValueStruct.getItemValue().value,"]");
if(callbackFn != NULL)
{
log_NOTICE("\t OnDataChange calling callback fn");
//Update* update = createUpdate(pPair->m_key->getName().GetString(), itemValue.value, itemValue.quality, itemValue.dataType, itemValue.timestamp);
callbackFn(pPair->m_key->getName().GetString(), itemValue.value, itemValue.quality, itemValue.dataType, itemValue.timestamp);
log_DEBUG("\t OnDataChange called callback fn");
/*
callbackFn(update);
log_DEBUG("\t OnDataChange called callback fn");
destroyUpdate(update);
log_DEBUG("\t OnDataChange destroyed object");
*/
}
}
}
示例2: PathFindExtension
STDMETHODIMP CPreviewPlugin::Preview2(/* [in] */ BSTR sSource, /* [in] */ BSTR sTarget)
{
m_bCancel = false;
if ( ! sSource || ! sTarget )
return E_POINTER;
if ( ! m_pSite )
return E_UNEXPECTED;
// Get extension
LPCTSTR szTargetExt = PathFindExtension( sTarget );
if ( ! *szTargetExt )
return E_INVALIDARG;
// Load data
CAtlMap< CString, CString > oData;
LoadData( oData );
// Find command line for extension
for ( POSITION pos = oData.GetStartPosition(); pos; )
{
CString sExt, sCommand;
oData.GetNextAssoc( pos, sExt, sCommand );
TCHAR szKey[ MAX_PATH ] = { _T(".") };
for ( LPCTSTR str = sExt.GetBuffer(); ; ++str )
{
LPTSTR space = StrChr( str, _T(' ') );
if ( space )
*space = _T('\0');
lstrcpyn( szKey + 1, str, _countof( szKey ) - 1 );
StrTrim( szKey + 1, _T(". /t") );
if ( lstrcmpi( szKey, szTargetExt ) == 0 )
{
// Found!
sExt.ReleaseBuffer();
if ( sCommand.Replace( _T("%1"), sSource ) == 0 ||
sCommand.Replace( _T("%2"), sTarget ) == 0 )
// Invalid command line
return E_INVALIDARG;
m_pSite->SetProgressMessage( CComBSTR( sCommand ) );
m_pSite->SetProgressRange( 100 );
if ( ! Execute( sCommand ) )
// Can't launch external program
return E_FAIL;
m_pSite->SetProgressPosition( 100 );
// Check for resulting file
if ( GetFileAttributes( sTarget ) == INVALID_FILE_ATTRIBUTES )
// No file (user canceled it)
return S_FALSE;
// Run it
m_pSite->QueueDeleteFile( sTarget );
if ( ! m_bCancel )
m_pSite->ExecuteFile( sTarget );
return S_OK;
}
if ( ! space )
{
sExt.ReleaseBuffer();
break;
}
str = space;
}
}
return E_INVALIDARG;
}