本文整理汇总了C++中CSimpleMap::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CSimpleMap::Add方法的具体用法?C++ CSimpleMap::Add怎么用?C++ CSimpleMap::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSimpleMap
的用法示例。
在下文中一共展示了CSimpleMap::Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MuxStreamInfo
void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
{
int len = 1;
CSimpleMap<CStringA, CStringA> si;
for(int i = 0; i < pPin->GetSize(); i++)
{
CStringA key = CStringA(CString(pPin->GetKeyAt(i))), value = UTF16To8(pPin->GetValueAt(i));
if(key.GetLength() != 4) continue;
si.Add(key, value);
len += 4 + value.GetLength() + 1;
}
if(len > 1)
{
MuxPacketHeader(pBS, DSMP_STREAMINFO, len);
pBS->BitWrite(pPin->GetID(), 8);
for(int i = 0; i < si.GetSize(); i++)
{
CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
pBS->ByteWrite((LPCSTR)key, 4);
pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
}
}
}
示例2: DbgGetPKEY
/**
* Get named PROPERTYKEY for debug log.
* Attempt to translate it through standard property system lookup, or our
* custom Registry repository of GUIDs.
*/
LPCWSTR DbgGetPKEY(REFPROPERTYKEY pkey)
{
static CComAutoCriticalSection s_lock;
CComCritSecLock<CComCriticalSection> lock(s_lock);
static CSimpleMap< PROPERTYKEY, CComBSTR, CSimpleMapPkeyEqualHelper<PROPERTYKEY, CComBSTR> > s_Cache;
LPCWSTR pwstrResult = s_Cache.Lookup(pkey);
if( pwstrResult != NULL ) return pwstrResult;
WCHAR wszName[80] = { 0 };
// Let Windows tell us the property name
CCoTaskString str;
if( SUCCEEDED( ::PSGetNameFromPropertyKey(pkey, &str) ) ) wcscpy_s(wszName, lengthof(wszName), str);
// Attempt to find it in our Named GUIDs section
if( wszName[0] == '\0' ) {
WCHAR wszGUID[70] = { 0 };
CRegKey key;
DWORD dwType = 0, dwCount = sizeof(wszGUID) - sizeof(TCHAR);
key.Open(HKEY_CLASSES_ROOT, _T("Named GUIDs"), KEY_READ);
if( key.Open(key, wszGUID, KEY_READ) == NOERROR ) ::RegQueryValueExW(key.m_hKey, NULL, NULL, &dwType, (LPBYTE) wszName, &dwCount);
}
// Just format the GUID
if( wszName[0] == '\0' ) ::PSStringFromPropertyKey(pkey, wszName, lengthof(wszName));
// Add it to cache and return
s_Cache.Add(pkey, CComBSTR(wszName));
return s_Cache.Lookup(pkey);
}
示例3: DbgGetIID
/**
* Get named GUID for debug log.
* Attempt to translate it through standard Registry lookup, or our
* custom Registry repository of interface, GUID, Co-class names.
*/
LPCWSTR DbgGetIID(REFIID riid)
{
static CComAutoCriticalSection s_lock;
CComCritSecLock<CComCriticalSection> lock(s_lock);
static CSimpleMap<GUID, CComBSTR> s_Cache;
LPCWSTR pwstrResult = s_Cache.Lookup(riid);
if( pwstrResult != NULL ) return pwstrResult;
TCHAR szName[80] = { 0 };
OLECHAR wszGUID[50] = { 0 };
::StringFromGUID2(riid, wszGUID, lengthof(wszGUID));
// Attempt to find it in the interfaces section
CRegKey key;
DWORD dwType = 0;
DWORD dwCount = sizeof(szName) - sizeof(TCHAR);
key.Open(HKEY_CLASSES_ROOT, _T("Interface"), KEY_READ);
if( szName[0] == '\0' && key.Open(key, wszGUID, KEY_READ) == NOERROR ) {
::RegQueryValueEx(key.m_hKey, NULL, NULL, &dwType, (LPBYTE) szName, &dwCount);
}
// Attempt to find it in the CLSID section
key.Open(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_READ);
if( szName[0] == '\0' && key.Open(key, wszGUID, KEY_READ) == NOERROR ) {
::RegQueryValueEx(key.m_hKey, NULL, NULL, &dwType, (LPBYTE) szName, &dwCount);
}
// Attempt to find it in our Named GUIDs section
key.Open(HKEY_CLASSES_ROOT, _T("Named GUIDs"), KEY_READ);
if( szName[0] == '\0' && key.Open(key, wszGUID, KEY_READ) == NOERROR ) {
::RegQueryValueEx(key.m_hKey, NULL, NULL, &dwType, (LPBYTE) szName, &dwCount);
}
if( szName[0] == '\0' ) wcscpy_s(szName, lengthof(szName), CW2T(wszGUID));
s_Cache.Add(riid, CComBSTR(szName));
return s_Cache.Lookup(riid);
}
示例4: GroupByColumn
//------------------------------------------------------------------------
//! Create a group for each unique values within a column
//!
//! @param nCol The index of the column
//! @return Succeeded in creating the group
//------------------------------------------------------------------------
BOOL CGridListCtrlGroups::GroupByColumn(int nCol)
{
CWaitCursor waitCursor;
SetSortArrow(-1, false);
SetRedraw(FALSE);
RemoveAllGroups();
EnableGroupView( GetItemCount() > 0 );
if (IsGroupViewEnabled())
{
CSimpleMap<CString,CSimpleArray<int> > groups;
// Loop through all rows and find possible groups
for(int nRow=0; nRow<GetItemCount(); ++nRow)
{
CString cellText = GetItemText(nRow, nCol);
int nGroupId = groups.FindKey(cellText);
if (nGroupId==-1)
{
CSimpleArray<int> rows;
groups.Add(cellText, rows);
nGroupId = groups.FindKey(cellText);
}
groups.GetValueAt(nGroupId).Add(nRow);
}
// Look through all groups and assign rows to group
for(int nGroupId = 0; nGroupId < groups.GetSize(); ++nGroupId)
{
const CSimpleArray<int>& groupRows = groups.GetValueAt(nGroupId);
DWORD dwState = LVGS_NORMAL;
#ifdef LVGS_COLLAPSIBLE
if (IsGroupStateEnabled())
dwState = LVGS_COLLAPSIBLE;
#endif
VERIFY( InsertGroupHeader(nGroupId, nGroupId, groups.GetKeyAt(nGroupId), dwState) != -1);
for(int groupRow = 0; groupRow < groupRows.GetSize(); ++groupRow)
{
VERIFY( SetRowGroupId(groupRows[groupRow], nGroupId) );
}
}
SetRedraw(TRUE);
Invalidate(FALSE);
return TRUE;
}
SetRedraw(TRUE);
Invalidate(FALSE);
return FALSE;
}
示例5: SetEncConverter
void SetEncConverter(const CStringW& strConverterName, CSilEncConverter* pEC)
{
int nIndex;
if ((nIndex = m_mapECs.FindKey(strConverterName)) != -1)
{
CSilEncConverter* p = m_mapECs.GetValueAt(nIndex);
m_mapECs.RemoveAt(nIndex);
delete p;
}
m_mapECs.Add(strConverterName, pEC);
}
示例6: _GetData
void CPluginPropertyPage::_GetData()
{
CSimpleMap<int , CSimpleArray<CString>*> map;
for (int nType = PLT_TOOLBAR/*1*/; nType <= PLUGIN_TYPECNT; nType++) {
CSimpleArray<CString>*pAry = new CSimpleArray<CString>;
map.Add( nType, pAry );
}
int nIndex;
for (nIndex = 0; nIndex < m_listview.GetItemCount(); nIndex++) {
CString strFile;
m_listview.GetItemText( nIndex, 0, strFile );
if ( FALSE == m_listview.GetCheckState( nIndex ) )
continue;
int nType = int( m_listview.GetItemData( nIndex ) );
CSimpleArray<CString>* pAry = NULL;
pAry = map.Lookup( nType );
if (NULL == pAry)
continue;
pAry->Add( strFile );
}
for (nIndex = 0; nIndex < map.GetSize(); nIndex++) {
CSimpleArray<CString>*pAry = NULL;
pAry = map.GetValueAt( nIndex );
int nType = map.GetKeyAt( nIndex );
CString strKey;
strKey.Format( _T("Plugin%02d"), nType );
CIniFileO pr( g_szIniFileName, strKey );
pr.SetValue( pAry->GetSize(), _T("Count") );
for (int nNo = 0; nNo < pAry->GetSize(); nNo++) {
strKey.Format(_T("%02d"), nNo);
pr.SetString( (*pAry)[nNo], strKey );
}
delete pAry;
}
}
示例7: SUCCEEDED
CCrashHandler::CCrashHandler(LPGETLOGFILE lpfn /*=NULL*/,
const char * lpcszTo /*=NULL*/,
const char * lpcszSubject /*=NULL*/,
bool bInstallHandler /*= true*/)
{
// wtl initialization stuff...
HRESULT hRes = ::CoInitialize(NULL);
//Если COM уже проинициализировали, но в другом режиме - мы не бужем вызывать разинициализацию
if (hRes == RPC_E_CHANGED_MODE)
m_COMInited = false;
else
{
ATLASSERT(SUCCEEDED(hRes));
m_COMInited = SUCCEEDED(hRes);
}
hRes = _Module.Init(NULL, GetModuleHandle("CrashRpt.dll"));
ATLASSERT(SUCCEEDED(hRes));
::DefWindowProc(NULL, 0, 0, 0L);
// initialize member data
m_lpfnCallback = NULL;
m_oldFilter = NULL;
// save user supplied callback
if (lpfn)
m_lpfnCallback = lpfn;
if (bInstallHandler)
{
// add this filter in the exception callback chain
m_oldFilter = SetUnhandledExceptionFilter(CustomUnhandledExceptionFilter);
// attach this handler with this process
m_pid = _getpid();
if (!_crashStateMap.SetAt(m_pid, this))
_crashStateMap.Add(m_pid, this);
}
// save optional email info
m_sTo = lpcszTo;
m_sSubject = lpcszSubject;
}
示例8: MuxFileInfo
void CDSMMuxerFilter::MuxFileInfo(IBitStream* pBS)
{
int len = 1;
CSimpleMap<CStringA, CStringA> si;
for (int i = 0; i < GetSize(); i++) {
CStringA key = CStringA(CString(GetKeyAt(i))), value = UTF16To8(GetValueAt(i));
if (key.GetLength() != 4) {
continue;
}
si.Add(key, value);
len += 4 + value.GetLength() + 1;
}
MuxPacketHeader(pBS, DSMP_FILEINFO, len);
pBS->BitWrite(DSMF_VERSION, 8);
for (int i = 0; i < si.GetSize(); i++) {
CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
pBS->ByteWrite((LPCSTR)key, 4);
pBS->ByteWrite((LPCSTR)value, value.GetLength() + 1);
}
}